Testing game graphics - tuning and disruption - how?

I started using playframwork (scala) and I am writing some tests. Before starting them, I would like to add some mock data to my db (mongo), and later, when the tests are finished, delete this data. I have code to place / delete this data, but I can’t figure out how to do it sequentially before / after running the tests.

I am using the specs2 testing library that comes with playframework but could not find any documents on how to do this with the specifications.

Do you know how this can be done using specifications? or can recommend another well-known test lib for playframework that I should use instead of specs?

+4
source share
2 answers

I have not tested it, but from the document, Specs2 seems to support the Before / After approach: http://etorreborre.imtqy.com/specs2/guide/org.specs2.guide.Structure.html#Before%2FAfter

+2
source

You can find some examples here on GitHub . This is from my favorite project written in Scala using Play Framork version 2.1.0.

The key role is as follows:

"Application" should { "work from within a browser" in { running(TestServer(3333), HTMLUNIT) { browser => 

It launches the Play application on port 3333. Before that, you can add the code for your test devices, etc.

If you want sytem to assign a free port for tests, you can look here .

0
source

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


All Articles