Search code examples
fitnesse

FitNesse: Alternative for nested SuiteSetUps that maintains ordering


We have a FitNesse/HSAC project with a bunch of tests that are structured essentially as follows:

  • TopSuite
    • SubSuite1
      • [tests]
    • SubSuite2
      • [tests]
      • SuiteSetUp
    • SubSuite3
      • [tests]
    • SuiteSetUp

SubSuite2's SuiteSetUp performs a particularly slow GET request using JsonHttpTest, and all tests in SubSuite2 do checks on the response of that request.

We chose to perform the request in a SuiteSetUp because FitNesse will run it right before the relevant test(s) in all these three cases:

  1. When running one of SubSuite2's tests individually
  2. When running SubSuite2 as a suite
  3. When running TopSuite as a suite

However, nesting SuiteSetUps like this changes the test execution order as reported in FitNesse issue #131, which was closed as a WONTFIX.

This order change is undesirable in our case, as it makes the test reports hard to read/navigate and confuses both us and the client we're writing the tests for.

We would like to maintain execution order while still doing the slow request at most once, no matter how we run the tests.

Possible solutions I've come up with are:

  • Replace the nested SuiteSetUp with a test named to sort before all other tests in the suite. This way, it is executed at the right moment without changing the execution order, but it's only executed in case 2 and 3
  • Extend JsonHttpTest to be able to cache responses so that the request is only actually performed once. This works for all three cases but requires some Java code changes that may break on updating HSAC*
  • Note that moving the slow GET request to the global SuiteSetUp isn't desirable, as it would also be executed when running only tests outside SubSuite2
  • Note that combining all of SubSuite2's tests in a single one isn't desirable either, as the number of checks performed in this suite is sufficiently large to make such a test unwieldy and slow

I can't help but feel that there should be a way to solve this for all three cases without Java coding.

I googled extensively, but could not find any appropriate solution.

I've been racking my brain about this problem for hours, so an outside perspective would be most welcome :)

Note: Additionally, we'd like to do |show|response| somewhere so we can debug things if they go wrong, but the response is so large that just showing it takes FitNesse multiple seconds.

Only showing the response in the SuiteSetUp makes it easy to find while minimizing delay, while this solution makes it less trivial where to show the response.


Solution

  • Should be possible with FitNesse 20190628 (and higher) and add !define ALL_UNCLE_SUITE_SETUPS {true} to your top-level suite