From: Maria Odea B. Ching Date: Tue, 9 Mar 2010 10:23:57 +0000 (+0000) Subject: o update artifact groupId/artifactId to not use "test" term for uploaded artifacts... X-Git-Tag: archiva-1.4-M1~996 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3deb0ee3565646df8833d96f7ab129e4aaca3c3f;p=archiva.git o update artifact groupId/artifactId to not use "test" term for uploaded artifacts not used for search test o added note in readme file to avoid using the term "test" in artifact namespace when writining new add/upload artifact test git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@920773 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-modules/archiva-web/archiva-webapp-test/ReadMe.txt b/archiva-modules/archiva-web/archiva-webapp-test/ReadMe.txt index ff27feb7a..158228d69 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/ReadMe.txt +++ b/archiva-modules/archiva-web/archiva-webapp-test/ReadMe.txt @@ -19,3 +19,17 @@ can use *iexploreproxy. Run Selenium tests in src/test/it with Maven and JUnit - mvn clean install -f junit-pom.xml + + +IMPORTANT: + +When writing Selenium tests for artifact upload, please avoid using the "test" syllable/word for +the groupId or artifactId (ex. test.group:testAddArtifactValidValues:1.0) as this is used for the +search tests. The tests explicitly assert the returned number of hits for searching an artifact with +a groupId or artifactId containing the word "test", so if you upload or add a new artifact which has +the term "test", the number of hits will be different and the search tests will fail. + +See org.apache.archiva.web.test.SearchTest.java or read the related thread discussion at +http://old.nabble.com/Selenium-tests-failure-in-trunk-td27830786.html + + diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/resources/testng.properties b/archiva-modules/archiva-web/archiva-webapp-test/src/test/resources/testng.properties index beb2ab7d0..aba24b4da 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/resources/testng.properties +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/resources/testng.properties @@ -18,12 +18,20 @@ ARTIFACT_GROUPID=test ARTIFACT_ARTIFACTID=test ARTIFACT_VERSION=1.0 ARTIFACT_PACKAGING=jar + +# Artifact for testing add artifact with valid values +VALIDARTIFACT_GROUPID=addArtifactValidValues +VALIDARTIFACT_ARTIFACTID=addArtifactValidValues-artifact + +# Artifact for upload action in audit log report - MRM-1304 +AUDITLOGARTIFACT_GROUPID=group.auditLogUpload +AUDITLOGARTIFACT_ARTIFACTID=auditLogUpload-artifact +AUDITLOG_EXPECTED_ARTIFACT=group/auditLogUpload/auditLogUpload-artifact/1.0/auditLogUpload-artifact-1.0.jar + # Reports REPOSITORY_NAME=internal START_DATE=05/01/2009 END_DATE=05/30/2009 -# Add Valid Artifact - # User Management # For password and new password @@ -107,7 +115,4 @@ NETWORKPROXY_PASSWORD=admin123 SNAPSHOTS_REPOSITORY=snapshots RELEASES_REPOSITORY=releases -# Audit Log Report - MRM-1304 -AUDITLOG_GROUPID=group.id -AUDITLOG_EXPECTED_ARTIFACT=group/id/test/1.0/test-1.0.jar 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 4eb22b172..729b01688 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 @@ -86,8 +86,11 @@ public class ArtifactManagementTest @Test(groups = "requiresUpload") public void testAddArtifactValidValues() { - addArtifact( getGroupId() , "testAddArtifactValidValues", getVersion(), getPackaging() , getArtifactFilePath(), getRepositoryId() ); - assertTextPresent( "Artifact 'test:testAddArtifactValidValues:1.0' was successfully deployed to repository 'internal'" ); + String groupId = getProperty( "VALIDARTIFACT_GROUPID" ); + String artifactId = getProperty( "VALIDARTIFACT_ARTIFACTID" ); + + addArtifact( groupId , artifactId, getVersion(), getPackaging() , getArtifactFilePath(), getRepositoryId() ); + assertTextPresent( "Artifact '" + groupId + ":" + artifactId + ":" + getVersion() + "' was successfully deployed to repository 'internal'" ); } //MRM-747 diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/AuditLogsReportTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/AuditLogsReportTest.java index 99ab2f038..a08c5e276 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/AuditLogsReportTest.java +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/AuditLogsReportTest.java @@ -75,13 +75,14 @@ public class AuditLogsReportTest assertAuditLogsReportPage(); selectValue( "repository", "internal" ); - setFieldValue( "groupId", "test" ); + setFieldValue( "groupId", getProperty( "VALIDARTIFACT_GROUPID" ) ); submit(); assertAuditLogsReportPage(); assertTextPresent( "Results" ); assertTextNotPresent( "No audit logs found." ); - assertTextPresent( "testAddArtifactValidValues-1.0.jar" ); + assertTextPresent( getProperty( "VALIDARTIFACT_ARTIFACTID" ) + "-" + getProperty( "ARTIFACT_VERSION" ) + + "." + getProperty( "ARTIFACT_PACKAGING" ) ); assertTextPresent( "Uploaded File" ); assertTextPresent( "internal" ); assertTextPresent( "admin" ); @@ -95,14 +96,15 @@ public class AuditLogsReportTest assertAuditLogsReportPage(); selectValue( "repository", "internal" ); - setFieldValue( "artifactId", "test" ); + setFieldValue( "artifactId", getProperty( "AUDITLOGARTIFACT_ARTIFACTID" ) ); submit(); assertAuditLogsReportPage(); assertTextPresent( "If you specify an artifact ID, you must specify a group ID" ); assertTextNotPresent( "Results" ); assertTextNotPresent( "No audit logs found." ); - assertTextNotPresent( "testAddArtifactValidValues-1.0.jar" ); + assertTextNotPresent( getProperty( "VALIDARTIFACT_ARTIFACTID" ) + "-" + getProperty( "ARTIFACT_VERSION" ) + + "." + getProperty( "ARTIFACT_PACKAGING" ) ); assertTextNotPresent( "Uploaded File" ); } @@ -119,7 +121,8 @@ public class AuditLogsReportTest assertAuditLogsReportPage(); assertTextPresent( "Results" ); assertTextNotPresent( "No audit logs found." ); - assertTextPresent( "testAddArtifactValidValues-1.0.jar" ); + assertTextPresent( getProperty( "VALIDARTIFACT_ARTIFACTID" ) + "-" + getProperty( "ARTIFACT_VERSION" ) + + "." + getProperty( "ARTIFACT_PACKAGING" ) ); assertTextPresent( "Uploaded File" ); assertTextPresent( "internal" ); assertTextPresent( "admin" ); @@ -151,7 +154,7 @@ public class AuditLogsReportTest assertAuditLogsReportPage(); assertTextPresent( "Results" ); assertTextNotPresent( "No audit logs found." ); - assertTextPresent( "testAddArtifactValidValues-1.0.jar" ); + assertTextPresent( getProperty( "VALIDARTIFACT_ARTIFACTID" ) + "-" + getProperty( "ARTIFACT_VERSION" ) + "." + packaging ); assertTextPresent( "Uploaded File" ); assertTextPresent( "internal" ); assertTextPresent( "admin" ); @@ -161,24 +164,25 @@ public class AuditLogsReportTest login( getProperty( "ADMIN_USERNAME" ), getProperty( "ADMIN_PASSWORD" ) ); } - @Test (dependsOnMethods = { "testAddArtifactValidValues" }, groups = "requiresUpload") + // MRM-1304 + @Test( dependsOnMethods = { "testAddArtifactValidValues" }, groups = "requiresUpload" ) public void testViewAuditLogsReportForGroupId() { - String groupId = getProperty("AUDITLOG_GROUPID"); - String artifactId = getProperty("ARTIFACTID"); - String version = getProperty("VERSION"); - String packaging = getProperty("PACKAGING"); - String repositoryId = getProperty("REPOSITORYID"); - String expectedArtifact = getProperty("AUDITLOG_EXPECTED_ARTIFACT"); - - addArtifact( groupId, artifactId, version, packaging, getProperty( "SNAPSHOT_ARTIFACTFILEPATH" ), repositoryId ); - + String groupId = getProperty( "AUDITLOGARTIFACT_GROUPID" ); + String artifactId = getProperty( "AUDITLOGARTIFACT_ARTIFACTID" ); + String version = getProperty( "VERSION" ); + String packaging = getProperty( "PACKAGING" ); + String repositoryId = getProperty( "REPOSITORYID" ); + String expectedArtifact = getProperty( "AUDITLOG_EXPECTED_ARTIFACT" ); + + addArtifact( groupId, artifactId, version, packaging, getProperty( "SNAPSHOT_ARTIFACTFILEPATH" ), repositoryId ); + goToAuditLogReports(); - + selectValue( "repository", repositoryId ); setFieldValue( "groupId", groupId ); submit(); - + assertAuditLogsReportPage(); assertTextPresent( expectedArtifact ); assertTextPresent( repositoryId ); diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/SearchTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/SearchTest.java index d10700985..91753e2dc 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/SearchTest.java +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/SearchTest.java @@ -36,6 +36,7 @@ public class SearchTest assertTextPresent( "No results found" ); } + // TODO: make search tests more robust especially when comparing/asserting number of hits public void testSearchExistingArtifact() { searchForArtifact( getProperty( "ARTIFACT_ARTIFACTID" ) );