diff --git a/Makefile b/Makefile index caeca9b41..c06ea5ddc 100644 --- a/Makefile +++ b/Makefile @@ -43,7 +43,10 @@ PDF_JS_FILES = \ server: @cd test; python test.py --port=8888; -test: shell-test browser-test +# make test +# +# This target runs all the tests. This can be used for testing all browsers. +test: unit-test shell-test browser-test # # Create production output (pdf.js, and corresponding changes to web files) @@ -68,6 +71,14 @@ bundle: | $(BUILD_DIR) rm -f *.tmp; \ cd .. +# make unit-test +# +# This target runs in-browser unit tests with js-test-driver and jasmine unit +# test framework. + +unit-test: + @cd test/unit/ ; make ; + # make browser-test # # This target runs in-browser tests using two primary arguments: a diff --git a/test/unit/Makefile b/test/unit/Makefile index 2f5f5e71c..57ae0c80d 100644 --- a/test/unit/Makefile +++ b/test/unit/Makefile @@ -1,7 +1,20 @@ -PROG=java -Xms512m -Xmx1024m -jar ../../external/jsTestDriver/JsTestDriver-1.3.3d.jar --reset --port 4224 --browser firefox --tests all --testOutput ./test_reports/ +# Fetch the paths to browsers that are going to be used in testing. +MANIFEST=../resources/browser_manifests/browser_manifest.json +BROWSERS=$(shell echo `sed -n 's/.*"path":\(.*\)/\1,/p' $(MANIFEST) | tr -d '\n'`) + +# Command to invoke the unit test. +PROG=java \ +-Xms512m \ +-Xmx1024m \ +-jar ../../external/jsTestDriver/JsTestDriver-1.3.3d.jar \ +--reset \ +--port 4224 \ +--browser $(BROWSERS) \ +--tests all \ +--testOutput ./test_reports/ test: - $(PROG) ; \ + $(PROG) .phony:: test