continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r1542940 - in /continuum/branches/CONTINUUM-2713/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test: QueueTest.java ScheduleTest.java parent/AbstractAdminTest.java
Date Mon, 18 Nov 2013 07:42:02 GMT
Author: brett
Date: Mon Nov 18 07:42:01 2013
New Revision: 1542940

URL: http://svn.apache.org/r1542940
Log:
[CONTINUUM-2713] ensure test can be re-run

Modified:
    continuum/branches/CONTINUUM-2713/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/QueueTest.java
    continuum/branches/CONTINUUM-2713/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ScheduleTest.java
    continuum/branches/CONTINUUM-2713/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractAdminTest.java

Modified: continuum/branches/CONTINUUM-2713/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/QueueTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/CONTINUUM-2713/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/QueueTest.java?rev=1542940&r1=1542939&r2=1542940&view=diff
==============================================================================
--- continuum/branches/CONTINUUM-2713/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/QueueTest.java
(original)
+++ continuum/branches/CONTINUUM-2713/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/QueueTest.java
Mon Nov 18 07:42:01 2013
@@ -20,6 +20,7 @@ package org.apache.continuum.web.test;
  */
 
 import org.apache.continuum.web.test.parent.AbstractAdminTest;
+import org.testng.annotations.AfterClass;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
@@ -41,6 +42,13 @@ public class QueueTest
         buildQueueName = getProperty( "BUILD_QUEUE_NAME" );
     }
 
+    @AfterClass
+    protected void tearDown()
+    {
+        goToBuildQueuePage();
+        removeBuildQueue( buildQueueName );
+    }
+
     public void testAddBuildQueue()
     {
         setMaxBuildQueue( 2 );
@@ -79,12 +87,16 @@ public class QueueTest
         goToAddSchedule();
         addEditSchedule( scheduleName, scheduleDescription, second, minute, hour, dayOfMonth,
month, dayOfWeek, year,
                          maxTime, period, true, true );
-        goToEditSchedule( scheduleName, scheduleDescription, second, minute, hour, dayOfMonth,
month, dayOfWeek, year,
-                          maxTime, period );
+        try {
+            goToEditSchedule( scheduleName, scheduleDescription, second, minute, hour, dayOfMonth,
month, dayOfWeek, year,
+                              maxTime, period );
 
-        getSelenium().addSelection( "saveSchedule_availableBuildQueuesIds", "label=" + buildQueueName
);
-        getSelenium().click( "//input[@value='->']" );
-        submit();
+            getSelenium().addSelection( "saveSchedule_availableBuildQueuesIds", "label="
+ buildQueueName );
+            getSelenium().click( "//input[@value='->']" );
+            submit();
+        } finally {
+            removeSchedule( scheduleName );
+        }
     }
 
     @Test( dependsOnMethods = { "testAddBuildQueue" } )
@@ -134,9 +146,13 @@ public class QueueTest
         String projectGroupId = getProperty( "MAVEN2_QUEUE_TEST_POM_PROJECT_GROUP_ID" );
         String projectGroupDescription = getProperty( "MAVEN2_QUEUE_TEST_POM_PROJECT_GROUP_DESCRIPTION"
);
 
-        //build a project
-        goToAddMavenTwoProjectPage();
-        addMavenTwoProject( pomUrl, pomUsername, pomPassword, null, true );
+        goToProjectGroupsSummaryPage();
+        if ( !isLinkPresent( projectGroupName ) )
+        {
+            //build a project
+            goToAddMavenTwoProjectPage();
+            addMavenTwoProject( pomUrl, pomUsername, pomPassword, null, true );
+        }
 
         buildProjectForQueuePageTest( projectGroupName, projectGroupId, projectGroupDescription
);
         String location = getSelenium().getLocation();

Modified: continuum/branches/CONTINUUM-2713/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ScheduleTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/CONTINUUM-2713/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ScheduleTest.java?rev=1542940&r1=1542939&r2=1542940&view=diff
==============================================================================
--- continuum/branches/CONTINUUM-2713/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ScheduleTest.java
(original)
+++ continuum/branches/CONTINUUM-2713/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ScheduleTest.java
Mon Nov 18 07:42:01 2013
@@ -163,17 +163,4 @@ public class ScheduleTest
         String SCHEDULE_NAME = getProperty( "SCHEDULE_NAME" );
         removeSchedule( SCHEDULE_NAME );
     }
-
-    protected void removeSchedule( String name )
-    {
-        goToSchedulePage();
-        clickLinkWithXPath( "(//a[contains(@href,'removeSchedule.action') and contains(@href,
'" + name + "')])//img" );
-        assertPage( "Continuum - Delete Schedule" );
-        assertTextPresent( "Delete Schedule" );
-        assertTextPresent( "Are you sure you want to delete the schedule \"" + name + "\"?"
);
-        assertButtonWithValuePresent( "Delete" );
-        assertButtonWithValuePresent( "Cancel" );
-        clickButtonWithValue( "Delete" );
-        assertSchedulePage();
-    }
 }

Modified: continuum/branches/CONTINUUM-2713/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractAdminTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/CONTINUUM-2713/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractAdminTest.java?rev=1542940&r1=1542939&r2=1542940&view=diff
==============================================================================
--- continuum/branches/CONTINUUM-2713/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractAdminTest.java
(original)
+++ continuum/branches/CONTINUUM-2713/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractAdminTest.java
Mon Nov 18 07:42:01 2013
@@ -349,4 +349,17 @@ public abstract class AbstractAdminTest
         assertBuildAgentPage();
         assertTextPresent( newDesc );
     }
+
+    protected void removeSchedule( String name )
+    {
+        goToSchedulePage();
+        clickLinkWithXPath( "(//a[contains(@href,'removeSchedule.action') and contains(@href,
'" + name + "')])//img" );
+        assertPage( "Continuum - Delete Schedule" );
+        assertTextPresent( "Delete Schedule" );
+        assertTextPresent( "Are you sure you want to delete the schedule \"" + name + "\"?"
);
+        assertButtonWithValuePresent( "Delete" );
+        assertButtonWithValuePresent( "Cancel" );
+        clickButtonWithValue( "Delete" );
+        assertSchedulePage();
+    }
 }



Mime
View raw message