Hi there,
I've been using buster.js to convert some tests of Obviel
(
http://obviel.org) from qunit. Overall it's a big improvement, so
thank you!
I figured I'd give a bit of feedback. Some of this feedback may be a
FAQ, but since I intend to start a buster.js FAQ just let me know and
I'll add it. :)
What is the procedure for adding docs? I find a buster-docs repo and
your development page has instructions on how to run a doc server, but
I also find a buster-docs-sphinx. I'm sort of hoping the latter is in
active use now, because I'm familiar with sphinx.
I had a weird out of memory error on IE 8 as a slave in a virtual
machine. It happens even if I just run a single test. Has anyone else
experienced this? How can I help debug this? I'd create an issue but
my report is rather unhelpful at this stage.
buster exception reporting seems a bit peculiar so I'm curious as to
motivations behind it. I had quite a few problems debugging existing
exceptions initially, as my exceptions didn't conform to what
buster.js wanted. buster.js would only report an 'undefined'
exception which was unhelpful in debugging. With qunit, I was used to
providing a toString() method for my exception that would help display
it, but buster.js seems to completely ignore that. In the end I
resorted to complying with what buster.js seems to want: a 'name'
property and a 'message' property. I'd be nice if buster.js could be
more jhelpful and generic in this area. I could study qunit (which
seemed more friendly) to see what is done there in case this is
helpful.
The way test names are outputted by buster test is hard to read. I see:
Firefox 14.0.1, Linux sync tests update to object URL
I cannot readily parse out the bits I want to know, i.e. the test case
name and the test name. Why not something like this?
Firefox 14.0.1, Linux | sync tests | update to object URL
Some of the coloration of the output is also hard to read on my
screen. I use a pretty common terminal setting: black text on a white
background. But part of the output is in a rather light yellow, that
is pretty hard to read on the white background. It'd be helpful if the
colors could be tweaked.
What is the pattern for defining helper functions in test cases?
Perhaps this is more a sinon.js question, but it interacts with
buster.js. I used a fake HTTP server using sinon.js. I wanted a helper
function that would let me define JSON URLs more easily. I initially
just added a helper method to the testCase, but that didn't work as it
of course it tried to run it as a test case. I ended up assigning the
helper function within 'setUp', along these lines:
setUp: function() {
this.helper = function() {
}
}
but i'd prefer to be able to take that outside of setUp. Is there some
better way to do this? In the end I'd like to share this helper
function between test cases as well. Would I create a special kind of
test case, or a special kind of fakeServer? Some guidance on patterns
here would be useful. I think there are different patterns too; here I
wanted to add some functionality that could actually go into sinon.js
as it's quite generic (sending back JSON in a more convenient way),
but in some other cases I really would like to define specific helpers
for particular test cases.
FAQs that I found the answers to and that I'll try to spell out:
* how to use firebug debugging with buster tests?
Answer:
$ buster test -p
will run the buster tests without changing the paths of the JavaScript
files loaded into the browser. Go to the browser capture screen in
Firefox. Enable Firebug and script debugging. Now run the tests once
with 'buster test p'. The appropriate paths will now be loaded in the
script debugging panel of Firebug. You can now set breakpoints which
will be triggered once you run the tests again.
When debugging it's useful to be able to run a test in isolation; you
can do this by including the test name (or part of it that uniquely
identifies it) after 'buster test -p', for instance:
$ buster test -p 'amazing test'
(note that buster static offers hope to be able to do this too, but
there's no way to isolate a test like you could do in qunit by
clicking on it, which is quite essential for in-browser debugging)
Unwritten FAQs (that I've answered enough to get going):
* how do I include test resources and then refer to them?
Answer should involve how to make a URL to them (which is a bit odd
concerning the way directories are handled, I'll get back to that),
and how you could use sinonjs instead. There's also an inconsistency
in the docs, the configuration doc says "To request a resource.. you
need to scope resource paths with buster.env.contextPath" though the
resource doc says you can simply refer to a resource if you expose it.
* how to set an alternative body per test.
There are some limitations to this; script elements in my custom body
didn't seem to be included.
Regards,
Martijn