On 24/12/2009, at 9:50 PM, Adam Heath wrote:

Scott Gray wrote:
I'd really rather not have this idea die with a single response, I've
done my best to describe the perceived benefits and it would be good to
get some additional feedback from anyone who is interested.

I don't care either way, however, I do have some suggestions on
implementation.

Create an ofbiz test runner, if one doesn't exist.

Yeah I was expecting to have to do this, we don't currently and as far as I can see it's the only way to interact directly with the execution of a test suite (although it's been months since I looked at this stuff).

Then, decorate the
test suite with an annotation, that says that each test should be
rolled back.  junit 4 may even have some support for doing this
automatically.

Remember we're dealing with OFBiz tests here and the test suites are defined using XML. It was my intention to roll back each test case by default unless you explicitly wrap the test cases in a test-group element, as per my original email:
Scott Gray wrote:

<test-suite>

 <test-case/>
 <!-- Rollback here -->
 <test-case/>
 <!-- Rollback here -->
 <test-case/>
 <!-- Rollback here -->

 <!-- No rollbacks inside the test group -->
 <test-group>
   <test-case/>
   <test-case/>
 </test-group>
 <!-- Rollback here -->

</test-suite>

We could add annotations to the junit-test-suite test classes but I'd prefer it we kept the test-suite documents as the single point of configuration.

There's also the possibility of nesting the rollbacks if things need to get a bit more sophisticated:
<test-group>
    <test-case name="test-1"/>
    <test-group>
        <test-case name="test-1a"/>
        <test-case name="test-1b"/>
        <test-case name="test-1c"/>
    </test-group> <!-- Rollback here to the end of test-1-->
    <test-case name="test-2"/>
    <test-case name="test-3"/>
</test-group> <!-- Rollback test-1, test-2 and test-3 -->

The main goal with all of this is to allow developers to spend more time writing tests and less time writing redundant demo data and/or test suites.

Thanks
Scott

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to