[Fusionforge-commits] r7553 - in trunk/tests: . func func/Forums func/News func/Site func/Tasks func/Testing scripts

Alain Peyrat aljeux at libremir.placard.fr.eu.org
Fri May 1 19:51:28 CEST 2009


Author: aljeux
Date: 2009-05-01 19:51:27 +0200 (Fri, 01 May 2009)
New Revision: 7553

Added:
   trunk/tests/TarCentos52Tests.php
   trunk/tests/func/Testing/SeleniumRemoteSuite.php
   trunk/tests/func/config.php.tests
   trunk/tests/scripts/
   trunk/tests/scripts/start_vm.sh
   trunk/tests/scripts/start_vz.sh
   trunk/tests/scripts/stop_vm.sh
   trunk/tests/scripts/stop_vz.sh
Modified:
   trunk/tests/func/Forums/AllTests.php
   trunk/tests/func/Forums/forums.php
   trunk/tests/func/News/AllTests.php
   trunk/tests/func/News/news.php
   trunk/tests/func/Site/AllTests.php
   trunk/tests/func/Site/login.php
   trunk/tests/func/Site/projects.php
   trunk/tests/func/Site/top.php
   trunk/tests/func/Tasks/AllTests.php
   trunk/tests/func/Tasks/csv.php
   trunk/tests/func/Testing/SeleniumGforge.php
   trunk/tests/func/db_reload.php
Log:
Initial code to add remote install & selenium tests

Added: trunk/tests/TarCentos52Tests.php
===================================================================
--- trunk/tests/TarCentos52Tests.php	                        (rev 0)
+++ trunk/tests/TarCentos52Tests.php	2009-05-01 17:51:27 UTC (rev 7553)
@@ -0,0 +1,59 @@
+<?php
+if (!defined('PHPUnit_MAIN_METHOD')) {
+	define('PHPUnit_MAIN_METHOD', 'AllTests::main');
+}
+
+require_once 'PHPUnit/Framework.php';
+require_once 'PHPUnit/TextUI/TestRunner.php';
+require_once 'func/Testing/SeleniumRemoteSuite.php';
+
+// Selenium based tests
+require_once 'func/Site/AllTests.php';
+//require_once 'Trackers/AllTests.php';
+require_once 'func/Tasks/AllTests.php';
+require_once 'func/Forums/AllTests.php';
+//require_once 'PluginsWiki/AllTests.php';
+//require_once 'PluginsWebSvn/AllTests.php';
+require_once 'func/News/AllTests.php';
+//require_once 'scm/AllTests.php';
+//require_once 'docs/AllTests.php';
+
+class AllTests
+{
+	public static function main()
+	{
+		PHPUnit_TextUI_TestRunner::run(self::suite1());
+		PHPUnit_TextUI_TestRunner::run(self::suite2());
+	}
+
+	public static function suite1()
+	{
+		$suite = new PHPUnit_Framework_TestSuite('PHPUnit');
+
+                // Code tests
+                $suite->addTest(Syntax_AllTests::suite());
+	}
+
+	public static function suite()
+	{
+		$suite = new SeleniumRemoteSuite('PHPUnit');
+
+		// Integration tests (Selenium).
+		$suite->addTest(Site_AllTests::suite());
+//		$suite->addTest(Trackers_AllTests::suite());
+		$suite->addTest(Tasks_AllTests::suite());
+		$suite->addTest(Forums_AllTests::suite());
+		$suite->addTest(News_AllTests::suite());
+//		$suite->addTest(PluginsWiki_AllTests::suite());
+//		$suite->addTest(PluginsWebSvn_AllTests::suite());
+//		$suite->addTest(Scm_AllTests::suite());
+//		$suite->addTest(Docs_AllTests::suite());
+		
+		return $suite;
+	}
+}
+
+if (PHPUnit_MAIN_METHOD == 'AllTests::main') {
+	AllTests::main();
+}
+?>


