Publicado por Unknown en 3:12 p. m.

Spring Data application using Docker with Arquillian Cube. The test looked like: In previous post , I wrote about how to testapplication usingwith. The test looked like:





This test just starts Redis container, then populate data using restTemplate and post method, then execute the logic under test (testing GET HTTP method) and finally stop the Redis container.





It is good, it works but there are several problems there:

The first one is that we are using REST API to prepare data set of the test. The problem here is that the test might fail not because a failure on code under test but because of the preparation of the test (insertion of data).

to prepare data set of the test. The problem here is that the test might fail not because a failure on code under test but because of the preparation of the test (insertion of data). The second one is that if POST endpoint changes format/location, then you need to remember to change everywhere in the tests where it is used.

endpoint changes format/location, then you need to remember to change everywhere in the tests where it is used. The last one is that each test should leave the environment as found before execution, so the test is isolated from all executions. The problem is that to do it in this approach you need to delete the previous elements inserted by POST. This means to add DELETE HTTP method which might not be always implemented in endpoint, or it might be restricted to some concrete users so need to deal with special authentication things.