File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 Head First Android this week in the Android forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "testing wrapper methods" Watch "testing wrapper methods" New topic

testing wrapper methods

Wendy Gibbons

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

Joined: May 26, 2003
Posts: 32319

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?

[OCA 8 book] [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

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:
subject: testing wrapper methods
It's not a secret anymore!