javaunit-testingtestingwhite-box-testing

How to test a java software?


We have been assigned an open source software to test! The software has 3 packages and each package has 10 or more classes and each class might have dozens of methods.

My question is that before I start structural (white-box) testing, do i need to understand every line of code in the software?

Do I need to understand the whole flow of program starting from main() method?

What is the approach I should take?


Solution

  • If you have specs on what each method is supposed to do: What is expected output for specified input then no you don't need to go into implementation details of those methods. Normally this should be written down!

    You could write unit tests that check if methods are satisfying predefined contracts (if they exist).

    If you don't have specs or with recent trend 'UserStories' you need to 'reverse engineer your specs' :) You would need to analyse each method to understand what is it doing, next you will check where those methods are being called in order to figure out what are the possible values passed in the method calls. Also from the calling methods you might get the idea what are the corner cases. And those you definitely want to test.

    .... and slowly you learned the whole code :)