[Fusionforge-commits] r11543 - in trunk/tests/func: Forums News PluginsBlocks RBAC Site Tasks Testing Trackers

Roland Mas lolando at libremir.placard.fr.eu.org
Mon Nov 15 22:15:39 CET 2010


Author: lolando
Date: 2010-11-15 22:15:38 +0100 (Mon, 15 Nov 2010)
New Revision: 11543

Modified:
   trunk/tests/func/Forums/forumsTest.php
   trunk/tests/func/News/newsTest.php
   trunk/tests/func/PluginsBlocks/blocksTest.php
   trunk/tests/func/RBAC/rbacTest.php
   trunk/tests/func/Site/loginTest.php
   trunk/tests/func/Site/projectsTest.php
   trunk/tests/func/Site/top.php
   trunk/tests/func/Site/troveTest.php
   trunk/tests/func/Tasks/createTaskTest.php
   trunk/tests/func/Testing/SeleniumGforge.php
   trunk/tests/func/Trackers/relationTest.php
   trunk/tests/func/Trackers/trackersTest.php
   trunk/tests/func/Trackers/workflowTest.php
Log:
Refactor and optimize testsuite (by removing unneeded back-and-forth between pages)

Modified: trunk/tests/func/Forums/forumsTest.php
===================================================================
--- trunk/tests/func/Forums/forumsTest.php	2010-11-15 20:21:22 UTC (rev 11542)
+++ trunk/tests/func/Forums/forumsTest.php	2010-11-15 21:15:38 UTC (rev 11543)
@@ -106,7 +106,7 @@
 		$this->init();
 		$this->logout();
 
-		$this->open("/projects/projecta/");
+		$this->gotoProject('ProjectA');
 		$this->click("link=Forums");
 		$this->waitForPageToLoad("30000");
 		$this->click("link=open-discussion");
@@ -158,4 +158,10 @@
 		$this->assertTrue($this->isTextPresent("Error: a mailing list with the same email address already exists"));
 	}
 }
+
+// Local Variables:
+// mode: php
+// c-file-style: "bsd"
+// End:
+
 ?>

Modified: trunk/tests/func/News/newsTest.php
===================================================================
--- trunk/tests/func/News/newsTest.php	2010-11-15 20:21:22 UTC (rev 11542)
+++ trunk/tests/func/News/newsTest.php	2010-11-15 21:15:38 UTC (rev 11543)
@@ -49,7 +49,7 @@
 {
 	function testMyTestCase()
 	{
-		$this->createProject('ProjectA');
+		$this->init();
 
 		// Create a simple news.
 		$this->click("link=News");
@@ -138,7 +138,7 @@
 	 */
 	function testAcBug4100()
 	{
-		$this->createProject('ProjectA');
+		$this->init();
 
 		// Create a simple news.
 		$this->click("link=News");
@@ -173,7 +173,7 @@
 	 */
 	function skiptestPreventMultiplePost()
 	{
-		$this->createProject('ProjectA');
+		$this->init();
 
 		// Create a simple news.
 		$this->click("link=News");
@@ -194,4 +194,10 @@
 	}
 	
 }
+
+// Local Variables:
+// mode: php
+// c-file-style: "bsd"
+// End:
+
 ?>

Modified: trunk/tests/func/PluginsBlocks/blocksTest.php
===================================================================
--- trunk/tests/func/PluginsBlocks/blocksTest.php	2010-11-15 20:21:22 UTC (rev 11542)
+++ trunk/tests/func/PluginsBlocks/blocksTest.php	2010-11-15 21:15:38 UTC (rev 11543)
@@ -95,4 +95,10 @@
   	}
   }
 }
+
+// Local Variables:
+// mode: php
+// c-file-style: "bsd"
+// End:
+
 ?>

