continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r921240 - in /continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test: BuildAgentsTest.java MavenTwoProjectTest.java ReleaseTest.java UserRolesManagementTest.java parent/AbstractContinuumTest.java
Date Wed, 10 Mar 2010 07:53:53 GMT
Author: ctan
Date: Wed Mar 10 07:53:52 2010
New Revision: 921240

URL: http://svn.apache.org/viewvc?rev=921240&view=rev
Log:
fixed selenium tests
- prevent other tests to fail when a distributed build test failed
- select the default schedule when creating a build definition so that the delete schedule
test won't fail 
- prevent intermittent failure by adding another refresh() in between update and build

Modified:
    continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/BuildAgentsTest.java
    continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/MavenTwoProjectTest.java
    continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ReleaseTest.java
    continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/UserRolesManagementTest.java
    continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java

Modified: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/BuildAgentsTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/BuildAgentsTest.java?rev=921240&r1=921239&r2=921240&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/BuildAgentsTest.java
(original)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/BuildAgentsTest.java
Wed Mar 10 07:53:52 2010
@@ -27,7 +27,6 @@ import org.apache.continuum.web.test.par
 public class BuildAgentsTest
     extends AbstractBuildAgentsTest
 {
-    @Test( dependsOnMethods = { "testProjectGroupAllBuildSuccess" } )
     public void testAddBuildAgent()
     {
         String BUILD_AGENT_NAME = getProperty( "BUILD_AGENT_NAME" );
@@ -37,14 +36,20 @@ public class BuildAgentsTest
         String BUILD_AGENT_NAME3 = getProperty( "BUILD_AGENT_NAME3" );
         String BUILD_AGENT_DESCRIPTION3 = getProperty( "BUILD_AGENT_DESCRIPTION3" );
 
-        enableDistributedBuilds();
-        goToAddBuildAgent();
-        addBuildAgent( BUILD_AGENT_NAME, BUILD_AGENT_DESCRIPTION, true, false );
-        goToAddBuildAgent();
-        addBuildAgent( BUILD_AGENT_NAME2, BUILD_AGENT_DESCRIPTION2, true, true );
-        goToAddBuildAgent();
-        addBuildAgent( BUILD_AGENT_NAME3, BUILD_AGENT_DESCRIPTION3, true, false );
-        disableDistributedBuilds();
+        try
+        {
+            enableDistributedBuilds();
+            goToAddBuildAgent();
+            addBuildAgent( BUILD_AGENT_NAME, BUILD_AGENT_DESCRIPTION, true, false );
+            goToAddBuildAgent();
+            addBuildAgent( BUILD_AGENT_NAME2, BUILD_AGENT_DESCRIPTION2, true, true );
+            goToAddBuildAgent();
+            addBuildAgent( BUILD_AGENT_NAME3, BUILD_AGENT_DESCRIPTION3, true, false );
+        }
+        finally
+        {
+            disableDistributedBuilds();
+        }
     }
 
     @Test( dependsOnMethods = { "testEditBuildAgent" } )
@@ -53,11 +58,17 @@ public class BuildAgentsTest
         String BUILD_AGENT_NAME = getProperty( "BUILD_AGENT_NAME" );
         String BUILD_AGENT_DESCRIPTION = getProperty( "BUILD_AGENT_DESCRIPTION" );
 
-        enableDistributedBuilds();
-        goToAddBuildAgent();
-        addBuildAgent( BUILD_AGENT_NAME, BUILD_AGENT_DESCRIPTION, false, false ) ;
-        assertTextPresent( "Build agent already exists" );
-        disableDistributedBuilds();
+        try
+        {
+            enableDistributedBuilds();
+            goToAddBuildAgent();
+            addBuildAgent( BUILD_AGENT_NAME, BUILD_AGENT_DESCRIPTION, false, false ) ;
+            assertTextPresent( "Build agent already exists" );
+        }
+        finally
+        {
+            disableDistributedBuilds();
+        }
     }
 
     @Test( dependsOnMethods = { "testAddBuildAgent" } )
@@ -67,23 +78,35 @@ public class BuildAgentsTest
         String BUILD_AGENT_DESCRIPTION = getProperty( "BUILD_AGENT_DESCRIPTION" );
         String new_agentDescription = "new_agentDescription";
 
