tempto
tempto copied to clipboard
Allow a subset of tests to not have all of the requirements defined
If you specify a requirement for one test file, all other tests will have those requirements fulfilled as well. If you want to specifically write a test without that requirement, the test will work if you run it individually, but not if you run the whole suite.
You could solve this issue by having another test suite, but if you start getting a lot of interdependencies, it would start getting complicated (and you'd have a lot of test suites).
Does setting requirements per each test individually solve this? Can you write how you would like to set the requirements to tests to solve your issue? Because, as I understand your problem, such code as below is handling your case:
class Test extends ProductTest {
@Requires(SomeRequirement.class)
public void testOne() {
...
}
public void testTwo() {
...
}
}
So testTwo is running with no requirements fulfilled.
Hmm, when I had two different test classes, all of the TD foreign servers were loaded for each of the classes (even those classes that weren't annotated with @Requires(SomeForeignServers)). Is that expected?
As I understand ForeignServers are requirements for custom fulfiller and this fulfiller has to be executed on suite level (like immutable table fulfiller) and so it is executed before all tests for requirements from all tests. Because of that tests which does not need SomeForeignServers will have them created.
So this is kind of a conflicting requirements a feature that is not yet supported. That two tests require two different things where one cannot exists together with the other. Here one test requires to have SomeForeignServers always created, the other requires SomeForeignServers to be not created.
Other option would be to change the fulfiller to work on a test level, then each requirements will be fulfilled before each test, but as I understand will make running tests much much longer.