samedi 23 mai 2015

How to write jUnit tests with progressive state

I am new to jUnit and looking for advice. I have a simple "DataTable" object that I'm writing a test for. The tests need to incrementally add data to the object, testing as the process advances.... Empty/Add/Get/BoundsForColumns, Empty/Add/GetBoundsForRow, Empty/Put/Get/BoundsForData.... I don't want to re-create the test data in each test, and it doesn't feel like a setup/teardown pattern. I've read some on the "suite" feature that appears to be either deprecated or an anti-pattern in jUnit4. What would be some of the best practices for jUnit4 testing of this type of data container object? Am I testing the wrong things (state vs. function)? I am also creating some "Stub" classes to test Abstract class function, is the convention to place these Stub's in the "Main" source folders or the "Test" source folders? As always, many thanks to the generous experts on StackOverflow.

Aucun commentaire:

Enregistrer un commentaire