Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Play should run its own tests in precompiled mode #1154

Open
asolntsev opened this issue May 26, 2017 · 15 comments
Open

Play should run its own tests in precompiled mode #1154

asolntsev opened this issue May 26, 2017 · 15 comments

Comments

@asolntsev
Copy link
Contributor

Currently play own tests are executed in DEV mode.
Thus they will not catch any errors that happen only in PROD mode (for example, see issue #1152).

I believe we should run play tests in PROD mode. It will give stronger confidence that application works in production as in test.

@flybyray
Copy link
Contributor

flybyray commented May 26, 2017

and why not just run

play precompile <appdir> --%test
play [auto-]test <appdir> -Dprecompiled=true

?
The main reason why Play! runs tests in DEV is the default of jpa ddl update, which makes sense on an empty DB for a whole auto-test run.

The above approach is used by us on jenkins runs but we also use our own liquibase module

play precompile <appdir> --%test
play lb:install <appdir> --%test
play lb:update <appdir> --%test
play [auto-]test <appdir> -Dprecompiled=true

The lb:install will just apply fresh install migrations, the lb:update will do more or less nothing on a fresh install, but creation of views (for reports) is also handled by lb:update.

@asolntsev
Copy link
Contributor Author

@flybyray Yes, you can run tests of some application this way.
But I meant tests of Play itself. To build Play framework, we use command play test. And this command should run tests in precompiled mode - this is my point.

@flybyray
Copy link
Contributor

do you mean ant test ?

@asolntsev
Copy link
Contributor Author

Oh, sorry. Yes! I meant ant test (and ant autotest).

@flybyray
Copy link
Contributor

just updated the first comment. but maybe you see reason for DEV-mode and empty db. that applies to most of the tests to. you should add jpa ddl update for prod in this case too

@flybyray
Copy link
Contributor

some tests have bootstrap jobs which load data, in case the data yaml cotains templates you will need to precompile them too (this was just fixed some tickets ago). but you need to specify those templates in application.conf

@flybyray
Copy link
Contributor

ok just checked none of the tests seem to have initial data with templates. from my point of view this is a missing code coverage

@flybyray
Copy link
Contributor

flybyray commented May 26, 2017

@kill will not work. you may also want to set system property -Dwritepid=true to have a pid file to kill the server afterwards

@Fraserhardy
Copy link
Contributor

Hi, We're trying to get coverage working on our play tests with JaCoCo. Are you aware of any way to get this working with Play framework? We're running 1.4.2 at the moment. I'm also interested to know if we can use ant directly to run tests too.

@asolntsev
Copy link
Contributor Author

@Fraserhardy As much as I know, it's not possible. The problem is that JaCoCo needs to modify bytecode of your application, but Play also modifies the bytecode of your application. Those two frameworks conflict with each other.

@Fraserhardy
Copy link
Contributor

@asolntsev Are you aware of any coverage tools that work with Play 1?

@asolntsev
Copy link
Contributor Author

asolntsev commented Feb 22, 2018 via email

@flybyray
Copy link
Contributor

Should the codecoverage only be used interactively or should it be evaluated automatically?
I noticed that Play1 uses a very outdated template for Intellij. If you have to adjust this, you can test it directly from Intellij including codecoverage (probably only Intellij Pro).
https://drive.google.com/file/d/1dNAc55tz0YpC8BywIxeLi97qBmGcxYrG/view?usp=sharing

@Fraserhardy
Copy link
Contributor

@flybyray Even within IntelliJ would be a massive bonus at the moment. We have had mixed success with test running direct in IntelliJ so far but I'll certainly try those steps from the video. Sounds like we need a PR to fix the Intellij template for Play then?

@flybyray
Copy link
Contributor

flybyray commented Mar 1, 2018

the templating for various ides is outdated.
at all the global movement to real modular systems should be better reflected in play.

take the eclipse templates for example. create a project with a module. add tests to your module.
from command line tools of play it is valid to have module tests. in eclipse not???

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants