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
This commit is contained in:
Maria Odea B. Ching 2010-03-09 10:23:57 +00:00
parent 4c2bd734ff
commit 3deb0ee356
5 changed files with 52 additions and 25 deletions

View File

@ -19,3 +19,17 @@ can use *iexploreproxy.
Run Selenium tests in src/test/it with Maven and JUnit Run Selenium tests in src/test/it with Maven and JUnit
- mvn clean install -f junit-pom.xml - 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

View File

@ -18,12 +18,20 @@ ARTIFACT_GROUPID=test
ARTIFACT_ARTIFACTID=test ARTIFACT_ARTIFACTID=test
ARTIFACT_VERSION=1.0 ARTIFACT_VERSION=1.0
ARTIFACT_PACKAGING=jar 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 # Reports
REPOSITORY_NAME=internal REPOSITORY_NAME=internal
START_DATE=05/01/2009 START_DATE=05/01/2009
END_DATE=05/30/2009 END_DATE=05/30/2009
# Add Valid Artifact
# User Management # User Management
# For password and new password # For password and new password
@ -107,7 +115,4 @@ NETWORKPROXY_PASSWORD=admin123
SNAPSHOTS_REPOSITORY=snapshots SNAPSHOTS_REPOSITORY=snapshots
RELEASES_REPOSITORY=releases RELEASES_REPOSITORY=releases
# Audit Log Report - MRM-1304
AUDITLOG_GROUPID=group.id
AUDITLOG_EXPECTED_ARTIFACT=group/id/test/1.0/test-1.0.jar

View File

