Details
-
Type:
Improvement
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: 2.3-M2
-
Component/s: None
-
Labels:None
Description
This issue relates to https://issuetracker.springsource.com/browse/STS-551
In order to implement proper integration with STS Eclipse and providing GUI feedback about test runs (run via various forms of the "grails test-app" command, the event model needs to be extended.
Rationale: the Eclipse JUnit view works roughly as follows:
Phase 1: populate the view showing which tests will be run
Phase 2: while the tests, are running provide visual feedback
- progress bar
- view is update as each individual test starts completes/fails
The GrailsBuildListener infrastructure which publishes test events comes close to filling the needs to be able
to hook Grails up to the viewer. In particular, it provides enough information to implement what is required for
Phase 2.
However, it provides no information for Phase 1, to populate the view before the tests are run.
To meet the requirements of the UI it would be nice if the following changes were made to the "_GrailsTest.groovy" script.
1) One extra event type should be published:
event("TestSuitePrepared", [suite, type.name])
Here 'suite' should provide a reference to an instance of the Junit4 'Runner' type (e.g. a Suite instance).
type.name is the name of the 'test phase/type' e.g. "unit", "integration", ...
Alternatively (even better!) if the suite should contain "type.name" as its displayName the second parameter is not needed
(Currently, I believe the grails code sets this name to 'null').
2) change the processing order in the script
All suites for all phases should be constructed before any of them are being executed (so that UI view can be populated with all tests before anu tests are executed).
To be precise. Currently processing order is roughly as follows:
prepare unit tests suite
execute unit tests suite
prepare integration tests suite
execute integration tests suite
...
It should be as follows:
prepare unit tests suite
=> event("TestSuitePrepared", [suite, "unit"])
prepare integration tests suite
=> event("TestSuitePrepared", [suite, "integration"])
execute unit tests suite
execute integration tests suite
I have already implemented a modified version of the script and something that uses the extra events to drive the JUnit Eclipse UI, it works...
So I know that given something on the grails side that provides these extra events is sufficient to implement the integration with Eclipse.
However, I have little trust in the correctness of my hacked-up version of _GrailsTest.groovy. In particular, to be able to create the suites,
without making big changes to how they are represented, I had to change the order in which the gant 'prepare' 'run' 'cleanup' targets are called, and I fear that this means application contexts wouldn't be setup properly if there are more than one test-phase that sets up an application context.
I'm attaching my version here just to give an idea of what it is that I want. I've tried to include as much comments and explanation in the code to explain what I was trying to do as possible.
I'm available for further discussion and will be watching this issue.
I thought a bit more about this. Implementing the requirements I have outline in this issue may be a bit tricky because of the reordering of prepare-execute-cleanup. As a compromise, it would be much easier to just add the extra "TestSuitePrepared" event. The changes to grails to accomplish that would be minimal. But it would be sufficient to get integration tests (by themselves) running nicely with the UI viewer. What it it will not do is allow running versions of the test-app command that execute tests from multiple test phases with the UI viewer.
So, if getting both of my requirements above implemented seems like too tall an order, just implementing requirement one would already be useful.