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

Running tests (junit/specs2/scala) misses some of them #98

Closed
ittaiz opened this issue Jun 14, 2017 · 8 comments
Closed

Running tests (junit/specs2/scala) misses some of them #98

ittaiz opened this issue Jun 14, 2017 · 8 comments
Assignees

Comments

@ittaiz
Copy link
Member

ittaiz commented Jun 14, 2017

Hi,
I have a basic example project for bazel and scala.
When I try to run a test target which has a few tests (2 junit and 1 specs2) I see:
screen shot 2017-06-14 at 15 14 10
If we look at the bazel test.xml output we do see all three of them (rename the test.xml.txt to test.xml as github doesn't allow xml).
test.xml.txt
If I change the package of SomeJunit2Test (which is missing) from src.test.java.com.example to com.example it starts appearing.
The Specs2 test doesn't appear at all and I think there is a correlation between them since its testsuite name is also unorthodox.

Bazel console shows no errors and so does the problems view.
Versions:
rules_scala: 5d6ff512652b8b55f5d26f6ea69e05d86582d996 (this morning)
Intellij bazel plugin: 2017.05.08.1
Bazel: 55f40c8ea4f1e7bf81552bfe4377e26768e85f2c (June 6th)
Intellij:
IntelliJ IDEA 2017.1.2
Build #IU-171.4249.39, built on April 25, 2017
JRE: 1.8.0_112-release-736-b16 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Mac OS X 10.11.6

@natansil
Copy link

I also recreated this.
If I have two different test targets (one for each test class), than both are run,
but if I merge the targets to one test target with glob(["*.scala"]) than only one test class is run.

@ittaiz
Copy link
Member Author

ittaiz commented Jun 14, 2017 via email

@chaoren chaoren self-assigned this Jun 15, 2017
@chaoren
Copy link
Collaborator

chaoren commented Jun 15, 2017

It has nothing to do with the package name either.

<testcase name='passingTest2' classname='src.test.java.com.example.SomeJunit2Test' time='0.0' />

We check if status='run' is present or time= is greater than 0 to determine if a test is run.
Time is 0 in this case so the bazel plugin thought the test wasn't run.
Can you make sure bazel was actually running this test? Add a loop or something.

@chaoren
Copy link
Collaborator

chaoren commented Jun 15, 2017

This happens in java too if the test runs too fast. I'll file a bug with bazel to set status='run' for test cases.

@ittaiz
Copy link
Member Author

ittaiz commented Jun 15, 2017

I see. This means that we'll need to wait for the next release, right?

@ittaiz
Copy link
Member Author

ittaiz commented Jun 15, 2017

Also,
I tried adding Thread.sleep(1000L) in both SomeJunit2Test and the Specs2 test and didn't see them show up

@chaoren
Copy link
Collaborator

chaoren commented Jun 15, 2017

I tried the same, but the test xml still says time='0.0'.

@chaoren
Copy link
Collaborator

chaoren commented Jul 10, 2017

Filed this for the 0.0 time vs not run issue: bazelbuild/bazel#3201
The Thread.sleep(1000L) still producing time='0.0' in the xml is a problem with the scala test runner. We just read the xml.

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