Modified: trunk/tests/func/RBAC/rbacTest.php
===================================================================
--- trunk/tests/func/RBAC/rbacTest.php	2010-11-15 20:21:22 UTC (rev 11542)
+++ trunk/tests/func/RBAC/rbacTest.php	2010-11-15 21:15:38 UTC (rev 11543)
@@ -28,10 +28,6 @@
 	{
 		$this->init();
 
-		$this->createUser ('staffmember') ;
-
-		$this->open( ROOT ."/projects/projecta" );
-		$this->waitForPageToLoad("30000");
 		$this->click("link=Admin");
 		$this->waitForPageToLoad("30000");
 		$this->assertTrue($this->isTextPresent("Project Admin: ProjectA"));
@@ -42,11 +38,11 @@
 		$this->waitForPageToLoad("30000");
 		$this->assertTrue($this->isTextPresent("Role unlinked successfully"));
 
+		$this->createUser ('staffmember') ;
 		$this->logout();
 		$this->assertFalse($this->isTextPresent("ProjectA"));
 
-		$this->open( ROOT ."/projects/projecta" );
-		$this->waitForPageToLoad("30000");
+		$this->gotoProject('ProjectA');
 		$this->assertTrue($this->isLoginRequired());
 		$this->triggeredLogin('staffmember');
 		$this->assertTrue($this->isTextPresent("Project Members"));
@@ -56,8 +52,6 @@
 	{
 		$this->login("admin");
 
-		$this->open( ROOT );
-		$this->waitForPageToLoad("30000");
 		$this->click("link=Site Admin");
 		$this->waitForPageToLoad("30000");
 

Modified: trunk/tests/func/Site/loginTest.php
===================================================================
--- trunk/tests/func/Site/loginTest.php	2010-11-15 20:21:22 UTC (rev 11542)
+++ trunk/tests/func/Site/loginTest.php	2010-11-15 21:15:38 UTC (rev 11543)
@@ -94,4 +94,10 @@
 		$this->assertTrue($this->isTextPresent("Log Out"));
 	}
 }
+
+// Local Variables:
+// mode: php
+// c-file-style: "bsd"
+// End:
+
 ?>

Modified: trunk/tests/func/Site/projectsTest.php
===================================================================
--- trunk/tests/func/Site/projectsTest.php	2010-11-15 20:21:22 UTC (rev 11542)
+++ trunk/tests/func/Site/projectsTest.php	2010-11-15 21:15:38 UTC (rev 11543)
@@ -52,6 +52,7 @@
 	// After creation, project is visible on the main page.
 	function testSimpleCreate()
 	{
+		// "Manual" procedure
 		$this->login ('admin');
 		$this->click("link=My Page");
 		$this->waitForPageToLoad("30000");
@@ -79,6 +80,20 @@
 		$this->waitForPageToLoad("30000");
 		$this->assertTrue($this->isTextPresent("This is the public description for ProjectA."));
 		$this->assertTrue($this->isTextPresent("This project has not yet categorized itself"));
+		
+		// Also test our high-level functions (testing the test-suite)
+		$this->createProject ('ProjectB');
+		$this->click("link=Home");
+		$this->waitForPageToLoad("30000");
+		$this->assertTrue($this->isTextPresent("ProjectB"));
+		$this->click("link=ProjectB");
+		$this->waitForPageToLoad("30000");
+		$this->assertTrue($this->isTextPresent("This is the public description for ProjectB."));
+		$this->assertTrue($this->isTextPresent("This project has not yet categorized itself"));
+		$this->gotoProject ('ProjectB');
+		$this->assertTrue($this->isTextPresent("This is the public description for ProjectB."));
+		$this->createAndGoto ('ProjectC');
+		$this->assertTrue($this->isTextPresent("This is the public description for ProjectC."));
 	}
 
 	function testCharsCreateTestCase()
@@ -142,4 +157,10 @@
 		$this->click("submit");
 	}
 }
+
+// Local Variables:
+// mode: php
+// c-file-style: "bsd"
+// End:
+
 ?>

Modified: trunk/tests/func/Site/top.php
===================================================================
--- trunk/tests/func/Site/top.php	2010-11-15 20:21:22 UTC (rev 11542)
+++ trunk/tests/func/Site/top.php	2010-11-15 21:15:38 UTC (rev 11543)
@@ -74,4 +74,10 @@
     	$this->assertTrue($this->isTextPresent("Rank"));
     }
 }
+
+// Local Variables:
+// mode: php
+// c-file-style: "bsd"
+// End:
+
 ?>

