]> source.dussan.org Git - archiva.git/commitdiff
o update artifact groupId/artifactId to not use "test" term for uploaded artifacts...
authorMaria Odea B. Ching <oching@apache.org>
Tue, 9 Mar 2010 10:23:57 +0000 (10:23 +0000)
committerMaria Odea B. Ching <oching@apache.org>
Tue, 9 Mar 2010 10:23:57 +0000 (10:23 +0000)
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

archiva-modules/archiva-web/archiva-webapp-test/ReadMe.txt
archiva-modules/archiva-web/archiva-webapp-test/src/test/resources/testng.properties
archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArtifactManagementTest.java
archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/AuditLogsReportTest.java
archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/SearchTest.java

index ff27feb7ac07e7e103d5d9218b342e3fd6a55084..158228d695f3fb588b5fcf72ce2eb510a11765ff 100644 (file)
@@ -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
+   
+
index beb2ab7d05590dfd9cf4ef5389036fdacc47ee2d..aba24b4dadd6b18da1e9271831b0f246b4f87658 100644 (file)
@@ -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
 
index 4eb22b172d9e1cdf81d270af9359a4c2ede66772..729b01688e0d0b359171ef023129fe97bae50e22 100644 (file)
@@ -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
index 99ab2f03828983e6179e5410e6e4b6061d531347..a08c5e2764e15587733d1d274ecb49066b515c2d 100644 (file)
@@ -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 );
index d107009858a3bf3a75332aa0dc06a95f89320f08..91753e2dc30506e95f93d4533706d0895ce6c8bc 100644 (file)
@@ -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" ) );