-        enableDistributedBuilds();
-        goToEditBuildAgent( BUILD_AGENT_NAME, BUILD_AGENT_DESCRIPTION );
-        addEditBuildAgent( BUILD_AGENT_NAME, new_agentDescription );
-        goToEditBuildAgent( BUILD_AGENT_NAME, new_agentDescription);
-        addEditBuildAgent( BUILD_AGENT_NAME, BUILD_AGENT_DESCRIPTION );
-        disableDistributedBuilds();
+        try
+        {
+            enableDistributedBuilds();
+            goToEditBuildAgent( BUILD_AGENT_NAME, BUILD_AGENT_DESCRIPTION );
+            addEditBuildAgent( BUILD_AGENT_NAME, new_agentDescription );
+            goToEditBuildAgent( BUILD_AGENT_NAME, new_agentDescription);
+            addEditBuildAgent( BUILD_AGENT_NAME, BUILD_AGENT_DESCRIPTION );
+        }
+        finally
+        {
+            disableDistributedBuilds();
+        }
     }
 
     @Test( dependsOnMethods = { "testAddAnExistingBuildAgent" } )
     public void testDeleteBuildAgent()
     {
-        enableDistributedBuilds();
-        goToBuildAgentPage();
-        String BUILD_AGENT_NAME3 = getProperty( "BUILD_AGENT_NAME3" );
-        removeBuildAgent( BUILD_AGENT_NAME3 );
-        assertTextNotPresent( BUILD_AGENT_NAME3 );
-        disableDistributedBuilds();
+        try
+        {
+            enableDistributedBuilds();
+            goToBuildAgentPage();
+            String BUILD_AGENT_NAME3 = getProperty( "BUILD_AGENT_NAME3" );
+            removeBuildAgent( BUILD_AGENT_NAME3 );
+            assertTextNotPresent( BUILD_AGENT_NAME3 );
+        }
+        finally
+        {
+            disableDistributedBuilds();
+        }
     }
 
 	@Test( dependsOnMethods = { "testDeleteBuildAgent" } )
@@ -91,11 +114,17 @@ public class BuildAgentsTest
     {
     	String BUILD_AGENT_DESCRIPTION = getProperty( "BUILD_AGENT_DESCRIPTION" );
 
-    	enableDistributedBuilds();
-    	goToAddBuildAgent();
-		addBuildAgent( "", BUILD_AGENT_DESCRIPTION, false, false ) ;
-		assertTextPresent( "Build agent url is required." );
-		disableDistributedBuilds();
+    	try
+    	{
+    	    enableDistributedBuilds();
+    	    goToAddBuildAgent();
+    	    addBuildAgent( "", BUILD_AGENT_DESCRIPTION, false, false ) ;
+    	    assertTextPresent( "Build agent url is required." );
+    	}
+    	finally
+    	{
+    	    disableDistributedBuilds();
+    	}
     }
 
 //TESTS FOR BUILD AGENT GROUPS
@@ -108,10 +137,16 @@ public class BuildAgentsTest
         String BUILD_AGENT_NAME2 = getProperty( "BUILD_AGENT_NAME2" );
         String BUILD_AGENT_GROUPNAME = getProperty( "BUILD_AGENT_GROUPNAME" );
 
-        enableDistributedBuilds();
-        goToAddBuildAgentGroup();
-        addEditBuildAgentGroup( BUILD_AGENT_GROUPNAME, new String[] { BUILD_AGENT_NAME, BUILD_AGENT_NAME2
}, new String[] {}, true );
-        disableDistributedBuilds();
+        try
+        {
+            enableDistributedBuilds();
+            goToAddBuildAgentGroup();
+            addEditBuildAgentGroup( BUILD_AGENT_GROUPNAME, new String[] { BUILD_AGENT_NAME,
BUILD_AGENT_NAME2 }, new String[] {}, true );
+        }
+        finally
+        {
+            disableDistributedBuilds();
+        }
     }
 
     @Test( dependsOnMethods = { "testAddBuildAgentGroup" } )
@@ -123,14 +158,20 @@ public class BuildAgentsTest
         String BUILD_AGENT_GROUPNAME = getProperty( "BUILD_AGENT_GROUPNAME" );
 
         String newName = "new_agentgroupname";
