[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 ARTIFACT_PACKAGING=jar
# Reports # Reports
REPOSITORY_NAME=internal REPOSITORY_NAME=internal
START_DATE=04/01/2009 START_DATE=05/01/2009
END_DATE=04/30/2009 END_DATE=05/30/2009
# Add Valid Artifact # Add Valid Artifact
@ -68,5 +68,13 @@ GROUPID=test
ARTIFACTID=test ARTIFACTID=test
VERSION=1.0 VERSION=1.0
PACKAGING=jar PACKAGING=jar
ARTIFACTFILEPATH=/path/to/artifact/file ARTIFACTFILEPATH=test
REPOSITORYID=internal 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 public class ArtifactManagementTest
extends AbstractArtifactManagementTest extends AbstractArtifactManagementTest
{ {
public void testAddArtifactNullValues() public void testAddArtifactNullValues()
{ {
@ -30,6 +31,7 @@ public class ArtifactManagementTest
@Test(dependsOnMethods = { "testAddArtifactNoGroupId" } ) @Test(dependsOnMethods = { "testAddArtifactNoGroupId" } )
public void testAddArtifactNoArtifactId() public void testAddArtifactNoArtifactId()
{ {
addArtifact( getGroupId() , " ", getVersion(), getPackaging() , getArtifactFilePath(), getRepositoryId() ); addArtifact( getGroupId() , " ", getVersion(), getPackaging() , getArtifactFilePath(), getRepositoryId() );
assertTextPresent( "You must enter an artifactId." ); assertTextPresent( "You must enter an artifactId." );
} }
@ -41,6 +43,13 @@ public class ArtifactManagementTest
assertTextPresent( "You must enter a version." ); 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" } ) @Test(dependsOnMethods = { "testAddArtifactNoGroupId" } )
public void testAddArtifactNoPackaging() public void testAddArtifactNoPackaging()
{ {
@ -60,4 +69,47 @@ public class ArtifactManagementTest
addArtifact( getGroupId() , getArtifactId(), getVersion(), getPackaging() , getArtifactFilePath(), getRepositoryId() ); addArtifact( getGroupId() , getArtifactId(), getVersion(), getPackaging() , getArtifactFilePath(), getRepositoryId() );
assertTextPresent( "Artifact 'test:test:1.0' was successfully deployed to repository 'internal'" ); 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.apache.archiva.web.test.parent.AbstractBrowseTest;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@Test( groups = { "browse" }, dependsOnMethods = { "testWithCorrectUsernamePassword" } ) @Test( groups = { "browse" }, dependsOnMethods = { "testAddArtifactNullValues" } )
public class BrowseTest public class BrowseTest
extends AbstractBrowseTest extends AbstractBrowseTest
{ {

View File

@ -36,14 +36,14 @@ public class ReportsTest
assertTextPresent( "Please select a repository (or repositories) from the list." ); assertTextPresent( "Please select a repository (or repositories) from the list." );
} }
/* @Test(dependsOnMethods = { "testRepoStatisticsWithoutRepoCompared" } ) @Test(dependsOnMethods = { "testRepoStatisticsWithoutRepoCompared" } )
public void testRepositoryStatisticsWithoutDate() public void testRepositoryStatisticsWithoutDate()
{ {
String repositoryName = p.getProperty( "REPOSITORY_NAME" ) ; String repositoryName = p.getProperty( "REPOSITORY_NAME" ) ;
compareRepositories( "label=" + repositoryName, "", "" ); compareRepositories( "label=" + repositoryName, "", "" );
//TODO //TODO
assertTextPresent( "Statistics Report" ); //assertTextPresent( "Statistics Report" );
}*/ }
@Test(dependsOnMethods = { "testRepoStatisticsWithoutRepoCompared" } ) @Test(dependsOnMethods = { "testRepoStatisticsWithoutRepoCompared" } )
public void testRepositoryStatisticsEndEarlierThanStart() public void testRepositoryStatisticsEndEarlierThanStart()
@ -57,7 +57,7 @@ public class ReportsTest
assertTextPresent( "Start Date must be earlier than the End Date" ); assertTextPresent( "Start Date must be earlier than the End Date" );
} }
/* @Test(dependsOnMethods = { "testAddArtifactValidValues" } ) @Test(dependsOnMethods = { "testAddArtifactValidValues" } )
public void testRepositoryStatistics() public void testRepositoryStatistics()
{ {
String repositoryName = p.getProperty( "REPOSITORY_NAME" ) ; String repositoryName = p.getProperty( "REPOSITORY_NAME" ) ;
@ -65,19 +65,19 @@ public class ReportsTest
String endDate = p.getProperty( "END_DATE" ); String endDate = p.getProperty( "END_DATE" );
compareRepositories( "label=" + repositoryName, startDate, endDate ); compareRepositories( "label=" + repositoryName, startDate, endDate );
//assertTextPresent( "Statistics for Repository '" + repositoryName + "'" ); //assertTextPresent( "Statistics for Repository '" + repositoryName + "'" );
assertPage( "Apache Archiva \\ Reports" ); //assertPage( "Apache Archiva \\ Reports" );
assertTextPresent( "Statistics Report" ); //assertTextPresent( "Statistics Report" );
}*/ }
/* @Test(dependsOnMethods = { "testAddArtifactValidValues" } ) /* @Test( dependsOnMethods = { "testRepositoryStatistics" } )
public void testRepositoriesStatisticComparisonReport() public void testRepositoriesStatisticComparisonReport()
{ {
goToReportsPage(); //goToReportsPage();
clickButtonWithValue( "-->>" , false ); clickButtonWithValue( "-->>" , false );
clickButtonWithValue( "View Statistics" ); clickButtonWithValue( "View Statistics" );
assertTextPresent( "Statistics Report" ); assertTextPresent( "Statistics Report" );
} }
*/
@Test(dependsOnMethods = { "testAddArtifactValidValues" } ) @Test(dependsOnMethods = { "testAddArtifactValidValues" } )
public void testRepositoryHealthWithoutDefect() public void testRepositoryHealthWithoutDefect()
{ {
@ -89,10 +89,10 @@ public class ReportsTest
assertTextPresent( "The operation generated an empty report." ); assertTextPresent( "The operation generated an empty report." );
} }
/* @Test(dependsOnMethods = { "testAddArtifactValidValues" } ) @Test(dependsOnMethods = { "testAddArtifactValidValues" } )
public void testRepositoryHealthWithoutGroupId() public void testRepositoryHealthWithoutGroupId()
{ {
//goToReportsPage(); goToReportsPage();
clickButtonWithValue( "Show Report" ); clickButtonWithValue( "Show Report" );
assertPage( "Apache Archiva \\ Reports" ); assertPage( "Apache Archiva \\ Reports" );
assertTextPresent( "The operation generated an empty report." ); 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; package org.apache.archiva.web.test.parent;
import java.io.File;
public abstract class AbstractArtifactManagementTest public abstract class AbstractArtifactManagementTest
extends AbstractArchivaTest extends AbstractArchivaTest
{ {
@ -30,8 +32,9 @@ public abstract class AbstractArtifactManagementTest
public String getArtifactFilePath() public String getArtifactFilePath()
{ {
String artifactFilePath = p.getProperty( "ARTIFACTFILEPATH" ) ; File f = new File( "" );
return artifactFilePath; 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() public String getRepositoryId()
@ -51,7 +54,7 @@ public abstract class AbstractArtifactManagementTest
clickLinkWithText( "Delete Artifact" ); clickLinkWithText( "Delete Artifact" );
assertDeleteArtifactPage(); assertDeleteArtifactPage();
} }
public void addArtifact( String groupId, String artifactId, String version, String packaging, String artifactFilePath, String repositoryId ) public void addArtifact( String groupId, String artifactId, String version, String packaging, String artifactFilePath, String repositoryId )
{ {
addArtifact(groupId, artifactId, version, packaging, true, artifactFilePath, 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 ) public void deleteArtifact( String groupId, String artifactId, String version, String repositoryId )
{ {
goToAddArtifactPage(); goToDeleteArtifactPage();
setFieldValue( "groupId" , groupId ); setFieldValue( "groupId" , groupId );
setFieldValue( "artifactId" , artifactId ); setFieldValue( "artifactId" , artifactId );
setFieldValue( "version" , version ); setFieldValue( "version" , version );

View File

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