aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Test-Driven JavaScript Development - Questions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Test-Driven JavaScript Development - Questions" Watch "Test-Driven JavaScript Development - Questions" New topic
Author

Test-Driven JavaScript Development - Questions

Raghavan Muthu
Ranch Hand

Joined: Apr 20, 2006
Posts: 3355

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.


Everything has got its own deadline including one's EGO!
[CodeBarn] [Java Concepts-easily] [Corey's articles] [SCJP-SUN] [Servlet Examples] [Java Beginners FAQ] [Sun-Java Tutorials] [Java Coding Guidelines]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
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

Joined: Oct 03, 2010
Posts: 46
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

Joined: Apr 20, 2006
Posts: 3355

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

Joined: Oct 03, 2010
Posts: 46
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

Joined: Apr 20, 2006
Posts: 3355

Thanks for pointing to the nice article Chris!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Test-Driven JavaScript Development - Questions