Integration tests with Play Framework without using fixtures

I am trying to set up automatic integration tests for a new project. Stack Used:
Play! Structure
SOAP Web Services
Relational database

Since I want to write integration tests, I need to manage the data that is in my database, usually this is done using the Fixtures integrated in the gaming infrastructure. But since I do not use the Play Play framework model, this is not possible.

Also, if you have tips on maintaining a test dataset?

In addition, if I do integration tests of my entire stack, I should (ideally) make them outside of the Play project, then I will lose the benefits of the game’s testing tools. Should I keep them on the Play project?

If I create a new project only for these tests, you have any tips on using this tool: selenium, htmlunit, ...

Thanks for the help for any help!

+4
source share
1 answer

Testing is a very important part of the software life cycle, but it is always underestimated or ignored. In general, it is recommended that device tests should not be dependent on data or a database, but integration tests are slightly different from each other and generally require a sufficient data set.

Ideally, for integration tests, there should be an integration server that has the proper database and sufficient data. If you do not have an integration server, all the same tools in the Play Framework is the easiest and easiest way to have the correct data before testing.

There are three types of tests in the Play Framework. Unit and functional tests are JUnit tests, and Selenium tests are also known as acceptance tests. All of these concepts are actually outside the core Play Framework model, with the exception of some really handy recipes. Therefore, to be honest, I could not understand the concerns about using this structure. For example, you can use your own Selenium syntax or use the tags #{selenium /} .

Lamps are also very convenient, and if you use them efficiently, they are very useful. I mean, you can share your data, i.e. users.yml, products.yml, etc., and download them yourself, and this gives you flexibility in your tests.

Until now, if you are not sure that you are using lights, than you could consider a data layout, but I do not prefer the data layout in integration tests. Here is an example of the mocking test data, and this is beyond the scope of the Play Framework;)

Mockito

To be honest, I don’t have the opportunity to play in the library, but if you have time, you should try.

Hope this answer helps you.

+1
source

Source: https://habr.com/ru/post/1401852/


All Articles