You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The most obvious way to modularize tests is to have lots of test classes. This should be the default. With JUnit rules mix-ins there's further modularization.
However, it may be the intent of a test author to create a singular test suite, which is simply too long to express in a single place. Or there may be a reusable test that, dependent on data being set up, operates differently.
Here's the proposal
Write a demonstration of dependency injecting suppliers/rules etc from the surrounding test class into a new Test class object, which writes its tests in its parameterised constructor - this is no code change for Spectrum, since you should be able to do it already
The class may be a suite or a spec - it wouldn't matter
Actually it could be a method too - any method would do
Make it easy to add in classes NOT decorated with the @RunWith(Spectrum.class) as sub-suites within the test - this allows us to weave together a user-facing suite (in terms of runner output) from several small classes.
If we add tricks like parallelised running, this sort of option will really really be useful.
// this is a super suite and it's super sweet@RunWith(Spectrum.class)
publicclassMyTest {{
include(MyOtherTest.class);
include(MyOtherOtherTest.class);
}}
The most obvious way to modularize tests is to have lots of test classes. This should be the default. With JUnit rules mix-ins there's further modularization.
However, it may be the intent of a test author to create a singular test suite, which is simply too long to express in a single place. Or there may be a reusable test that, dependent on data being set up, operates differently.
Here's the proposal
@RunWith(Spectrum.class)
as sub-suites within the test - this allows us to weave together a user-facing suite (in terms of runner output) from several small classes.If we add tricks like parallelised running, this sort of option will really really be useful.
Dependency injection
Suites
Just have an "include" keyword or something
this may be as simple to implement as
The text was updated successfully, but these errors were encountered: