Let's say I have a class MyClass.java
and we have to write a tests for it. Some of them will execute once, some of them will execute multiple times.
- I prepared two test classes -
MyClassTestSingle.java
for single tests andMyClassTestMultiple.java
for tests with@Parametrized
annotation. - I wanted to run them from a single file so there is another class -
MyClassTestSuite.java
. - In
MyClassTestSingle.java
andMyClassTestMultiple.java
methods I use same parameters with a same values so i started thinking about a class containing these parameters...
But then I realized I wanted to create four classes for testing a single class. So I started looking for some "good practices" how to keep my test classes clean and simple. But found no worthy informations about number of classes I need when writing tests for a situation above.
I started thinking that maybe there is a design problem in my MyClass.java
, but for sure there are situations when there is need to make a parametrized and single tests and then pack them into a suite.
Am I wrong? Or maybe I just don't understand something?
Aucun commentaire:
Enregistrer un commentaire