Modified: trunk/tests/func/Site/troveTest.php
===================================================================
--- trunk/tests/func/Site/troveTest.php	2010-11-15 20:21:22 UTC (rev 11542)
+++ trunk/tests/func/Site/troveTest.php	2010-11-15 21:15:38 UTC (rev 11543)
@@ -71,4 +71,10 @@
 		$this->assertFalse($this->isTextPresent("Microsoft"));
 	}
 }
+
+// Local Variables:
+// mode: php
+// c-file-style: "bsd"
+// End:
+
 ?>

Modified: trunk/tests/func/Tasks/createTaskTest.php
===================================================================
--- trunk/tests/func/Tasks/createTaskTest.php	2010-11-15 20:21:22 UTC (rev 11542)
+++ trunk/tests/func/Tasks/createTaskTest.php	2010-11-15 21:15:38 UTC (rev 11543)
@@ -81,10 +81,7 @@
         $this->waitForPageToLoad("30000");
 
 //        $this->switchUser('uadmin');
-        $this->open( ROOT );
-        $this->waitForPageToLoad("30000");
-        $this->click("link=ProjectA");
-        $this->waitForPageToLoad("30000");
+        $this->gotoProject('ProjectA');
 
         $this->click("link=Tasks");
         $this->waitForPageToLoad("30000");
@@ -469,4 +466,10 @@
     {
     }
 }
+
+// Local Variables:
+// mode: php
+// c-file-style: "bsd"
+// End:
+
 ?>

Modified: trunk/tests/func/Testing/SeleniumGforge.php
===================================================================
--- trunk/tests/func/Testing/SeleniumGforge.php	2010-11-15 20:21:22 UTC (rev 11542)
+++ trunk/tests/func/Testing/SeleniumGforge.php	2010-11-15 21:15:38 UTC (rev 11543)
@@ -78,11 +78,7 @@
 //	}
 
 	protected function init() {
-		$this->createProject('ProjectA');
-
-		$this->open( ROOT );
-		$this->click("link=ProjectA");
-		$this->waitForPageToLoad("30000");
+		$this->createAndGoto('ProjectA');
 	}
 
 	protected function login($username)
@@ -161,25 +157,13 @@
 		$saved_user = $this->logged_in ;
 		$this->switchUser ($user) ;
 
-		if ($user == 'admin') {
-			$this->click("link=Site Admin");
-			$this->waitForPageToLoad("30000");
-			$this->click("link=Pending projects (new project approval)");
-			$this->waitForPageToLoad("30000");
-		} else {
-			$this->open( ROOT . '/admin/approve-pending.php') ;
-			$this->waitForPageToLoad("30000");
-		}
+		$this->open( ROOT . '/admin/approve-pending.php') ;
+		$this->waitForPageToLoad("30000");
 		$this->click("document.forms['approve.$unix_name'].submit");
 		$this->waitForPageToLoad("60000");
-		$this->click("link=Home");
-		$this->waitForPageToLoad("30000");
-		$this->assertTrue($this->isTextPresent($name));
-		$this->click("link=$name");
-		$this->waitForPageToLoad("30000");
-		$this->assertTrue($this->isTextPresent("This is the public description for $name."));
-		$this->assertTrue($this->isTextPresent("This project has not yet categorized itself"));
 
+		$this->assertTrue($this->isTextPresent("Approving Project: $unix_name"));
+
 		$this->switchUser ($saved_user) ;
 	}
 
@@ -193,13 +177,13 @@
 			$this->registerProject ($name, 'admin') ;
 			$this->approveProject ($name, 'admin') ;
 		}
-		$this->click("link=Home");
-		$this->waitForPageToLoad("30000");
-		$this->assertTrue($this->isTextPresent($name));
-		$this->click("link=$name");
-		$this->waitForPageToLoad("30000");
 	}
 	
+	protected function createAndGoto($project) {
+		$this->createProject($project);
+		$this->gotoProject($project);
+	}
+
 	protected function createUser ($login)
 	{
 		$this->open( ROOT );
@@ -241,4 +225,9 @@
 	}
 }
 