Property changes on: trunk/tests/TarCentos52Tests.php
___________________________________________________________________
Added: svn:executable
   + *

Modified: trunk/tests/func/Forums/AllTests.php
===================================================================
--- trunk/tests/func/Forums/AllTests.php	2009-04-30 21:55:26 UTC (rev 7552)
+++ trunk/tests/func/Forums/AllTests.php	2009-05-01 17:51:27 UTC (rev 7553)
@@ -50,8 +50,7 @@
 require_once 'PHPUnit/Framework.php';
 require_once 'PHPUnit/TextUI/TestRunner.php';
  
-require_once 'Forums/forums.php';
-// ...
+require_once dirname(__FILE__).'/forums.php';
  
 class Forums_AllTests
 {

Modified: trunk/tests/func/Forums/forums.php
===================================================================
--- trunk/tests/func/Forums/forums.php	2009-04-30 21:55:26 UTC (rev 7552)
+++ trunk/tests/func/Forums/forums.php	2009-05-01 17:51:27 UTC (rev 7553)
@@ -43,7 +43,7 @@
  * ALONE BASIS."
  */
 
-require_once 'Testing/SeleniumGforge.php';
+require_once 'func/Testing/SeleniumGforge.php';
 
 class CreateForum extends FForge_SeleniumTestCase
 {

Modified: trunk/tests/func/News/AllTests.php
===================================================================
--- trunk/tests/func/News/AllTests.php	2009-04-30 21:55:26 UTC (rev 7552)
+++ trunk/tests/func/News/AllTests.php	2009-05-01 17:51:27 UTC (rev 7553)
@@ -51,7 +51,6 @@
 require_once 'PHPUnit/TextUI/TestRunner.php';
  
 require_once dirname(__FILE__).'/news.php';
-// ...
  
 class News_AllTests
 {
@@ -74,4 +73,4 @@
 if (PHPUnit_MAIN_METHOD == 'News_AllTests::main') {
     Framework_AllTests::main();
 }
-?>
\ No newline at end of file
+?>

Modified: trunk/tests/func/News/news.php
===================================================================
--- trunk/tests/func/News/news.php	2009-04-30 21:55:26 UTC (rev 7552)
+++ trunk/tests/func/News/news.php	2009-05-01 17:51:27 UTC (rev 7553)
@@ -43,7 +43,7 @@
  * ALONE BASIS."
  */
 
-require_once 'Testing/SeleniumGforge.php';
+require_once 'func/Testing/SeleniumGforge.php';
 
 class CreateNews extends FForge_SeleniumTestCase
 {

Modified: trunk/tests/func/Site/AllTests.php
===================================================================
--- trunk/tests/func/Site/AllTests.php	2009-04-30 21:55:26 UTC (rev 7552)
+++ trunk/tests/func/Site/AllTests.php	2009-05-01 17:51:27 UTC (rev 7553)
@@ -50,10 +50,9 @@
 require_once 'PHPUnit/Framework.php';
 require_once 'PHPUnit/TextUI/TestRunner.php';
  
-require_once 'Site/projects.php';
-require_once 'Site/top.php';
-require_once 'Site/login.php';
-// ...
+require_once dirname(__FILE__).'/projects.php';
+require_once dirname(__FILE__).'/top.php';
+require_once dirname(__FILE__).'/login.php';
  
 class Site_AllTests
 {

Modified: trunk/tests/func/Site/login.php
===================================================================
--- trunk/tests/func/Site/login.php	2009-04-30 21:55:26 UTC (rev 7552)
+++ trunk/tests/func/Site/login.php	2009-05-01 17:51:27 UTC (rev 7553)
@@ -43,7 +43,7 @@
  * ALONE BASIS."
  */
 
-require_once 'Testing/SeleniumGforge.php';
+require_once 'func/Testing/SeleniumGforge.php';
 
 class LoginProcess extends FForge_SeleniumTestCase
 {

Modified: trunk/tests/func/Site/projects.php
===================================================================
--- trunk/tests/func/Site/projects.php	2009-04-30 21:55:26 UTC (rev 7552)
+++ trunk/tests/func/Site/projects.php	2009-05-01 17:51:27 UTC (rev 7553)
@@ -43,7 +43,7 @@
  * ALONE BASIS."
  */
 
-require_once 'Testing/SeleniumGforge.php';
+require_once 'func/Testing/SeleniumGforge.php';
 
 class CreateProject extends FForge_SeleniumTestCase
 {

Modified: trunk/tests/func/Site/top.php
===================================================================
--- trunk/tests/func/Site/top.php	2009-04-30 21:55:26 UTC (rev 7552)
+++ trunk/tests/func/Site/top.php	2009-05-01 17:51:27 UTC (rev 7553)
@@ -43,7 +43,7 @@
  * ALONE BASIS."
  */
 
-require_once 'Testing/SeleniumGforge.php';
+require_once 'func/Testing/SeleniumGforge.php';
 
 class Top extends FForge_SeleniumTestCase
 {

Modified: trunk/tests/func/Tasks/AllTests.php
===================================================================
--- trunk/tests/func/Tasks/AllTests.php	2009-04-30 21:55:26 UTC (rev 7552)
+++ trunk/tests/func/Tasks/AllTests.php	2009-05-01 17:51:27 UTC (rev 7553)
@@ -50,8 +50,7 @@
 require_once 'PHPUnit/Framework.php';
 require_once 'PHPUnit/TextUI/TestRunner.php';
  
-require_once 'Tasks/csv.php';
-// ...
+require_once dirname(__FILE__).'/csv.php';
  
 class Tasks_AllTests
 {

Modified: trunk/tests/func/Tasks/csv.php
===================================================================
--- trunk/tests/func/Tasks/csv.php	2009-04-30 21:55:26 UTC (rev 7552)
+++ trunk/tests/func/Tasks/csv.php	2009-05-01 17:51:27 UTC (rev 7553)
@@ -43,7 +43,7 @@
  * ALONE BASIS."
  */
 
-require_once 'Testing/SeleniumGforge.php';
+require_once 'func/Testing/SeleniumGforge.php';
 
 class ExportCSV extends FForge_SeleniumTestCase
 {

Modified: trunk/tests/func/Testing/SeleniumGforge.php
===================================================================
--- trunk/tests/func/Testing/SeleniumGforge.php	2009-04-30 21:55:26 UTC (rev 7552)
+++ trunk/tests/func/Testing/SeleniumGforge.php	2009-05-01 17:51:27 UTC (rev 7553)
@@ -43,7 +43,7 @@
  * ALONE BASIS."
  */
 
-require_once 'config.php';
+require_once 'func/config.php';
 require_once 'PHPUnit/Extensions/SeleniumTestCase.php';
 
 // New class to use, next one is now obsolete.
@@ -51,7 +51,7 @@
 {
     protected function setUp()
     {
-	if (defined(DB_INIT_CMD)) {
+	if (defined('DB_INIT_CMD')) {
 		// Reload a fresh database before running this test suite.
 		system(DB_INIT_CMD);
 	}

Added: trunk/tests/func/Testing/SeleniumRemoteSuite.php
===================================================================
--- trunk/tests/func/Testing/SeleniumRemoteSuite.php	                        (rev 0)
+++ trunk/tests/func/Testing/SeleniumRemoteSuite.php	2009-05-01 17:51:27 UTC (rev 7553)
@@ -0,0 +1,28 @@
+<?php
+ 
+class SeleniumRemoteSuite extends PHPUnit_Framework_TestSuite
+{
+	protected function setUp()
+	{
+		system("cd scripts; ./start_vm.sh centos52");
+		system("scp ../../build/packages/fusionforge-*allinone.tar.bz2 root at centos52:");
+		system("ssh root at centos52 'tar jxf fusionforge-*allinone.tar.bz2'");
+		system("ssh root at centos52 'cd fusionforge-*; FFORGE_DB=fforge FFORGE_USER=gforge FFORGE_ADMIN_USER=ffadmin FFORGE_ADMIN_PASSWORD=ffadmin ./install.sh centos52.local'");
+
+		system("ssh root at centos52 'mkdir -p /opt/tests/func'");
+		system("scp func/db_reload.php root at centos52:/opt/tests/func/");
+		system("scp func/config.php.tests root at centos52:/opt/tests/func/config.php");
+
+		system("scp /usr/share/php/PHPUnit/Extensions/SeleniumTestCase/*pend.php root at centos52:/opt/tests");
+		system("scp /usr/share/php/PHPUnit/Extensions/SeleniumTestCase/phpunit_coverage.php root at centos52:/opt/gforge/www");
+		//system("ssh root at centos52 'perl -spi -e \'s!^auto_prepend_file.*!auto_prepend_file=/opt/tests/prepend.php!\' /etc/php.ini');
+		//system("ssh root at centos52 'perl -spi -e \'s!^auto_append_file.*!auto_append_file=/opt/tests/append.php!\' /etc/php.ini');
+
+	}
+
+	protected function tearDown()
+	{
+		system("cd scripts; ./stop_vm.sh centos52");
+	}
+}
+?>

Added: trunk/tests/func/config.php.tests
===================================================================
--- trunk/tests/func/config.php.tests	                        (rev 0)
+++ trunk/tests/func/config.php.tests	2009-05-01 17:51:27 UTC (rev 7553)
@@ -0,0 +1,31 @@
+<?php
+/*
+ * DANGER DANGER DANGER DANGER DANGER DANGER DANGER DANGER DANGER 
+ * DANGER DANGER DANGER DANGER DANGER DANGER DANGER DANGER DANGER 
+ * 
+ * Running the test suite will drop your current database, this is
+ * to be used only on test environment.
+ * 
+ * DANGER DANGER DANGER DANGER DANGER DANGER DANGER DANGER DANGER 
+ * DANGER DANGER DANGER DANGER DANGER DANGER DANGER DANGER DANGER 
+ */
+
+// Host where selenium-rc is running
+define ('SELENIUM_RC_HOST', '192.168.0.204');
+
+// URL to access the application
+define ('URL', 'http://centos52.local/');
+
+// Base URL where FusionForge is installed
+define ('BASE', '');
+
+// Database connection parameters.
+define('DB_TYPE', 'pgsql');         // Values: mysql, pgsql
+define('DB_NAME', 'fforge');
+define('DB_USER', 'gforge');
+define('DB_PASSWORD', '@@FFDB_PASS@@');
+define('DB_INIT_CMD', "ssh root at centos52 'cd /tmp; php db_reload.php'");
+
+// Enter true when file is configured.
+define('CONFIGURED', true);
+?>


Property changes on: trunk/tests/func/config.php.tests
___________________________________________________________________
Added: svn:executable
   + *

Modified: trunk/tests/func/db_reload.php
===================================================================
--- trunk/tests/func/db_reload.php	2009-04-30 21:55:26 UTC (rev 7552)
+++ trunk/tests/func/db_reload.php	2009-05-01 17:51:27 UTC (rev 7553)
@@ -53,7 +53,7 @@
 
 ini_set('memory_limit', '16M');
 
-require_once 'config.php';
+require_once dirname(__FILE__).'/config.php';
 
 if ( !CONFIGURED ) {
 	print "File 'config.php' is not correctly configured, aborting.\n";
@@ -69,8 +69,8 @@
 	// Reload a fresh database before running this test suite.
 	system("mysqladmin -f -u".DB_USER." -p".DB_PASSWORD." drop ".DB_NAME." &>/dev/null");
 	system("mysqladmin -u".DB_USER." -p".DB_PASSWORD." create ".DB_NAME);
-	system("mysql -u".DB_USER." -p".DB_PASSWORD." ".DB_NAME." < ".dirname(dirname(__FILE__))."/db/gforge-struct-mysql.sql");
-	system("mysql -u".DB_USER." -p".DB_PASSWORD." ".DB_NAME." < ".dirname(dirname(__FILE__))."/db/gforge-data-mysql.sql");
+	system("mysql -u".DB_USER." -p".DB_PASSWORD." ".DB_NAME." < ".dirname(dirname(__FILE__))."/gforge/db/gforge-struct-mysql.sql");
+	system("mysql -u".DB_USER." -p".DB_PASSWORD." ".DB_NAME." < ".dirname(dirname(__FILE__))."/gforge/db/gforge-data-mysql.sql");
 } elseif ( DB_TYPE == 'pgsql') {
 	if (!function_exists('pg_connect')) {
 		print "ERROR: Missing pgsql on PHP to run tests on PostgreSQL.\n";
@@ -83,7 +83,7 @@
 	system("service postgresql restart 2>&1 >/dev/null");
 	system("su - postgres -c 'dropdb -q ".DB_NAME."'");
 	system("su - postgres -c 'createdb -q --encoding UNICODE ".DB_NAME."'");
-	system("psql -q -U".DB_USER." ".DB_NAME." -f ".dirname(dirname(dirname(__FILE__)))."/db/gforge.sql &>/tmp/gforge-import.log");
+	system("psql -q -U".DB_USER." ".DB_NAME." -f ".dirname(dirname(dirname(__FILE__)))."/gforge/db/gforge.sql &>/tmp/gforge-import.log");
 } else {
 	print "Unsupported database type: ".DB_TYPE. "\n";
 	exit;

Added: trunk/tests/scripts/start_vm.sh
===================================================================
--- trunk/tests/scripts/start_vm.sh	                        (rev 0)
+++ trunk/tests/scripts/start_vm.sh	2009-05-01 17:51:27 UTC (rev 7553)
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+exec ./start_vz.sh "$@"


Property changes on: trunk/tests/scripts/start_vm.sh
___________________________________________________________________
Added: svn:executable
   + *

Added: trunk/tests/scripts/start_vz.sh
===================================================================
--- trunk/tests/scripts/start_vz.sh	                        (rev 0)
+++ trunk/tests/scripts/start_vz.sh	2009-05-01 17:51:27 UTC (rev 7553)
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+sudo /root/start_vz.sh centos-5-i386-default-5.2-20081107 "$1"
+
+rm -f /home/albot/.ssh/known_hosts
+
+ssh -o 'StrictHostKeyChecking=no' root at centos52 uname -a
+
+sleep 1


Property changes on: trunk/tests/scripts/start_vz.sh
___________________________________________________________________
Added: svn:executable
   + *

Added: trunk/tests/scripts/stop_vm.sh
===================================================================
--- trunk/tests/scripts/stop_vm.sh	                        (rev 0)
+++ trunk/tests/scripts/stop_vm.sh	2009-05-01 17:51:27 UTC (rev 7553)
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+exec ./stop_vz.sh "$@"


Property changes on: trunk/tests/scripts/stop_vm.sh
___________________________________________________________________
Added: svn:executable
   + *

Added: trunk/tests/scripts/stop_vz.sh
===================================================================
--- trunk/tests/scripts/stop_vz.sh	                        (rev 0)
+++ trunk/tests/scripts/stop_vz.sh	2009-05-01 17:51:27 UTC (rev 7553)
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+sudo /root/stop_vz.sh "$1"


Property changes on: trunk/tests/scripts/stop_vz.sh
___________________________________________________________________
Added: svn:executable
   + *




More information about the Fusionforge-commits mailing list