You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stanbol.apache.org by Fabian Christ <ch...@googlemail.com> on 2011/06/21 16:07:41 UTC

Integration tests - how to handle persisted test data

Hi,

I'm currently playing with the integration tests and trying to write
some for the FactStore that I'm working on.

Some of the tests create new Fact Schema and Facts that are stored in
a Derby database.

My question is how to proceed with the created test data after the
tests have finished. At the moment the data resides in the database
after the tests. This causes the problem that the next time the
integration tests are started some will fail because of already
existing data. The user has to call "mvn clean" which will delete the
database before starting the tests.

Is this behavior okay for our tests or is there a policy that says
that integration tests are not allowed to leave persisted data? Or
that integration tests need to be idempotent without a clean?

Best,
 - Fabian

-- 
Fabian

Re: Integration tests - how to handle persisted test data

Posted by Fabian Christ <ch...@googlemail.com>.
Hi,

at the moment the "mvn clean" already solves the problem as with clean
e.g. the sling folder is deleted.

But IMO (agreeing with Bertrand) the right solution would be that
tests are shipped with appropriate setup routines to ensure that they
always run with identical and well defined preconditions. No matter if
a user called "mvn clean" or not before.

- Fabian

2011/6/21 Rupert Westenthaler <ru...@gmail.com>:
> Hi Fabian, all
>
> A month ago I already tried to move the /sling folder from
> "{integration-tests}/sling" to the target folder e.g.
> "{integration-tests}/target/test-data/sling". But I could not find out
> how to change that and so I moved on with other things .
>
> Moving the files created by the tests under the target folder will
> automatically remove them when doing a "mvn clean" what should be good
> enough solution for this problem.
>
> best
> Rupert
>
> On Tue, Jun 21, 2011 at 6:47 PM, Fabian Christ
> <ch...@googlemail.com> wrote:
>> Okay - I will have a look tomorrow and see how to handle this.
>>
>> Thank you!
>>  - Fabian
>>
>> 2011/6/21 Bertrand Delacretaz <bd...@apache.org>:
>>> On Tue, Jun 21, 2011 at 4:18 PM, Olivier Grisel
>>> <ol...@ensta.org> wrote:
>>>> ...We should extend the integration test tooling to clean the data folder
>>>> in some kind of tearDown method (or maybe better do it in a setUp
>>>> method before running the tests)....
>>>
>>> Yes - running tests multiple times should be possible without
>>> requiring special operations.
>>>
>>> -Bertrand
>>>
>>
>>
>>
>> --
>> Fabian
>>
>
>
>
> --
> | Rupert Westenthaler             rupert.westenthaler@gmail.com
> | Bodenlehenstraße 11                             ++43-699-11108907
> | A-5500 Bischofshofen
>



-- 
Fabian

Re: Integration tests - how to handle persisted test data

Posted by Rupert Westenthaler <ru...@gmail.com>.
Hi Fabian, all

A month ago I already tried to move the /sling folder from
"{integration-tests}/sling" to the target folder e.g.
"{integration-tests}/target/test-data/sling". But I could not find out
how to change that and so I moved on with other things .

Moving the files created by the tests under the target folder will
automatically remove them when doing a "mvn clean" what should be good
enough solution for this problem.

best
Rupert

On Tue, Jun 21, 2011 at 6:47 PM, Fabian Christ
<ch...@googlemail.com> wrote:
> Okay - I will have a look tomorrow and see how to handle this.
>
> Thank you!
>  - Fabian
>
> 2011/6/21 Bertrand Delacretaz <bd...@apache.org>:
>> On Tue, Jun 21, 2011 at 4:18 PM, Olivier Grisel
>> <ol...@ensta.org> wrote:
>>> ...We should extend the integration test tooling to clean the data folder
>>> in some kind of tearDown method (or maybe better do it in a setUp
>>> method before running the tests)....
>>
>> Yes - running tests multiple times should be possible without
>> requiring special operations.
>>
>> -Bertrand
>>
>
>
>
> --
> Fabian
>



-- 
| Rupert Westenthaler             rupert.westenthaler@gmail.com
| Bodenlehenstraße 11                             ++43-699-11108907
| A-5500 Bischofshofen

Re: Integration tests - how to handle persisted test data

Posted by Fabian Christ <ch...@googlemail.com>.
Okay - I will have a look tomorrow and see how to handle this.

Thank you!
 - Fabian

2011/6/21 Bertrand Delacretaz <bd...@apache.org>:
> On Tue, Jun 21, 2011 at 4:18 PM, Olivier Grisel
> <ol...@ensta.org> wrote:
>> ...We should extend the integration test tooling to clean the data folder
>> in some kind of tearDown method (or maybe better do it in a setUp
>> method before running the tests)....
>
> Yes - running tests multiple times should be possible without
> requiring special operations.
>
> -Bertrand
>



-- 
Fabian

Re: Integration tests - how to handle persisted test data

Posted by Bertrand Delacretaz <bd...@apache.org>.
On Tue, Jun 21, 2011 at 4:18 PM, Olivier Grisel
<ol...@ensta.org> wrote:
> ...We should extend the integration test tooling to clean the data folder
> in some kind of tearDown method (or maybe better do it in a setUp
> method before running the tests)....

Yes - running tests multiple times should be possible without
requiring special operations.

-Bertrand

Re: Integration tests - how to handle persisted test data

Posted by Olivier Grisel <ol...@ensta.org>.
2011/6/21 Fabian Christ <ch...@googlemail.com>:
> Hi,
>
> I'm currently playing with the integration tests and trying to write
> some for the FactStore that I'm working on.
>
> Some of the tests create new Fact Schema and Facts that are stored in
> a Derby database.
>
> My question is how to proceed with the created test data after the
> tests have finished. At the moment the data resides in the database
> after the tests. This causes the problem that the next time the
> integration tests are started some will fail because of already
> existing data. The user has to call "mvn clean" which will delete the
> database before starting the tests.
>
> Is this behavior okay for our tests or is there a policy that says
> that integration tests are not allowed to leave persisted data? Or
> that integration tests need to be idempotent without a clean?

We should extend the integration test tooling to clean the data folder
in some kind of tearDown method (or maybe better do it in a setUp
method before running the tests).

-- 
Olivier
http://twitter.com/ogrisel - http://github.com/ogrisel