ENHANCEMENT Allowing JSTestDriver execution in tests/javascript/ by adding bash scripts and new Makefile command ("make jasmine")

This commit is contained in:
Ingo Schommer 2011-03-10 11:14:36 +13:00
parent aefc60e406
commit 7bda1ecab6
4 changed files with 76 additions and 0 deletions

View File

@ -15,3 +15,6 @@ phpunit:
windmill:
functest ../cms/tests/test_windmill url=${URL}dev/tests/startsession browser=firefox
jasmine:
./tests/javascript/server.sh

View File

@ -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

30
tests/javascript/server.sh Executable file
View File

@ -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"

28
tests/javascript/test.sh Executable file
View File

@ -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"