diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArchivaAdminTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArchivaAdminTest.java index 779cdee87..63a724bfe 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArchivaAdminTest.java +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArchivaAdminTest.java @@ -27,7 +27,7 @@ import org.testng.annotations.Optional; import org.testng.annotations.Parameters; import org.testng.annotations.Test; -@Test( groups = {"about"}, alwaysRun = true ) +@Test( groups = { "about" }, alwaysRun = true ) public class ArchivaAdminTest extends AbstractArchivaTest { @@ -49,17 +49,17 @@ public class ArchivaAdminTest } @BeforeTest - @Parameters( {"baseUrl", "browser", "maxWaitTimeInMs", "seleniumHost", "seleniumPort"} ) + @Parameters( { "baseUrl", "browser", "maxWaitTimeInMs", "seleniumHost", "seleniumPort" } ) public void initializeArchiva( String baseUrl, String browser, int maxWaitTimeInMs, @Optional( "localhost" ) String seleniumHost, @Optional( "4444" ) int seleniumPort ) throws Exception { - super.open( baseUrl , browser, seleniumHost, seleniumPort, Integer.toString( maxWaitTimeInMs ) ); + super.open( baseUrl, browser, seleniumHost, seleniumPort, Integer.toString( maxWaitTimeInMs ) ); getSelenium().open( baseUrl ); String title = getSelenium().getTitle(); // if not admin user created create one - if (isElementPresent( "adminCreateForm" )) + if ( isElementPresent( "adminCreateForm" ) ) { assertCreateAdmin(); String fullname = getProperty( "ADMIN_FULLNAME" ); @@ -70,6 +70,10 @@ public class ArchivaAdminTest assertUserLoggedIn( username ); clickLinkWithLocator( "logoutLink" ); } + else + { + login( getAdminUsername(), getAdminPassword() ); + } // take care about repositories : internal } diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArtifactManagementTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArtifactManagementTest.java index 4fd52916e..7de9fcd09 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArtifactManagementTest.java +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArtifactManagementTest.java @@ -22,11 +22,12 @@ package org.apache.archiva.web.test; import org.apache.archiva.web.test.parent.AbstractArtifactManagementTest; import org.testng.annotations.Test; -@Test( groups = { "artifactmanagement" }, dependsOnMethods = { "testWithCorrectUsernamePassword" } ) +@Test( groups = { "artifactmanagement" }, dependsOnGroups = { "about" } ) public class ArtifactManagementTest extends AbstractArtifactManagementTest { + @Test( alwaysRun = true ) public void testAddArtifactNullValues() { goToAddArtifactPage(); @@ -39,14 +40,14 @@ public class ArtifactManagementTest assertTextPresent( "You must enter a packaging" ); } - @Test( dependsOnMethods = { "testAddArtifactNullValues" } ) + @Test( dependsOnMethods = { "testAddArtifactNullValues" }, alwaysRun = true ) public void testAddArtifactNoGroupId() { addArtifact( " ", getArtifactId(), getVersion(), getPackaging(), getArtifactFilePath(), getRepositoryId() ); assertTextPresent( "You must enter a groupId." ); } - @Test( dependsOnMethods = { "testAddArtifactNoGroupId" } ) + @Test( dependsOnMethods = { "testAddArtifactNoGroupId" }, alwaysRun = true ) public void testAddArtifactNoArtifactId() { @@ -54,28 +55,28 @@ public class ArtifactManagementTest assertTextPresent( "You must enter an artifactId." ); } - @Test( dependsOnMethods = { "testAddArtifactNoGroupId" } ) + @Test( dependsOnMethods = { "testAddArtifactNoGroupId" }, alwaysRun = true ) public void testAddArtifactNoVersion() { addArtifact( getGroupId(), getArtifactId(), " ", getPackaging(), getArtifactFilePath(), getRepositoryId() ); assertTextPresent( "You must enter a version." ); } - @Test( dependsOnMethods = { "testAddArtifactNoGroupId" } ) + @Test( dependsOnMethods = { "testAddArtifactNoGroupId" }, alwaysRun = true ) public void testAddArtifactInvalidVersion() { addArtifact( getGroupId(), getArtifactId(), "asdf", getPackaging(), getArtifactFilePath(), getRepositoryId() ); assertTextPresent( "Invalid version." ); } - @Test( dependsOnMethods = { "testAddArtifactNoGroupId" } ) + @Test( dependsOnMethods = { "testAddArtifactNoGroupId" }, alwaysRun = true ) public void testAddArtifactNoPackaging() { addArtifact( getGroupId(), getArtifactId(), getVersion(), " ", getArtifactFilePath(), getRepositoryId() ); assertTextPresent( "You must enter a packaging." ); } - @Test( dependsOnMethods = { "testAddArtifactNoGroupId" } ) + @Test( dependsOnMethods = { "testAddArtifactNoGroupId" }, alwaysRun = true ) public void testAddArtifactNoFilePath() { addArtifact( getGroupId(), getArtifactId(), getVersion(), getPackaging(), " ", getRepositoryId() ); @@ -90,7 +91,7 @@ public class ArtifactManagementTest addArtifact( groupId, artifactId, getVersion(), getPackaging(), getArtifactFilePath(), getRepositoryId() ); assertTextPresent( "Artifact '" + groupId + ":" + artifactId + ":" + getVersion() - + "' was successfully deployed to repository 'internal'" ); + + "' was successfully deployed to repository 'internal'" ); } @Test( groups = "requiresUpload" ) @@ -102,7 +103,7 @@ public class ArtifactManagementTest addArtifact( groupId, artifactId, getVersion(), packaging, getArtifactFilePath(), getRepositoryId() ); assertTextPresent( "Artifact '" + groupId + ":" + artifactId + ":" + getVersion() - + "' was successfully deployed to repository 'internal'" ); + + "' was successfully deployed to repository 'internal'" ); getSelenium().open( baseUrl + "/browse/" + groupId + "/" + artifactId + "/" + getVersion() ); waitPage(); @@ -141,18 +142,21 @@ public class ArtifactManagementTest assertTextPresent( "Artifact 'delete:delete:1.0' was successfully deleted from repository 'internal'" ); } + @Test( alwaysRun = true ) public void testDeleteArtifactNoGroupId() { deleteArtifact( " ", "delete", "1.0", "internal" ); assertTextPresent( "You must enter a groupId." ); } + @Test( alwaysRun = true ) public void testDeleteArtifactNoArtifactId() { deleteArtifact( "delete", " ", "1.0", "internal" ); assertTextPresent( "You must enter an artifactId." ); } + @Test( alwaysRun = true) public void testDeleteArtifactNoVersion() { deleteArtifact( "delete", "delete", " ", "internal" ); @@ -160,6 +164,7 @@ public class ArtifactManagementTest assertTextPresent( "You must enter a version." ); } + @Test( alwaysRun = true) public void testDeleteArtifactInvalidVersion() { deleteArtifact( "delete", "delete", "asdf", "internal" ); @@ -167,23 +172,30 @@ public class ArtifactManagementTest } // HTML select should have the proper value, else it will cause a selenium error: Option with label 'customValue' not found + @Test( alwaysRun = true) public void testDeleteArtifactInvalidValues() - { - deleteArtifact( "<> \\/~+[ ]'\"", "<> \\/~+[ ]'\"", "<>", "internal"); - assertTextPresent( "Invalid version." ); - assertTextPresent( "Group id must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)." ); - assertTextPresent( "Artifact id must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)." ); - } + { + deleteArtifact( "<> \\/~+[ ]'\"", "<> \\/~+[ ]'\"", "<>", "internal" ); + assertTextPresent( "Invalid version." ); + assertTextPresent( + "Group id must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)." ); + assertTextPresent( + "Artifact id must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)." ); + } + @Test( alwaysRun = true) public void testDeleteArtifactInvalidGroupId() - { - deleteArtifact( "<> \\/~+[ ]'\"", "delete", "1.0", "internal"); - assertTextPresent( "Group id must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)." ); - } + { + deleteArtifact( "<> \\/~+[ ]'\"", "delete", "1.0", "internal" ); + assertTextPresent( + "Group id must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)." ); + } + @Test( alwaysRun = true) public void testDeleteArtifactInvalidArtifactId() - { - deleteArtifact( "delete", "<> \\/~+[ ]'\"", "1.0", "internal"); - assertTextPresent( "Artifact id must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)." ); - } + { + deleteArtifact( "delete", "<> \\/~+[ ]'\"", "1.0", "internal" ); + assertTextPresent( + "Artifact id must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)." ); + } } \ No newline at end of file diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/FindArtifactTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/FindArtifactTest.java index 56f83d7dc..afa9940af 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/FindArtifactTest.java +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/FindArtifactTest.java @@ -26,6 +26,7 @@ import org.testng.annotations.Test; public class FindArtifactTest extends AbstractArchivaTest { + @Test(alwaysRun = true) public void testFindArtifactNullValues() { goToFindArtifactPage(); @@ -33,6 +34,7 @@ public class FindArtifactTest assertTextPresent( "You must select a file, or enter the checksum. If the file was given and you receive this message, there may have been an error generating the checksum." ); } + @Test(alwaysRun = true) public void testFindArtifactUsingChecksum() { goToFindArtifactPage();