English 中文(简体)
Which BDD framework for JavaScript do you use?
原标题:

I m developing large application using ExtJS framework. Because it grows too fast, I realized that this might be the time to start doing tests.

I want to go for BDD technique, I found several BDD frameworks for JavaScript around (Screw.Unit, JSpec, JSSpec), but I m still not sure which one to choose. There are some articles about this topic, but I m more interested in your own experiences/suggestions.

So my questions are:

  • Which one do you use and why?
  • Any other hints/tips are welcome.
  • Do you use Selenium alongside a BDD testing?
  • Do you use any other technique?
问题回答

We use Selenium, yes.

I wrote a Unit Test framework (well, most of one, functional, not entirely pluggable) that I have used a few times. These sorts of topics keep coming up so maybe I should finish it... the url is http://code.google.com/p/jasproject/

I use buster.js because I develop in node.js as well as client-side javascript. It copes with both scenarios using a single API. The documentation is still lacking, but I really like the support for asynchronous testing.

Buster can also be used in a similar way to Selenium s WebDriver - you can slave various browsers to a buster "server" and run your tests in all those browsers at the same time.

Functional web testing has several challenges. Tests tend to be...

  1. Slow to run (http requests are slow, dom traversal can be slow too)
  2. Slow to write (write a test, start the app, run the test, realise you made a mistake, start again)
  3. Hard to read (xpaths, css selectors etc)
  4. Brittle (when tightly coupled to your HTML)
  5. Expensive to maintain (if you don t use an abstraction layer such as the page object pattern)
  6. Unrealistic (when run in a fake browser)

For these reason my preferred stack is

  1. JavaScript - development time is fast since there s no compilation time
  2. CasperJS or Zombie JS - very fast, webkit based (Safari & Chrome [for now])
  3. Yadda for true BDD - Makes the test easy to read and provides an abstraction layer, mitigating the brittleness and maintenance

Downsides of this stack is that you re only testing in webkit, not firefox, IE or Chrome (when Google move to Blink)





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签