upgrade TestNG and resolve some issues with test ordering

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1178013 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Porter 2011-10-01 15:19:31 +00:00
parent e2ee507bff
commit 027e721634
8 changed files with 31 additions and 14 deletions

View File

@ -36,7 +36,7 @@
<cargo.wait>false</cargo.wait> <cargo.wait>false</cargo.wait>
<cargo.timeout>600000</cargo.timeout> <cargo.timeout>600000</cargo.timeout>
<cargo.install.dir>${project.build.directory}/cargo/installs</cargo.install.dir> <cargo.install.dir>${project.build.directory}/cargo/installs</cargo.install.dir>
<maxWaitTimeInMs>30000</maxWaitTimeInMs> <maxWaitTimeInMs>10000</maxWaitTimeInMs>
<!-- TODO: review how appropriate the memory settings are - should work with less --> <!-- TODO: review how appropriate the memory settings are - should work with less -->
<cargo.jvm.args>-Xmx512m -XX:MaxPermSize=256m</cargo.jvm.args> <cargo.jvm.args>-Xmx512m -XX:MaxPermSize=256m</cargo.jvm.args>
<seleniumPluginVersion>2.0</seleniumPluginVersion> <seleniumPluginVersion>2.0</seleniumPluginVersion>
@ -49,9 +49,8 @@
<dependency> <dependency>
<groupId>org.testng</groupId> <groupId>org.testng</groupId>
<artifactId>testng</artifactId> <artifactId>testng</artifactId>
<version>5.9</version> <version>6.2.1</version>
<scope>test</scope> <scope>test</scope>
<classifier>jdk15</classifier>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-io</groupId> <groupId>commons-io</groupId>

View File

@ -27,7 +27,6 @@ import org.testng.annotations.Optional;
import org.testng.annotations.Parameters; import org.testng.annotations.Parameters;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@Test( groups = { "about" }, alwaysRun = true )
public class ArchivaAdminTest public class ArchivaAdminTest
extends AbstractArchivaTest extends AbstractArchivaTest
{ {
@ -57,7 +56,6 @@ public class ArchivaAdminTest
super.open( baseUrl, browser, seleniumHost, seleniumPort, Integer.toString( maxWaitTimeInMs ) ); super.open( baseUrl, browser, seleniumHost, seleniumPort, Integer.toString( maxWaitTimeInMs ) );
getSelenium().open( baseUrl ); getSelenium().open( baseUrl );
String title = getSelenium().getTitle();
// if not admin user created create one // if not admin user created create one
if ( isElementPresent( "adminCreateForm" ) ) if ( isElementPresent( "adminCreateForm" ) )
{ {
@ -78,4 +76,10 @@ public class ArchivaAdminTest
// take care about repositories : internal // take care about repositories : internal
} }
@Test( groups = { "about" }, alwaysRun = true )
public void testHome()
{
getSelenium().open( baseUrl );
assertPage( "Apache Archiva \\ Quick Search" );
}
} }

View File

