File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Testing and the fly likes testing wrapper methods Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "testing wrapper methods" Watch "testing wrapper methods" New topic
Author

testing wrapper methods

Wendy Gibbons
Bartender

Joined: Oct 21, 2008
Posts: 1107

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
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30752
    
156

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: 1107

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://aspose.com/file-tools
 
subject: testing wrapper methods