@ -86,8 +86,11 @@ public class ArtifactManagementTest
@Test(groups = "requiresUpload") @Test(groups = "requiresUpload")
public void testAddArtifactValidValues() public void testAddArtifactValidValues()
{ {
addArtifact( getGroupId() , "testAddArtifactValidValues", getVersion(), getPackaging() , getArtifactFilePath(), getRepositoryId() ); String groupId = getProperty( "VALIDARTIFACT_GROUPID" );
assertTextPresent( "Artifact 'test:testAddArtifactValidValues:1.0' was successfully deployed to repository 'internal'" ); 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 //MRM-747

View File

@ -75,13 +75,14 @@ public class AuditLogsReportTest
assertAuditLogsReportPage(); assertAuditLogsReportPage();
selectValue( "repository", "internal" ); selectValue( "repository", "internal" );
setFieldValue( "groupId", "test" ); setFieldValue( "groupId", getProperty( "VALIDARTIFACT_GROUPID" ) );
submit(); submit();
assertAuditLogsReportPage(); assertAuditLogsReportPage();
assertTextPresent( "Results" ); assertTextPresent( "Results" );
assertTextNotPresent( "No audit logs found." ); assertTextNotPresent( "No audit logs found." );
assertTextPresent( "testAddArtifactValidValues-1.0.jar" ); assertTextPresent( getProperty( "VALIDARTIFACT_ARTIFACTID" ) + "-" + getProperty( "ARTIFACT_VERSION" ) +
"." + getProperty( "ARTIFACT_PACKAGING" ) );
assertTextPresent( "Uploaded File" ); assertTextPresent( "Uploaded File" );
assertTextPresent( "internal" ); assertTextPresent( "internal" );
assertTextPresent( "admin" ); assertTextPresent( "admin" );
@ -95,14 +96,15 @@ public class AuditLogsReportTest
assertAuditLogsReportPage(); assertAuditLogsReportPage();
selectValue( "repository", "internal" ); selectValue( "repository", "internal" );
setFieldValue( "artifactId", "test" ); setFieldValue( "artifactId", getProperty( "AUDITLOGARTIFACT_ARTIFACTID" ) );
submit(); submit();
assertAuditLogsReportPage(); assertAuditLogsReportPage();
assertTextPresent( "If you specify an artifact ID, you must specify a group ID" ); assertTextPresent( "If you specify an artifact ID, you must specify a group ID" );
assertTextNotPresent( "Results" ); assertTextNotPresent( "Results" );
assertTextNotPresent( "No audit logs found." ); assertTextNotPresent( "No audit logs found." );
assertTextNotPresent( "testAddArtifactValidValues-1.0.jar" ); assertTextNotPresent( getProperty( "VALIDARTIFACT_ARTIFACTID" ) + "-" + getProperty( "ARTIFACT_VERSION" ) +
"." + getProperty( "ARTIFACT_PACKAGING" ) );
assertTextNotPresent( "Uploaded File" ); assertTextNotPresent( "Uploaded File" );
} }
@ -119,7 +121,8 @@ public class AuditLogsReportTest
assertAuditLogsReportPage(); assertAuditLogsReportPage();
assertTextPresent( "Results" ); assertTextPresent( "Results" );
assertTextNotPresent( "No audit logs found." ); assertTextNotPresent( "No audit logs found." );
assertTextPresent( "testAddArtifactValidValues-1.0.jar" ); assertTextPresent( getProperty( "VALIDARTIFACT_ARTIFACTID" ) + "-" + getProperty( "ARTIFACT_VERSION" ) +
"." + getProperty( "ARTIFACT_PACKAGING" ) );
assertTextPresent( "Uploaded File" ); assertTextPresent( "Uploaded File" );
assertTextPresent( "internal" ); assertTextPresent( "internal" );
assertTextPresent( "admin" ); assertTextPresent( "admin" );
@ -151,7 +154,7 @@ public class AuditLogsReportTest
assertAuditLogsReportPage(); assertAuditLogsReportPage();
assertTextPresent( "Results" ); assertTextPresent( "Results" );
assertTextNotPresent( "No audit logs found." ); assertTextNotPresent( "No audit logs found." );
assertTextPresent( "testAddArtifactValidValues-1.0.jar" ); assertTextPresent( getProperty( "VALIDARTIFACT_ARTIFACTID" ) + "-" + getProperty( "ARTIFACT_VERSION" ) + "." + packaging );
assertTextPresent( "Uploaded File" ); assertTextPresent( "Uploaded File" );
assertTextPresent( "internal" ); assertTextPresent( "internal" );
assertTextPresent( "admin" ); assertTextPresent( "admin" );
@ -161,15 +164,16 @@ public class AuditLogsReportTest
login( getProperty( "ADMIN_USERNAME" ), getProperty( "ADMIN_PASSWORD" ) ); login( getProperty( "ADMIN_USERNAME" ), getProperty( "ADMIN_PASSWORD" ) );
} }
@Test (dependsOnMethods = { "testAddArtifactValidValues" }, groups = "requiresUpload") // MRM-1304
@Test( dependsOnMethods = { "testAddArtifactValidValues" }, groups = "requiresUpload" )
public void testViewAuditLogsReportForGroupId() public void testViewAuditLogsReportForGroupId()
{ {
String groupId = getProperty("AUDITLOG_GROUPID"); String groupId = getProperty( "AUDITLOGARTIFACT_GROUPID" );
String artifactId = getProperty("ARTIFACTID"); String artifactId = getProperty( "AUDITLOGARTIFACT_ARTIFACTID" );
String version = getProperty("VERSION"); String version = getProperty( "VERSION" );
String packaging = getProperty("PACKAGING"); String packaging = getProperty( "PACKAGING" );
String repositoryId = getProperty("REPOSITORYID"); String repositoryId = getProperty( "REPOSITORYID" );
String expectedArtifact = getProperty("AUDITLOG_EXPECTED_ARTIFACT"); String expectedArtifact = getProperty( "AUDITLOG_EXPECTED_ARTIFACT" );
addArtifact( groupId, artifactId, version, packaging, getProperty( "SNAPSHOT_ARTIFACTFILEPATH" ), repositoryId ); addArtifact( groupId, artifactId, version, packaging, getProperty( "SNAPSHOT_ARTIFACTFILEPATH" ), repositoryId );

View File

@ -36,6 +36,7 @@ public class SearchTest
assertTextPresent( "No results found" ); assertTextPresent( "No results found" );
} }
// TODO: make search tests more robust especially when comparing/asserting number of hits
public void testSearchExistingArtifact() public void testSearchExistingArtifact()
{ {
searchForArtifact( getProperty( "ARTIFACT_ARTIFACTID" ) ); searchForArtifact( getProperty( "ARTIFACT_ARTIFACTID" ) );