Skip to content

Commit 2d315ac

Browse files
committed
switch over to using Testacular for running unit tests
1 parent c57d3b5 commit 2d315ac

File tree

15 files changed

+36
-3286
lines changed

15 files changed

+36
-3286
lines changed

README.md

Lines changed: 16 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This project is an application skeleton for a typical [AngularJS](http://angular
44
You can use it to quickly bootstrap your angular webapp projects and dev environment for these
55
projects.
66

7-
The seed contains angular libraries, test libraries and a bunch of scripts all preconfigured for
7+
The seed contains AngularJS libraries, test libraries and a bunch of scripts all preconfigured for
88
instant web development gratification. Just clone the repo (or download the zip/tarball), start up
99
our (or yours) webserver and you are ready to develop and test your application.
1010

@@ -41,10 +41,10 @@ This really depends on how complex is your app and the overall infrastructure of
4141
the general rule is that all you need in production are all the files under the `app/` directory.
4242
Everything else should be omitted.
4343

44-
angular apps are really just a bunch of static html, css and js files that just need to be hosted
44+
Angular apps are really just a bunch of static html, css and js files that just need to be hosted
4545
somewhere, where they can be accessed by browsers.
4646

47-
If your angular app is talking to the backend server via xhr or other means, you need to figure
47+
If your Angular app is talking to the backend server via xhr or other means, you need to figure
4848
out what is the best way to host the static files to comply with the same origin policy if
4949
applicable. Usually this is done by hosting the files by the backend server or through
5050
reverse-proxying the backend server(s) and a webserver(s).
@@ -53,37 +53,23 @@ reverse-proxying the backend server(s) and a webserver(s).
5353
### Running unit tests
5454

5555
We recommend using [jasmine](http://pivotal.github.com/jasmine/) and
56-
[JsTestDriver](http://code.google.com/p/js-test-driver/) for your unit tests/specs, but you are free
56+
[Testacular](http://vojtajina.github.com/testacular/) for your unit tests/specs, but you are free
5757
to use whatever works for you.
5858

59-
Requires java and a local or remote browser.
59+
Requires [node.js](http://nodejs.org/), Testacular (`sudo npm install -g testacular`) and a local
60+
or remote browser.
6061

61-
* start `scripts/test-server.sh` (on windows: `scripts\test-server.bat`)
62-
* navigate your browser to `http://localhost:9876/`
63-
* click on one of the capture links (preferably the "strict" one)
64-
* run `scripts/test.sh` (on windows: `scripts\test.bat`)
65-
66-
67-
### Continuous unit testing
68-
69-
Requires ruby and [watchr](https://github.com/mynyml/watchr) gem.
70-
71-
* start JSTD server and capture a browser as described above
72-
* start watchr with `watchr scripts/watchr.rb`
73-
* in a different window/tab/editor `tail -f logs/jstd.log`
74-
* edit files in `app/` or `src/` and save them
75-
* watch the log to see updates
76-
77-
There are many other ways to achieve the same effect. Feel free to use them if you prefer them over
78-
watchr.
62+
* start `scripts/test.sh` (on windows: `scripts\test.bat`)
63+
* a browser will start and connect to the Testacular server (Chrome is default browser, others can be captured by loading the same url as the one in Chrome or by changing the `config/testacular.conf.js` file)
64+
* to run or re-run tests just change any of your source or test javascript files
7965

8066

8167
### End to end testing
8268

83-
angular ships with a baked-in end-to-end test runner that understands angular, your app and allows
69+
Angular ships with a baked-in end-to-end test runner that understands angular, your app and allows
8470
you to write your tests with jasmine-like BDD syntax.
8571

86-
Requires a webserver, node.js or your backend server that hosts the angular static files.
72+
Requires a webserver, node.js + `./scripts/web-server.js` or your backend server that hosts the angular static files.
8773

8874
Check out the
8975
[end-to-end runner's documentation](http://docs.angularjs.org/guide/dev_guide.e2e-testing) for more
@@ -125,18 +111,14 @@ fetch the changes and merge them into your project with git.
125111
partial1.html
126112
partial2.html
127113

128-
config/jsTestDriver.conf --> config file for JsTestDriver
129-
130-
logs/ --> JSTD and other logs go here (git-ignored)
114+
config/testacular.conf.js --> config file for running unit tests with Testacular
115+
config/testacular-e2e.conf.js --> config file for running e2e tests with Testacular
131116

132117
scripts/ --> handy shell/js/ruby scripts
133118
e2e-test.sh --> runs end-to-end tests with Testacular (*nix)
134119
e2e-test.bat --> runs end-to-end tests with Testacular (windows)
135-
test-server.bat --> starts JSTD server (windows)
136-
test-server.sh --> starts JSTD server (*nix)
137-
test.bat --> runs all unit tests (windows)
138-
test.sh --> runs all unit tests (*nix)
139-
watchr.rb --> config script for continuous testing with watchr
120+
test.bat --> autotests unit tests with Testacular (windows)
121+
test.sh --> autotests unit tests with Testacular (*nix)
140122
web-server.js --> simple development webserver based on node.js
141123

142124
test/ --> test source files and libraries
@@ -148,12 +130,9 @@ fetch the changes and merge them into your project with git.
148130
angular-mocks.js --> mocks that replace certain angular services in tests
149131
angular-scenario.js --> angular's scenario (end-to-end) test runner library
150132
version.txt --> version file
151-
jasmine/ --> Pivotal's Jasmine - an elegant BDD-style testing framework
152-
jasmine-jstd-adapter/ --> bridge between JSTD and Jasmine
153-
jstestdriver/ --> JSTD - JavaScript test runner
154133
unit/ --> unit level specs/tests
155134
controllersSpec.js --> specs for controllers
156135

157136
## Contact
158137

159-
For more information on angular please check out http://angularjs.org/
138+
For more information on AngularJS please check out http://angularjs.org/

config/jsTestDriver.conf

Lines changed: 0 additions & 14 deletions
This file was deleted.

config/testacular.conf.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
basePath = '../';
2+
3+
files = [
4+
JASMINE,
5+
JASMINE_ADAPTER,
6+
'app/lib/angular/angular.js',
7+
'app/lib/angular/angular-*.js',
8+
'test/lib/angular/angular-mocks.js',
9+
'app/js/*.js',
10+
'test/unit/*.js'
11+
];
12+
13+
autoWatch = true;
14+
15+
browsers = ['Chrome'];

scripts/test.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
BASE_DIR=`dirname $0`
44

5-
java -jar "$BASE_DIR/../test/lib/jstestdriver/JsTestDriver.jar" \
6-
--config "$BASE_DIR/../config/jsTestDriver.conf" \
7-
--basePath "$BASE_DIR/.." \
8-
--tests all
5+
echo ""
6+
echo "Starting Testacular Server (http://vojtajina.github.com/testacular)"
7+
echo "-------------------------------------------------------------------"
8+
9+
testacular start $BASE_DIR/../config/testacular.conf.js

test/lib/jasmine-jstd-adapter/JasmineAdapter.js

Lines changed: 0 additions & 196 deletions
This file was deleted.

test/lib/jasmine-jstd-adapter/version.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

test/lib/jasmine/MIT.LICENSE

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)