Browse files

ENHANCEMENT Allowing JSTestDriver execution in tests/javascript/ by a…

…dding bash scripts and new Makefile command ("make jasmine")
  • Loading branch information...
1 parent aefc60e commit 7bda1ecab622674f334c158202c3a4fa54bcb595 @chillu chillu committed Mar 10, 2011
Showing with 76 additions and 0 deletions.
  1. +3 −0 Makefile
  2. +15 −0 tests/javascript/jstestdriver.conf
  3. +30 −0 tests/javascript/server.sh
  4. +28 −0 tests/javascript/test.sh
View
3 Makefile
@@ -15,3 +15,6 @@ phpunit:
windmill:
functest ../cms/tests/test_windmill url=${URL}dev/tests/startsession browser=firefox
+
+jasmine:
+ ./tests/javascript/server.sh
View
15 tests/javascript/jstestdriver.conf
@@ -0,0 +1,15 @@
+server: http://localhost:9876
+
+load:
+ - ../../thirdparty/jasmine/lib/jasmine.js
+ - ../../thirdparty/jasmine/lib/jasmine-html.js
+ - ../../thirdparty/jasmine-jstd-adapter/src/JasmineAdapter.js
+ - ../../thirdparty/jasmine-jquery/lib/jasmine-jquery.js
+ - ../../thirdparty/jasmine-dom/lib/jasmine-dom-fixtures.js
+ - ../../thirdparty/jasmine-ajax/lib/mock-ajax.js
+ - ../../thirdparty/jasmine-ajax/lib/spec-helper.js
+ - ../../thirdparty/jquery/jquery.js
+ - ../../thirdparty/jquery-entwine/dist/*
+ - ../../thirdparty/jstree/jquery.jstree.js
+ - ../../javascript/TreeDropdownField.js
+ - TreeDropdownField/TreeDropdownField.js
View
30 tests/javascript/server.sh
@@ -0,0 +1,30 @@
+#!/bin/bash
+while getopts "j:p:" flag
+do
+ if [ $flag == "j" ]; then
+ JSTD=$OPTARG
+ elif [ $flag == "p" ]; then
+ PORT=$OPTARG
+ fi
+done
+
+TESTPATH=`dirname $0`
+
+if [ -z "$PORT" ]; then
+ PORT=9876
+fi
+
+if [ -z "$JSTD" ]; then
+ # Download test driver dependency if required (too large to include in core)
+ JSTD="$TESTPATH/JsTestDriver-1.3.1.jar"
+ if [ ! -f $JSTD ]; then
+ wget -O $JSTD http://js-test-driver.googlecode.com/files/JsTestDriver-1.3.1.jar
+ fi
+fi
+
+echo "####################################################"
+echo "Please capture a browser by visiting http://localhost:$PORT"
+echo "Run tests by executing ./tests/javascript/test.sh"
+echo "####################################################"
+
+java -jar $JSTD --port $PORT --config "$TESTPATH/jstestdriver.conf"
View
28 tests/javascript/test.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+while getopts "j:t:" flag
+do
+ if [ $flag == "j" ]; then
+ JSTD=$OPTARG
+ elif [ $flag == "t" ]; then
+ TESTS=$OPTARG
+ fi
+done
+
+TESTPATH=`dirname $0`
+
+if [ -z "$JSTD" ]; then
+ # Download test driver dependency if required (too large to include in core)
+ JSTD="$TESTPATH/JsTestDriver-1.3.1.jar"
+ if [ ! -f $JSTD ]; then
+ wget -O $JSTD http://js-test-driver.googlecode.com/files/JsTestDriver-1.3.1.jar
+ fi
+fi
+
+if [ -z "$TESTS" ]; then
+ TESTS="all"
+ echo "Running all tests"
+else
+ echo "Running '$TESTS'"
+fi
+
+java -jar $JSTD --reset --config "$TESTPATH/jstestdriver.conf" --tests "$TESTS"

0 comments on commit 7bda1ec

Please sign in to comment.