• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Test-Driven JavaScript Development - Questions

 
Raghavan Muthu
Ranch Hand
Posts: 3381
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Chris,

I was much attracted towards the caption/title of the book.

As I am not much into UI but server side development, first question in me was:

1. What exactly the TDD would be of use/benefit in Javascript ? Just one similarity is that it is more or less like a Programming Language.

Few other questions are :

2.What about the scope of automated workflow here?

3. What exactly is the term test stub meant here?

4. By what means QA and testers would get benefitted out of these ? I am much interested in this aspect.

Curious to know answers for these. Would be great if you can clarify.

Thanks,
Raghavan alias Saravanan M.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Raghavan Muthu wrote:
1. What exactly the TDD would be of use/benefit in Javascript ? Just one similarity is that it is more or less like a Programming Language.


Do you think JavaScript is NOT a programming language?

Eric
 
Christian Johansen
author
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Raghavan!

Raghavan Muthu wrote:1. What exactly the TDD would be of use/benefit in Javascript ? Just one similarity is that it is more or less like a Programming Language.


JavaScript is a full-fledged programming language. You'd want unit testing in JavaScript for exactly the same reasons as in any other language: fewer defects, easier to refactor, increased confidence and prouctivity and so on.

Raghavan Muthu wrote:2.What about the scope of automated workflow here?


Not quite sure what you refer to by the scope, but if you're curious about the possibilities for automated workflow, they're pretty good and getting better. JsTestDriver is a test runner that can automate unit tests with several testing frameworks (its default testing framework, QUnit, YUI Test and Jasmine currently) and works well from the command line, Eclipse and Idea as well as CI servers such as Hudson.

Raghavan Muthu wrote:3. What exactly is the term test stub meant here?


Test stub is a fake object injected into your system while under test so as to either cut off some dependencies or to force the code down a specific path. In JavaScript I feel that stubs map better to functions as that is more often what you want, and fake objects can be created on the fly using object literals.

Raghavan Muthu wrote:4. By what means QA and testers would get benefitted out of these ? I am much interested in this aspect.


Well, unit testing and TDD is first and foremost a developer activity, but the benefit for QA and testers would be e.g. reduced number of defects.
 
Raghavan Muthu
Ranch Hand
Posts: 3381
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Chris for the answers. They are nice .

Test stub is pretty interesting! It is something like Mock Objects I guess. Is nt it?
 
Christian Johansen
author
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Test stubs are much like mocks in that they are fake, but unlike mocks, stubs aren't preprogrammed with expectations. So you use state verification as usual in tests that use stubs (either on the stubs or other objects). Martin Fowler has a great writeup on the difference: http://martinfowler.com/articles/mocksArentStubs.html
 
Raghavan Muthu
Ranch Hand
Posts: 3381
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for pointing to the nice article Chris!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic