junit4 - JUnit behaviour with static final variable of usual Java class -
assuming, want use predefined static final list instance(s) holder of "configuration" test. list, use static {} block values added instances:
public class config{ ... public static final list<object[]> config = new arraylist<>(); static{ //object[] pairs her`e config.add(new object[] { ... whatever}); config.add(new object[] { ... whatever}); config.add(new object[] { ... whatever}); } } ... //then test class: @runwith(parameterized.class) public class generaltemplate{ ... @parameters(name = "{index}: source: {0} target: {1}") public static collection<object[]> config() { return config.config; } }
i use instances in junit test class. guess, because of definitions + annotations test runs mistake "no tests have been found"?
i think @test annotation missing templates. compiler complaining "no tests have been found" in not able find test methods junit 4 @test annotation in test class defination.
Comments
Post a Comment