Skip to content

Integration tests written in Python #224

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

Closed
krishhnaiyer opened this issue Jun 20, 2017 · 6 comments
Closed

Integration tests written in Python #224

krishhnaiyer opened this issue Jun 20, 2017 · 6 comments

Comments

@krishhnaiyer
Copy link

Hi All,

I am trying to measure code coverage for my Scala application. What are the steps to be followed to get code coverage using scoverage when integration tests are written in Python?

@gslowikowski
Copy link
Member

Hi

Main classes must be written in Scala to be instrumented by Scoverage during compilation. Test classes can be written in any language, or you can run your instrumented application and test it manually.

I wonder, how does your build look like, but generally you need to:

  • run sbt coverage test (or sbt coverage compile if you have no Java/Scala tests, only Python ones)
  • run your Python tests the way you do it
  • run sbt coverageReport

@krishhnaiyer
Copy link
Author

krishhnaiyer commented Jun 27, 2017

Hi,

Main classes are written in Scala.
I am trying to run my tests on docker but the server starts and stops immediately before running the tests with the following log in Jenkins console,

--- (Running the application, auto-reloading is enabled) ---

[info] p.c.s.NettyServer - Listening for HTTP on /0:0:0:0:0:0:0:0:9002

(Server started, use Ctrl+D to stop and go back to the console...)

[info] p.c.s.NettyServer - Stopping server...

The following command is issued to start the server with scoverage enabled:
activator -Dsbt.override.build.repos=true -Dsbt.repository.config=./repositories -Dsbt.log.noformat=true clean coverage "run 9002" &

@gslowikowski
Copy link
Member

Does it work locally? Does it work remotely without coverage?

@krishhnaiyer
Copy link
Author

krishhnaiyer commented Jun 29, 2017

It works locally and remotely "sbt coverage test" runs the tests.

I guess the problem here is sbt coverage "run 9002" is stopping the server before executing the next commands from the script

@krishhnaiyer
Copy link
Author

krishhnaiyer commented Jun 30, 2017

I am able to resolve this issue by compiling the application first and then deploying the application

  1. activator -Dsbt.override.build.repos=true -Dsbt.repository.config=./repositories -Dsbt.log.noformat=true clean coverage dist (Ran locally on my system)
  2. bin/test-project -Dhttp.port=9002 & (Copied the generated zip file to docker and deployed the application)

I ran into java.io.FileNotFoundException issue while deploying the locally built application on docker.

java.io.FileNotFoundException: /Users/krishhna/test-project/target/scala-2.11/scoverage-data/scoverage.measurements.1

Since its the target folder it was not packaged into the dist created.
Is there any other way to package this file into dist for scoverage to pick up?

@ckipp01
Copy link
Member

ckipp01 commented Nov 4, 2021

Seeing that this is very old, I'm going to close this as stale. If you still have questions on this scenario, please do report back and we can open this back up.

@ckipp01 ckipp01 closed this as completed Nov 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants