This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Testing and the fly likes testing wrapper methods Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Engineering » Testing
Reply Bookmark "testing wrapper methods" Watch "testing wrapper methods" New topic
Author

testing wrapper methods

Wendy Gibbons
Bartender

Joined: Oct 21, 2008
Posts: 1098

my new company have started doing TDD on the new javascript webstuff.
I have written a javascript method:


I can't test it calls the service, as that is an integration test (fully understand)
so what can I actually test?
my mentor wants me to test the parameters are passed in correctly, but these are just constructed in the test.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 26496
    
  78

Can you let the url for the AJAX submission be a fake one? In particular, just a simple one that always returns success or failure so you can test the function logs the right data?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Wendy Gibbons
Bartender

Joined: Oct 21, 2008
Posts: 1098

a friend (yes my out of work conversations are THAT DULL) suggested i stub the ajax and test the path is correct so that if anyone changes the path in the method it isn't happy.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: testing wrapper methods
 
Similar Threads
Integrating Jforum with my web application
Displaying dynamic views using Facelets / JSF
Left join query
different role stored in mySQL can access different jsp
Is there any provision to call a parameterized method in JSF