@ -98,14 +98,14 @@ public class ArtifactManagementTest
+ "' was successfully deployed to repository 'internal'" ); + "' was successfully deployed to repository 'internal'" );
} }
@Test( groups = "requiresUpload" ) @Test( groups = "requiresUpload", enabled = false )
public void testDotNetTypes() public void testDotNetTypes()
{ {
String groupId = getProperty( "GROUPID_DOTNETARTIFACT" ); String groupId = getProperty( "GROUPID_DOTNETARTIFACT" );
String artifactId = getProperty( "ARTIFACTID_DOTNETARTIFACT" ); String artifactId = getProperty( "ARTIFACTID_DOTNETARTIFACT" );
String packaging = getProperty( "PACKAGING_DOTNETARTIFACT" ); String packaging = getProperty( "PACKAGING_DOTNETARTIFACT" );
addArtifact( groupId, artifactId, getVersion(), packaging, getArtifactFilePath(), getRepositoryId(), false ); addArtifact( groupId, artifactId, getVersion(), packaging, getArtifactFilePath(), getRepositoryId(), true );
assertTextPresent( "Artifact '" + groupId + ":" + artifactId + ":" + getVersion() assertTextPresent( "Artifact '" + groupId + ":" + artifactId + ":" + getVersion()
+ "' was successfully deployed to repository 'internal'" ); + "' was successfully deployed to repository 'internal'" );
getSelenium().open( baseUrl + "/browse/" + groupId + "/" + artifactId + "/" + getVersion() ); getSelenium().open( baseUrl + "/browse/" + groupId + "/" + artifactId + "/" + getVersion() );
@ -115,6 +115,7 @@ public class ArtifactManagementTest
String basePath = String basePath =
"/archiva/repository/internal/" + groupId + "/" + artifactId + "/" + getVersion() + "/" + artifactId + "-" "/archiva/repository/internal/" + groupId + "/" + artifactId + "/" + getVersion() + "/" + artifactId + "-"
+ getVersion(); + getVersion();
// FIXME: currently broken - is dotnet-library
assertLinkPresent( ".NET Library" ); assertLinkPresent( ".NET Library" );
assertElementPresent( "//a[@href='" + basePath + ".dll']" ); assertElementPresent( "//a[@href='" + basePath + ".dll']" );
assertElementPresent( "//a[@href='" + basePath + ".pom']" ); assertElementPresent( "//a[@href='" + basePath + ".pom']" );
@ -125,7 +126,7 @@ public class ArtifactManagementTest
public void testAddArtifactBlockRedeployments() public void testAddArtifactBlockRedeployments()
{ {
addArtifact( getGroupId(), getArtifactId(), getVersion(), getPackaging(), getArtifactFilePath(), addArtifact( getGroupId(), getArtifactId(), getVersion(), getPackaging(), getArtifactFilePath(),
getRepositoryId(), false ); getRepositoryId(), true );
assertTextPresent( "Overwriting released artifacts in repository '" + getRepositoryId() + "' is not allowed." ); assertTextPresent( "Overwriting released artifacts in repository '" + getRepositoryId() + "' is not allowed." );
} }
@ -139,10 +140,10 @@ public class ArtifactManagementTest
String packaging = getProperty( "PACKAGING1" ); String packaging = getProperty( "PACKAGING1" );
String repositoryId = getProperty( "REPOSITORYID1" ); String repositoryId = getProperty( "REPOSITORYID1" );
// TODO: do this differently as it only works in Firefox's chrome mode // TODO: do this differently as it only works in Firefox's chrome mode
addArtifact( groupId, artifactId, version, packaging, getArtifactFilePath(), repositoryId, false ); addArtifact( groupId, artifactId, version, packaging, getArtifactFilePath(), repositoryId, true );
assertTextPresent( "Artifact 'delete:delete:1.0' was successfully deployed to repository 'internal'" ); assertTextPresent( "Artifact 'delete:delete:1.0' was successfully deployed to repository 'internal'" );
deleteArtifact( "delete", "delete", "1.0", "internal" ); deleteArtifact( "delete", "delete", "1.0", "internal", true );
assertTextPresent( "Artifact 'delete:delete:1.0' was successfully deleted from repository 'internal'" ); assertTextPresent( "Artifact 'delete:delete:1.0' was successfully deleted from repository 'internal'" );
} }

View File

