• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to start Unit Testing and Integration testing with an existing code base

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello to all,

I recently developed a web service. It was done in a hurry so I wasn't able to create unit tests. I now have the time to refactor it and want to create some unit test and integration tests. What I am planning to do is create an integration test. I plan to create something that would simulate how the data passes from the mobile application to the web service and back. I recorded the json (jsons?) and plan to use them as my control while doing some refactoring. The web service is using HTTP to receive json and returns the results as a json.

Anyway, what tools do you guys use? Do you have the same process like what I intend to do? Is what I am planning wrong, waste of time and just hastens the heat death of the universe?
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Francis,
Sounds like a good plan. For legacy code, it is often easier to start with an integration test. That gives you some safety to refactor to facilitate unit testing. (Michael Feathers defines legacy code as any code which was originally written without tests. Even if you wrote it 2 days ago. His book "Working Effectively With Legacy Code" is excellent by the way.)

I use JUnit with HtmlUnit to test web services. Another alternative is to use JUnit with Spring's RestTemplate for testing the web services.
 
Francis Zabala
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jeanne,

Thank you for your feedback and am really glad that I can avoid shooting my own foot with my plan. I really like what defines a legacy code now. Hahaha!

Regards,
Francis
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic