JUnit in parallel with Rails Fixtures?

My team has a set of POJOs that we collect to go into our code and test various functions. For example, we have an Address class that contains address information.

It does not make sense to constantly rebuild this class every time we have to delete the address of an object in order to check something. I think something like Rails fixtures would be nice, but just having some kind of reasonable package and class in the test tree to store all of that would be nice.

Any ideas? Does JUnit have built-in tools to help with this?

+4
source share
2 answers

I found xUnit Patterns a book very useful for this kind of thing. You can find the helpful Creation Method .

Set up test equipment by invoking methods that obscure the mechanics of building ready-to-use objects behind intent disclosure pointers.

Follow the link for detailed information on implementation and design options. If this does not help, check out some other settings.

+1
source

JUnit parameterized tests may be what you want. You can set up data collection (in your case, your POJOs) and run your tests using these parameters. Therefore, when adding new example data, you do not need to rewrite the tests.

+1
source

Source: https://habr.com/ru/post/1310291/


All Articles