-        enableDistributedBuilds();
-        goToEditBuildAgentGroup( BUILD_AGENT_GROUPNAME, new String[] { BUILD_AGENT_NAME,
BUILD_AGENT_NAME2 } );
-        addEditBuildAgentGroup( newName, new String[] {},
-                         new String[] { BUILD_AGENT_NAME2 }, true );
-        goToEditBuildAgentGroup( newName, new String[] { BUILD_AGENT_NAME } );
-        addEditBuildAgentGroup( BUILD_AGENT_GROUPNAME, new String[] { BUILD_AGENT_NAME2 },
-                         new String[] {}, true );
-        disableDistributedBuilds();
+        try
+        {
+            enableDistributedBuilds();
+            goToEditBuildAgentGroup( BUILD_AGENT_GROUPNAME, new String[] { BUILD_AGENT_NAME,
BUILD_AGENT_NAME2 } );
+            addEditBuildAgentGroup( newName, new String[] {},
+                             new String[] { BUILD_AGENT_NAME2 }, true );
+            goToEditBuildAgentGroup( newName, new String[] { BUILD_AGENT_NAME } );
+            addEditBuildAgentGroup( BUILD_AGENT_GROUPNAME, new String[] { BUILD_AGENT_NAME2
},
+                             new String[] {}, true );
+        }
+        finally
+        {
+            disableDistributedBuilds();
+        }
     }
 
     @Test( dependsOnMethods = { "testEditBuildAgentGroup" } )
@@ -141,30 +182,49 @@ public class BuildAgentsTest
         String BUILD_AGENT_NAME2 = getProperty( "BUILD_AGENT_NAME2" );
         String BUILD_AGENT_GROUPNAME = getProperty( "BUILD_AGENT_GROUPNAME" );
 
-        enableDistributedBuilds();
-        goToAddBuildAgentGroup();
-       	addEditBuildAgentGroup( BUILD_AGENT_GROUPNAME, new String[] { BUILD_AGENT_NAME, BUILD_AGENT_NAME2
}, new String[] {}, false );
-       	assertTextPresent( "Build agent group already exists." );
-       	disableDistributedBuilds();
+        try
+        {
+            enableDistributedBuilds();
+            goToAddBuildAgentGroup();
+           	addEditBuildAgentGroup( BUILD_AGENT_GROUPNAME, new String[] { BUILD_AGENT_NAME,
BUILD_AGENT_NAME2 }, new String[] {}, false );
+           	assertTextPresent( "Build agent group already exists." );
+        }
+        finally
+        {
+            disableDistributedBuilds();
+        }
     }
 
     @Test( dependsOnMethods = { "testAddAnExistingBuildAgentGroup" } )
     public void testAddEmptyBuildAgentGroupName()
         throws Exception
     {
-        enableDistributedBuilds();
-        goToAddBuildAgentGroup();
-        addEditBuildAgentGroup( "", new String[] {}, new String[] {}, false );
-        assertTextPresent( "Build agent group name required." );
-        disableDistributedBuilds();
+        try
+        {
+            enableDistributedBuilds();
+            goToAddBuildAgentGroup();
+            addEditBuildAgentGroup( "", new String[] {}, new String[] {}, false );
+            assertTextPresent( "Build agent group name required." );
+        }
+        finally
+        {
+            disableDistributedBuilds();
+        }
     }
 
     @Test( dependsOnMethods = { "testAddEmptyBuildAgentGroupName" } )
     public void testDeleteBuildAgentGroup()
     {
         String BUILD_AGENT_GROUPNAME = getProperty( "BUILD_AGENT_GROUPNAME" );
-        enableDistributedBuilds();
-        removeBuildAgentGroup( BUILD_AGENT_GROUPNAME );
-        disableDistributedBuilds();
+
+        try
+        {
+            enableDistributedBuilds();
+            removeBuildAgentGroup( BUILD_AGENT_GROUPNAME );
+        }
+        finally
+        {
+            disableDistributedBuilds();
+        }
     }
 }

