So I have just created a geb script that tests the creation of a report. Let's call this Script A
I have other test cases I need to run that are dependent on the previous report being created, but I still want the Script A
to be a stand alone test. we will call the subsiquent script Script B
Furthermore Script A
generates a pair of numbers that will be needed in subsequent scripts (to verify data got recorded accurately)
Is there a way I can setup geb such that Script B
executes 'Script Aand is able to pull those 2 numbers from
Script Ato be used in
Script B`?
In summary there will be a number a scripts that are dependent on the actions of Script A
(which is itself a test) I want to be able to modularize Script A
so that it can be executed from other scripts. What would be the best way to do this?
For reuse and not repeating yourself I would put the report creation into a separate method call in a new class such as ReportGenerator, this would generate the report given a set of parameters (if required) and return the report figures for use in whatever test you like.
You could then call that in any spec you want, with no reliance on other specs.