+// Local Variables:
+// mode: php
+// c-file-style: "bsd"
+// End:
+
 ?>

Modified: trunk/tests/func/Trackers/relationTest.php
===================================================================
--- trunk/tests/func/Trackers/relationTest.php	2010-11-15 20:21:22 UTC (rev 11542)
+++ trunk/tests/func/Trackers/relationTest.php	2010-11-15 21:15:38 UTC (rev 11543)
@@ -49,12 +49,9 @@
 {
 	function testCreateRelation()
 	{
-		$this->createProject('ProjectA');
+		$this->init();
 					
 		// Testing extra-fields
-		$this->open( ROOT );
-		$this->click("link=ProjectA");
-		$this->waitForPageToLoad("30000");
 		$this->click("link=Tracker");
 		$this->waitForPageToLoad("30000");
 		$this->click("link=Bugs");
@@ -71,4 +68,10 @@
 		$this->assertTrue($this->isTextPresent("Depends on"));
 	}
 }
+
+// Local Variables:
+// mode: php
+// c-file-style: "bsd"
+// End:
+
 ?>

Modified: trunk/tests/func/Trackers/trackersTest.php
===================================================================
--- trunk/tests/func/Trackers/trackersTest.php	2010-11-15 20:21:22 UTC (rev 11542)
+++ trunk/tests/func/Trackers/trackersTest.php	2010-11-15 21:15:38 UTC (rev 11543)
@@ -49,12 +49,9 @@
 {
 	function testSimpleCreate()
 	{
-		$this->createProject('ProjectA');
+		$this->init();
 
 		// Test: Create a simple bug report (Message1/Text1).
-		$this->open( ROOT );
-		$this->click("link=ProjectA");
-		$this->waitForPageToLoad("30000");
 		$this->click("link=Tracker");
 		$this->waitForPageToLoad("30000");
 		$this->assertTrue($this->isTextPresent("Bugs"));
@@ -123,12 +120,9 @@
 
 	function testExtraFields()
 	{
-		$this->createProject('ProjectA');
+		$this->init();
 
 		// Testing extra-fields
-		$this->open( ROOT );
-		$this->click("link=ProjectA");
-		$this->waitForPageToLoad("30000");
 		$this->click("link=Tracker");
 		$this->waitForPageToLoad("30000");
 		$this->click("link=Bugs");
@@ -177,12 +171,9 @@
 
 	function testCreateAndDeleteNewTracker()
 	{
-		$this->createProject('ProjectA');
+		$this->init();
 
 		// Create a new tracker and delete it after.
-		$this->open( ROOT );
-		$this->click("link=ProjectA");
-		$this->waitForPageToLoad("30000");
 		$this->click("link=Tracker");
 		$this->waitForPageToLoad("30000");
 		$this->click("//a[@href='".URL."tracker/admin/?group_id=6']");
@@ -207,4 +198,10 @@
 		$this->assertFalse($this->isTextPresent("This is a new tracker"));
 	}
 }
+
+// Local Variables:
+// mode: php
+// c-file-style: "bsd"
+// End:
+
 ?>

Modified: trunk/tests/func/Trackers/workflowTest.php
===================================================================
--- trunk/tests/func/Trackers/workflowTest.php	2010-11-15 20:21:22 UTC (rev 11542)
+++ trunk/tests/func/Trackers/workflowTest.php	2010-11-15 21:15:38 UTC (rev 11543)
@@ -49,12 +49,9 @@
 {
 	function testWorkflow()
 	{
-		$this->createProject('ProjectA');
+		$this->init();
 			
 		// Testing extra-fields
-		$this->open( ROOT );
-		$this->click("link=ProjectA");
-		$this->waitForPageToLoad("30000");
 		$this->click("link=Tracker");
 		$this->waitForPageToLoad("30000");
 		$this->click("link=Bugs");
@@ -232,4 +229,10 @@
 		$this->assertTrue($this->isTextPresent("Workflow saved"));
 	}
 }
+
+// Local Variables:
+// mode: php
+// c-file-style: "bsd"
+// End:
+
 ?>




More information about the Fusionforge-commits mailing list