Testing Complex Data Scenarios

I am developing a Java web application that does a series of financial calculations for a user. When a financial calculation is performed, approximately 30 different inputs (no more than 15 * 18 expected values) are used to calculate 15 different values ​​over a maximum of 18 years. As you can tell, there is a lot of information available to calculate and validate.

What I'm looking for is advice on how to prepare test data (simulate 30 different inputs), load it into a series of objects, and run the objects through a calculator to generate an output that can then be compared to the expected value.

I tried to stub the database, but that ended up doing it forever . It seems to mock everyone that it will be just as tiresome. I would like to avoid external database dependencies if possible.

+1


a source to share


4 answers


If you have data in Db and you just want to create test data from it so that your tests don't depend on external db. You can take a look at the DbUnit structure and you can populate sample data in XML from the database, These XML that you can use for testing purposes, these XML can be easily converted to Java objects by the number of parsers available commercially.



0


a source


It looks like FitNesse ( http://fitnesse.org/ ) might be what you are looking for. You have set up your html table to FitNesse with your input and expected output. When you run the test, FitNesse will tell you if the actual result is in line with your expected result.



+1


a source


I would define values ​​around limit numbers (boundary values), a realistic value, and a zero value for each input parameter. Then I'll combine them all using the allpairs algorithm ( http://www.satisfice.com/tools.shtml ).

+1


a source


Your best bet is to use a factory that can randomly select values ​​from a pool and collect data from them. You can generate as many candidates from the population as you like. Save them along with the expected results. If the database is not to your liking, perhaps XML or simple text serialization will do.

If you are doing TDD, you can run several and see what the expected results should be. Check out a few with manual calculations to make sure they're okay. Then use a factory to create as large a set of tests as possible.

0


a source







All Articles