Whenever I run Automated Tests on my site, all the tables get cleaned to 0 rows. Is that by design? How do I prevent them?
Update: Found the real ‘culprit’
%test.jpa.ddl=create
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
That is by design. Unit tests should not have any external dependencies on some pre-existing state such as persisted data. If you need data for testing purposes, you need to set that up in your
@Beforesetup method. For example:You should take a look at your conf/application.conf file and notice that you have a line that reads:
This is the default setting – which says that when the application is run in test mode, use an in-memory database. If you want your tests to work on persisted data (not recommended), you can change the test mode db settings. See Play test documentation for details.