[MRM-1164] Improve the Selenium tests so testng.properties no longer needs to be modified (patch #4

Submitted by: Marecor Baclay
Also changed the webapp-test profile id to 'it' (integration test). Run with -Pit to include this module.


git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@776772 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Wendy Smoak 2009-05-20 17:26:30 +00:00
parent 1cc84d7fdc
commit 9c97bf35bc
6 changed files with 85 additions and 22 deletions

View File

@ -21,8 +21,8 @@ ARTIFACT_VERSION=1.0
ARTIFACT_PACKAGING=jar
# Reports
REPOSITORY_NAME=internal
START_DATE=04/01/2009
END_DATE=04/30/2009
START_DATE=05/01/2009
END_DATE=05/30/2009
# Add Valid Artifact
@ -68,5 +68,13 @@ GROUPID=test
ARTIFACTID=test
VERSION=1.0
PACKAGING=jar
ARTIFACTFILEPATH=/path/to/artifact/file
ARTIFACTFILEPATH=test
REPOSITORYID=internal
GROUPID1=delete
ARTIFACTID1=delete
VERSION1=1.0
PACKAGING1=jar
ARTIFACTFILEPATH1=test
# /home/cora/Documents/MAESTRO/installers/maestro-2.1.1/project-server/core/activation-1.1.jar
REPOSITORYID1=internal

View File

@ -7,6 +7,7 @@ import org.testng.annotations.Test;
public class ArtifactManagementTest
extends AbstractArtifactManagementTest
{
public void testAddArtifactNullValues()
{
@ -30,6 +31,7 @@ public class ArtifactManagementTest
@Test(dependsOnMethods = { "testAddArtifactNoGroupId" } )
public void testAddArtifactNoArtifactId()
{
addArtifact( getGroupId() , " ", getVersion(), getPackaging() , getArtifactFilePath(), getRepositoryId() );
assertTextPresent( "You must enter an artifactId." );
}
@ -41,6 +43,13 @@ public class ArtifactManagementTest
assertTextPresent( "You must enter a version." );
}
@Test(dependsOnMethods = { "testAddArtifactNoGroupId" } )
public void testAddArtifactInvalidVersion()
{
addArtifact( getGroupId() , getArtifactId(), "asdf", getPackaging() , getArtifactFilePath(), getRepositoryId() );
assertTextPresent( "Invalid version." );
}
@Test(dependsOnMethods = { "testAddArtifactNoGroupId" } )
public void testAddArtifactNoPackaging()
{
@ -60,4 +69,47 @@ public class ArtifactManagementTest
addArtifact( getGroupId() , getArtifactId(), getVersion(), getPackaging() , getArtifactFilePath(), getRepositoryId() );
assertTextPresent( "Artifact 'test:test:1.0' was successfully deployed to repository 'internal'" );
}
public void testAddArtifactValidValues1()
{
String groupId = p.getProperty( "GROUPID1" );
String artifactId = p.getProperty( "ARTIFACTID1" );
String version = p.getProperty( "VERSION1" );
String packaging = p.getProperty( "PACKAGING1" );
String repositoryId = p.getProperty( "REPOSITORYID1" );
addArtifact( groupId , artifactId, version, packaging , getArtifactFilePath(), repositoryId );
assertTextPresent( "Artifact 'delete:delete:1.0' was successfully deployed to repository 'internal'" );
}
@Test(dependsOnMethods = { "testAddArtifactValidValues1" } )
public void testDeleteArtifact()
{
deleteArtifact( "delete", "delete", "1.0", "internal");
assertTextPresent( "Artifact 'delete:delete:1.0' was successfully deleted from repository 'internal'" );
}
public void testDeleteArtifactNoGroupId()
{
deleteArtifact( " ", "delete", "1.0", "internal");
assertTextPresent( "You must enter a groupId." );
}
public void testDeleteArtifactNoArtifactId()
{
deleteArtifact( "delete", " ", "1.0", "internal");
assertTextPresent( "You must enter an artifactId." );
}
public void testDeleteArtifactNoVersion()
{
deleteArtifact( "delete", "delete", " ", "internal");
assertTextPresent( "Invalid version." );
assertTextPresent( "You must enter a version." );
}
public void testDeleteArtifactInvalidVersion()
{
deleteArtifact( "delete", "delete", "asdf", "internal");
assertTextPresent( "Invalid version." );
}
}

View File

@ -22,7 +22,7 @@ package org.apache.archiva.web.test;
import org.apache.archiva.web.test.parent.AbstractBrowseTest;
import org.testng.annotations.Test;
@Test( groups = { "browse" }, dependsOnMethods = { "testWithCorrectUsernamePassword" } )
@Test( groups = { "browse" }, dependsOnMethods = { "testAddArtifactNullValues" } )
public class BrowseTest
extends AbstractBrowseTest
{

View File

@ -36,14 +36,14 @@ public class ReportsTest
assertTextPresent( "Please select a repository (or repositories) from the list." );
}
/* @Test(dependsOnMethods = { "testRepoStatisticsWithoutRepoCompared" } )
@Test(dependsOnMethods = { "testRepoStatisticsWithoutRepoCompared" } )
public void testRepositoryStatisticsWithoutDate()
{
String repositoryName = p.getProperty( "REPOSITORY_NAME" ) ;
compareRepositories( "label=" + repositoryName, "", "" );
//TODO
assertTextPresent( "Statistics Report" );
}*/
//assertTextPresent( "Statistics Report" );
}
@Test(dependsOnMethods = { "testRepoStatisticsWithoutRepoCompared" } )
public void testRepositoryStatisticsEndEarlierThanStart()
@ -57,7 +57,7 @@ public class ReportsTest
assertTextPresent( "Start Date must be earlier than the End Date" );
}
/* @Test(dependsOnMethods = { "testAddArtifactValidValues" } )
@Test(dependsOnMethods = { "testAddArtifactValidValues" } )
public void testRepositoryStatistics()
{
String repositoryName = p.getProperty( "REPOSITORY_NAME" ) ;
@ -65,19 +65,19 @@ public class ReportsTest
String endDate = p.getProperty( "END_DATE" );
compareRepositories( "label=" + repositoryName, startDate, endDate );
//assertTextPresent( "Statistics for Repository '" + repositoryName + "'" );
assertPage( "Apache Archiva \\ Reports" );
assertTextPresent( "Statistics Report" );
}*/
//assertPage( "Apache Archiva \\ Reports" );
//assertTextPresent( "Statistics Report" );
}
/* @Test(dependsOnMethods = { "testAddArtifactValidValues" } )
/* @Test( dependsOnMethods = { "testRepositoryStatistics" } )
public void testRepositoriesStatisticComparisonReport()
{
goToReportsPage();
//goToReportsPage();
clickButtonWithValue( "-->>" , false );
clickButtonWithValue( "View Statistics" );
assertTextPresent( "Statistics Report" );
}
*/
@Test(dependsOnMethods = { "testAddArtifactValidValues" } )
public void testRepositoryHealthWithoutDefect()
{
@ -89,10 +89,10 @@ public class ReportsTest
assertTextPresent( "The operation generated an empty report." );
}
/* @Test(dependsOnMethods = { "testAddArtifactValidValues" } )
@Test(dependsOnMethods = { "testAddArtifactValidValues" } )
public void testRepositoryHealthWithoutGroupId()
{
//goToReportsPage();
goToReportsPage();
clickButtonWithValue( "Show Report" );
assertPage( "Apache Archiva \\ Reports" );
assertTextPresent( "The operation generated an empty report." );
@ -102,4 +102,4 @@ public class ReportsTest
}
}

View File

@ -1,5 +1,7 @@
package org.apache.archiva.web.test.parent;
import java.io.File;
public abstract class AbstractArtifactManagementTest
extends AbstractArchivaTest
{
@ -30,8 +32,9 @@ public abstract class AbstractArtifactManagementTest
public String getArtifactFilePath()
{
String artifactFilePath = p.getProperty( "ARTIFACTFILEPATH" ) ;
return artifactFilePath;
File f = new File( "" );
String artifactFilePath = f.getAbsolutePath();
return artifactFilePath + "/src/test/it-resources/snapshots/org/apache/maven/archiva/web/test/foo-bar/1.0-SNAPSHOT/foo-bar-1.0-SNAPSHOT.jar" ;
}
public String getRepositoryId()
@ -51,7 +54,7 @@ public abstract class AbstractArtifactManagementTest
clickLinkWithText( "Delete Artifact" );
assertDeleteArtifactPage();
}
public void addArtifact( String groupId, String artifactId, String version, String packaging, String artifactFilePath, String repositoryId )
{
addArtifact(groupId, artifactId, version, packaging, true, artifactFilePath, repositoryId);
@ -78,7 +81,7 @@ public abstract class AbstractArtifactManagementTest
public void deleteArtifact( String groupId, String artifactId, String version, String repositoryId )
{
goToAddArtifactPage();
goToDeleteArtifactPage();
setFieldValue( "groupId" , groupId );
setFieldValue( "artifactId" , artifactId );
setFieldValue( "version" , version );

View File

@ -39,7 +39,7 @@
<profiles>
<profile>
<id>webapp-test</id>
<id>it</id>
<modules>
<module>archiva-webapp-test</module>
</modules>