I am trying to get batman testing up and running. Qunit and tests runs fine, but when i use the example:
class SimpleTest extends Batman.TestCase
@test 'A simple test', ->
@assert true
test = new SimpleTest
test.runTests()
I get the following messages when i browse to localhost:3000/qunit:
- Setup failed on A simple test: undefined is not a function
- Died on test #2 at Test.Batman.TestCase.TestCase.Test.Test.run (localhost:3000/assets/extras/testing/test_case.js?body=1:20:22) at SimpleTest.Batman.TestCase.TestCase.runTests (localhost:3000/assets/extras/testing/test_case.js?body=1:51:28) at localhost:3000/assets/simple_test.js?body=1:24:8 at localhost:3000/assets/simple_test.js?body=1:26:4: undefined is not a function
- Teardown failed on A simple test: undefined is not a function
In the test_helper.coffee, I manually included the project, sinon and the four test case source files from the github source code found here, including test_case.coffee.
What am I doing wrong?
Depending on how those
.coffee
source files are loaded, it's possible that they don't have their dependencies loaded first.You could try this:
batman.testing.js
from the releasebatman.js
first, thenbatman.testing.js
. (Batman.Object
must be defined before you loadBatman.TestCase
.)Does that help?