@ -169,7 +169,7 @@ public class BrowseTest
addMetadataProperty(); addMetadataProperty();
} }
@Test( dependsOnMethods = { "testAddMetadataProperty" } ) @Test( dependsOnMethods = { "testAddMetadataProperty", "testWithCorrectUsernamePassword" } )
public void testDeleteMetadataProperty() public void testDeleteMetadataProperty()
{ {
deleteMetadataProperty(); deleteMetadataProperty();

View File

@ -89,6 +89,7 @@ public class MergingRepositoriesTest
} }
// change the configuaration first and try to upload existing artifact to the repository // change the configuaration first and try to upload existing artifact to the repository
@Test(dependsOnMethods = {"testAddArtifactToStagingRepository"})
public void testConfigurationChangesOfStagingRepository() public void testConfigurationChangesOfStagingRepository()
{ {
editManagedRepository(); editManagedRepository();

View File

@ -34,9 +34,10 @@ public class RepositoryScanningTest
assertTextPresent( "Unable to process blank pattern." ); assertTextPresent( "Unable to process blank pattern." );
} }
@Test( dependsOnMethods = { "testAddArtifactFileType_NullValue" } ) @Test
public void testAddArtifactFileType() public void testAddArtifactFileType()
{ {
goToRepositoryScanningPage();
setFieldValue( "newpattern_0", "**/*.dll" ); setFieldValue( "newpattern_0", "**/*.dll" );
clickAddIcon( "newpattern_0" ); clickAddIcon( "newpattern_0" );
Assert.assertEquals( getSelenium().getTable( "//div[@id='contentArea']/div/div[1]/table.13.0" ), "**/*.dll" ); Assert.assertEquals( getSelenium().getTable( "//div[@id='contentArea']/div/div[1]/table.13.0" ), "**/*.dll" );
@ -55,6 +56,7 @@ public class RepositoryScanningTest
@Test( dependsOnMethods = { "testAddArtifactFileType" } ) @Test( dependsOnMethods = { "testAddArtifactFileType" } )
public void testDeleteArtifactFileType() public void testDeleteArtifactFileType()
{ {
goToRepositoryScanningPage();
String path = "//div[@id='contentArea']/div/div/table/tbody/tr[14]/td/code"; String path = "//div[@id='contentArea']/div/div/table/tbody/tr[14]/td/code";
assertElementPresent( path ); assertElementPresent( path );
Assert.assertEquals( getSelenium().getText( path ), "**/*.dll" ); Assert.assertEquals( getSelenium().getText( path ), "**/*.dll" );
@ -65,6 +67,7 @@ public class RepositoryScanningTest
@Test( dependsOnMethods = { "testDeleteArtifactFileType" } ) @Test( dependsOnMethods = { "testDeleteArtifactFileType" } )
public void testAddAutoRemove_NullValue() public void testAddAutoRemove_NullValue()
{ {
goToRepositoryScanningPage();
setFieldValue( "newpattern_1", "" ); setFieldValue( "newpattern_1", "" );
clickAddIcon( "newpattern_1" ); clickAddIcon( "newpattern_1" );
assertTextPresent( "Unable to process blank pattern." ); assertTextPresent( "Unable to process blank pattern." );
@ -83,6 +86,7 @@ public class RepositoryScanningTest
@Test( dependsOnMethods = { "testAddAutoRemove_NullValue" } ) @Test( dependsOnMethods = { "testAddAutoRemove_NullValue" } )
public void testAddAutoRemove() public void testAddAutoRemove()
{ {
goToRepositoryScanningPage();
setFieldValue( "newpattern_1", "**/*.test" ); setFieldValue( "newpattern_1", "**/*.test" );
clickAddIcon( "newpattern_1" ); clickAddIcon( "newpattern_1" );
Assert.assertEquals( getSelenium().getTable( "//div[@id='contentArea']/div/div[2]/table.3.0" ), "**/*.test" ); Assert.assertEquals( getSelenium().getTable( "//div[@id='contentArea']/div/div[2]/table.3.0" ), "**/*.test" );
@ -91,6 +95,7 @@ public class RepositoryScanningTest
@Test( dependsOnMethods = { "testAddAutoRemove" } ) @Test( dependsOnMethods = { "testAddAutoRemove" } )
public void testDeleteAutoRemove() public void testDeleteAutoRemove()
{ {
goToRepositoryScanningPage();
String path = "//div[@id='contentArea']/div/div[2]/table/tbody/tr[4]/td/code"; String path = "//div[@id='contentArea']/div/div[2]/table/tbody/tr[4]/td/code";
assertElementPresent( path ); assertElementPresent( path );
Assert.assertEquals( getSelenium().getText( path ), "**/*.test" ); Assert.assertEquals( getSelenium().getText( path ), "**/*.test" );
@ -101,6 +106,7 @@ public class RepositoryScanningTest
@Test( dependsOnMethods = { "testDeleteAutoRemove" } ) @Test( dependsOnMethods = { "testDeleteAutoRemove" } )
public void testAddIgnoredArtifacts_NullValue() public void testAddIgnoredArtifacts_NullValue()
{ {
goToRepositoryScanningPage();
setFieldValue( "newpattern_2", "" ); setFieldValue( "newpattern_2", "" );
clickAddIcon( "newpattern_2" ); clickAddIcon( "newpattern_2" );
Assert.assertEquals( getErrorMessageText(), Assert.assertEquals( getErrorMessageText(),
@ -129,6 +135,7 @@ public class RepositoryScanningTest
@Test( dependsOnMethods = { "testAddIgnoredArtifacts" } ) @Test( dependsOnMethods = { "testAddIgnoredArtifacts" } )
public void testDeleteIgnoredArtifacts() public void testDeleteIgnoredArtifacts()
{ {
goToRepositoryScanningPage();
String pattern = "**/*.log"; String pattern = "**/*.log";
String path = "//div[@id='contentArea']/div/div[3]/table/tbody/tr[7]/td/code"; String path = "//div[@id='contentArea']/div/div[3]/table/tbody/tr[7]/td/code";
assertElementPresent( path ); assertElementPresent( path );
@ -141,6 +148,7 @@ public class RepositoryScanningTest
@Test( dependsOnMethods = { "testDeleteIgnoredArtifacts" } ) @Test( dependsOnMethods = { "testDeleteIgnoredArtifacts" } )
public void testAddIndexableContent_NullValue() public void testAddIndexableContent_NullValue()
{ {
goToRepositoryScanningPage();
setFieldValue( "newpattern_3", "" ); setFieldValue( "newpattern_3", "" );
clickAddIcon( "newpattern_3" ); clickAddIcon( "newpattern_3" );
Assert.assertEquals( getErrorMessageText(), Assert.assertEquals( getErrorMessageText(),
@ -169,6 +177,7 @@ public class RepositoryScanningTest
@Test( dependsOnMethods = { "testAddIndexableContent" } ) @Test( dependsOnMethods = { "testAddIndexableContent" } )
public void testDeleteIndexableContent() public void testDeleteIndexableContent()
{ {
goToRepositoryScanningPage();
String pattern = "**/*.html"; String pattern = "**/*.html";
String path = "//div[@id='contentArea']/div/div[4]/table/tbody/tr[10]/td/code"; String path = "//div[@id='contentArea']/div/div[4]/table/tbody/tr[10]/td/code";
assertElementPresent( path ); assertElementPresent( path );
@ -180,6 +189,7 @@ public class RepositoryScanningTest
@Test( dependsOnMethods = { "testDeleteIndexableContent" } ) @Test( dependsOnMethods = { "testDeleteIndexableContent" } )
public void testUpdateConsumers() public void testUpdateConsumers()
{ {
goToRepositoryScanningPage();
checkField( "enabledKnownContentConsumers" ); checkField( "enabledKnownContentConsumers" );
checkField( "//input[@name='enabledKnownContentConsumers' and @value='auto-rename']" ); checkField( "//input[@name='enabledKnownContentConsumers' and @value='auto-rename']" );
clickButtonWithValue( "Update Consumers" ); clickButtonWithValue( "Update Consumers" );
@ -189,6 +199,7 @@ public class RepositoryScanningTest
@Test( dependsOnMethods = { "testUpdateConsumers" } ) @Test( dependsOnMethods = { "testUpdateConsumers" } )
public void testUpdateConsumers_UnsetAll() public void testUpdateConsumers_UnsetAll()
{ {
goToRepositoryScanningPage();
getSelenium().uncheck( "enabledKnownContentConsumers" ); getSelenium().uncheck( "enabledKnownContentConsumers" );
getSelenium().uncheck( "//input[@name='enabledKnownContentConsumers' and @value='auto-rename']" ); getSelenium().uncheck( "//input[@name='enabledKnownContentConsumers' and @value='auto-rename']" );
getSelenium().uncheck( "//input[@name='enabledKnownContentConsumers' and @value='create-missing-checksums']" ); getSelenium().uncheck( "//input[@name='enabledKnownContentConsumers' and @value='create-missing-checksums']" );

View File

@ -291,9 +291,10 @@ public class RepositoryTest
assertTextPresent( "You must enter a repository name." ); assertTextPresent( "You must enter a repository name." );
} }
@Test( dependsOnMethods = { "testAddRemoteRepoNullName" } ) @Test
public void testAddRemoteRepoNullURL() public void testAddRemoteRepoNullURL()
{ {
getSelenium().open( "/archiva/admin/addRemoteRepository.action" );
addRemoteRepository( "remoterepo", "Remote Repository Sample", "", "", "", "", "Maven 2.x Repository", false ); addRemoteRepository( "remoterepo", "Remote Repository Sample", "", "", "", "", "Maven 2.x Repository", false );
assertTextPresent( "You must enter a url." ); assertTextPresent( "You must enter a url." );
} }

View File

@ -63,7 +63,7 @@ public class VirtualRepositoryTest
@Test( dependsOnMethods = { "testDeleteRepositoryOfRepositoryGroup" } ) @Test( dependsOnMethods = { "testDeleteRepositoryOfRepositoryGroup" } )
public void testDeleteRepositoryGroup() public void testDeleteRepositoryGroup()
{ {
assertRepositoryGroupsPage(); goToRepositoryGroupsPage();
deleteRepositoryGroup( "testing" ); deleteRepositoryGroup( "testing" );
assertTextPresent( "No Repository Groups Defined." ); assertTextPresent( "No Repository Groups Defined." );
} }