consensusj icon indicating copy to clipboard operation
consensusj copied to clipboard

Use annotations to mark test Specs and/or features as @RegTest or not.

Open msgilligan opened this issue 10 years ago • 5 comments
trafficstars

Using annotations and an external Spock configuration file, we should be able to mark test Specs or feature tests as requiring RegTest mode or not.

A test that has a @RegTest annotation would only run if the current functional/integration test configuration was running against a server in RegTest mode.

See Spocklight: Including or Excluding Specifications Based On Annotations by @mrhaki.

So for example, the entire class BitcoinStepwiseSpec would have a @RegTest annotation. Whereas, BitcoinSpec would only user @RegTest on feature test methods that used generateBlock().

msgilligan avatar Sep 14 '15 01:09 msgilligan

@dexX7 Obviously this would be useful for Omni testing, as well.

msgilligan avatar Sep 14 '15 01:09 msgilligan

This is very nice! Potentially, this could also be used to get rid of the setupSpec -> !commandExists -> throw AssumptionViolatedException workarounds?

dexX7 avatar Sep 14 '15 02:09 dexX7

Well, there's another @mrhaki Spocklight article that may have a better solution for that case: Spocklight: Only Run Specs Based On Conditions.

msgilligan avatar Sep 14 '15 02:09 msgilligan

At least out of the box it's not as simple as adding:

@Requires({ commandExists('abc') })

While it works with simple expressions such as { true }, I assume this is because I'm trying to access the RPC client.

dexX7 avatar Sep 21 '15 10:09 dexX7

If the method commandExists is a static method it should work in they way you described it.

mrhaki avatar Sep 21 '15 11:09 mrhaki