Modified: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/MavenTwoProjectTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/MavenTwoProjectTest.java?rev=921240&r1=921239&r2=921240&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/MavenTwoProjectTest.java
(original)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/MavenTwoProjectTest.java
Wed Mar 10 07:53:52 2010
@@ -283,16 +283,22 @@ public class MavenTwoProjectTest
         String M2_PROJ_GRP_ID = getProperty( "M2_DELETE_PROJ_GRP_ID" );
         String BUILD_AGENT_URL = getProperty( "BUILD_AGENT_NAME2" );
 
-        enableDistributedBuilds();
+        try
+        {
+            enableDistributedBuilds();
+            addMaven2Project( M2_PROJ_GRP_NAME );
+            clickLinkWithText( M2_PROJ_GRP_NAME );
 
-        addMaven2Project( M2_PROJ_GRP_NAME );
-        clickLinkWithText( M2_PROJ_GRP_NAME );
+            assertPage( "Continuum - Project Group" );
+            //wait for project to finish checkout
+            waitForProjectCheckout();
 
-        assertPage( "Continuum - Project Group" );
-        //wait for project to finish checkout
-        waitForProjectCheckout();
-        buildProjectGroup( M2_PROJ_GRP_NAME, M2_PROJ_GRP_ID, "", M2_PROJ_GRP_NAME );
-        disableDistributedBuilds();
+            buildProjectGroup( M2_PROJ_GRP_NAME, M2_PROJ_GRP_ID, "", M2_PROJ_GRP_NAME );
  
+        }
+        finally
+        {
+            disableDistributedBuilds();   
+        }
     }
 
     public void testBuildMaven2ProjectWithTag()
@@ -327,17 +333,22 @@ public class MavenTwoProjectTest
         String M2_PROJ_GRP_ID = getProperty( "M2_PROJ_WITH_TAG_PROJ_GRP_ID" );
         String M2_PROJ_GRP_DESCRIPTION = "";
     
-        enableDistributedBuilds();
-    
-        addMavenTwoProject( M2_POM_URL, M2_POM_USERNAME, M2_POM_PASSWORD, null, true );
-        assertProjectGroupSummaryPage( M2_PROJ_GRP_NAME, M2_PROJ_GRP_ID, M2_PROJ_GRP_DESCRIPTION
);
-    
-        buildProjectGroup( M2_PROJ_GRP_NAME, M2_PROJ_GRP_ID, M2_PROJ_GRP_DESCRIPTION, M2_PROJ_GRP_NAME
);
-    
-        removeProjectGroup( M2_PROJ_GRP_NAME );
-        assertLinkNotPresent( M2_PROJ_GRP_NAME );
-    
-        disableDistributedBuilds();
+        try
+        {
+            enableDistributedBuilds();
+        
+            addMavenTwoProject( M2_POM_URL, M2_POM_USERNAME, M2_POM_PASSWORD, null, true
);
+            assertProjectGroupSummaryPage( M2_PROJ_GRP_NAME, M2_PROJ_GRP_ID, M2_PROJ_GRP_DESCRIPTION
);
+        
+            buildProjectGroup( M2_PROJ_GRP_NAME, M2_PROJ_GRP_ID, M2_PROJ_GRP_DESCRIPTION,
M2_PROJ_GRP_NAME );
+        
+            removeProjectGroup( M2_PROJ_GRP_NAME );
+            assertLinkNotPresent( M2_PROJ_GRP_NAME );
+        }
+        finally
+        {
+            disableDistributedBuilds();
+        }
     }
 
     private void addMaven2Project( String groupName )

Modified: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ReleaseTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ReleaseTest.java?rev=921240&r1=921239&r2=921240&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ReleaseTest.java
(original)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ReleaseTest.java
Wed Mar 10 07:53:52 2010
@@ -42,14 +42,21 @@ public class ReleaseTest
         String M2_PROJ_DEVELOPMENT_VERSION = getProperty( "M2_DELETE_PROJ_DEVELOPMENT_VERSION"
);
 
         init();
-        enableDistributedBuilds();
-        showProjectGroup( M2_PROJ_GRP_NAME, M2_PROJ_GRP_ID, "" );
-        clickButtonWithValue( "Release" );
-        assertReleaseSuccess();
-        releasePrepareProject( M2_PROJ_USERNAME, M2_PROJ_PASSWORD, M2_PROJ_TAGBASE, M2_PROJ_TAG,
-                               M2_PROJ_RELEASE_VERSION, M2_PROJ_DEVELOPMENT_VERSION, false
);
-        assertPreparedReleasesFileCreated();
-        disableDistributedBuilds();
+
+        try
+        {
+            enableDistributedBuilds();
+            showProjectGroup( M2_PROJ_GRP_NAME, M2_PROJ_GRP_ID, "" );
+            clickButtonWithValue( "Release" );
+            assertReleaseSuccess();
+            releasePrepareProject( M2_PROJ_USERNAME, M2_PROJ_PASSWORD, M2_PROJ_TAGBASE, M2_PROJ_TAG,
+                                   M2_PROJ_RELEASE_VERSION, M2_PROJ_DEVELOPMENT_VERSION,
false );
+            assertPreparedReleasesFileCreated();
+        }
+        finally
+        {
+            disableDistributedBuilds();
+        }
     }
 
     @Test( dependsOnMethods = { "testReleasePrepareProjectWithInvalidUsernamePasswordInDistributedBuilds"
} )
@@ -66,14 +73,21 @@ public class ReleaseTest
         String M2_PROJ_SCM_URL = getProperty( "M2_DELETE_PROJ_GRP_SCM_ROOT_URL" );
 
         init();
-        enableDistributedBuilds();
-        showProjectGroup( M2_PROJ_GRP_NAME, M2_PROJ_GRP_ID, "" );
-        clickButtonWithValue( "Release" );
-        assertReleaseSuccess();
-        releasePerformProjectWithProvideParameters( M2_PROJ_USERNAME, M2_PROJ_PASSWORD, M2_PROJ_TAGBASE,
M2_PROJ_TAG, 
-                                                    M2_PROJ_SCM_URL, false );
-        assertPreparedReleasesFileCreated();
-        disableDistributedBuilds();
+        
+        try
+        {
+            enableDistributedBuilds();
+            showProjectGroup( M2_PROJ_GRP_NAME, M2_PROJ_GRP_ID, "" );
+            clickButtonWithValue( "Release" );
+            assertReleaseSuccess();
+            releasePerformProjectWithProvideParameters( M2_PROJ_USERNAME, M2_PROJ_PASSWORD,
M2_PROJ_TAGBASE, M2_PROJ_TAG, 
+                                                        M2_PROJ_SCM_URL, false );
+            assertPreparedReleasesFileCreated();
+        }
+        finally
+        {
+            disableDistributedBuilds();
+        }
     }
 
     private void init()

Modified: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/UserRolesManagementTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/UserRolesManagementTest.java?rev=921240&r1=921239&r2=921240&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/UserRolesManagementTest.java
(original)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/UserRolesManagementTest.java
Wed Mar 10 07:53:52 2010
@@ -270,6 +270,7 @@ public class UserRolesManagementTest
         clickButtonWithValue( "Add" );
         waitAddProject( "Continuum - Project Group" );
         assertTextPresent( "ContinuumBuildQueueTestData" );
+        waitForProjectCheckout();
     }
     
     @Test( dependsOnMethods = { "testContinuumGroupProjectAdmin_AddProjectToProjectGroup"
} )

Modified: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java?rev=921240&r1=921239&r2=921240&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java
(original)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java
Wed Mar 10 07:53:52 2010
@@ -381,6 +381,7 @@ public abstract class AbstractContinuumT
         int refreshInterval = 1000;
         Thread.sleep( 10000 );
         getSelenium().refresh();
+        waitPage();
         
         // check if project group is updating from SCM
         while ( isElementPresent( "//td/img[@alt='Updating']" ) )
@@ -395,6 +396,9 @@ public abstract class AbstractContinuumT
             }
         }
 
+        Thread.sleep( refreshInterval );
+        getSelenium().refresh();
+        waitPage();
         currentIt = 1;
 
         // check if project is building, or updating
@@ -544,7 +548,10 @@ public abstract class AbstractContinuumT
             uncheckField( "alwaysBuild" );
         }
 
+        selectValue( "scheduleId", "DEFAULT_SCHEDULE" );
+
         submit();
+
         if ( groupName != null )
         {
             assertGroupBuildDefinitionPage( groupName );



Mime
View raw message