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

Tests annotated using @RunWith not picked up by sbt #66

Open
dmitrimedvedev opened this issue Jan 15, 2015 · 7 comments
Open

Tests annotated using @RunWith not picked up by sbt #66

dmitrimedvedev opened this issue Jan 15, 2015 · 7 comments

Comments

@dmitrimedvedev
Copy link

This test is not picked up:

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:test-context.xml"})
public class MyTest {

but if @RunWith is commented out the test is picked up (but obviously does not work correctly)

//@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:test-context.xml"})
public class MyTest {

This is using 0.11 of junit-interface library
libraryDependencies += "com.novocode" % "junit-interface" % "0.+" % "test"
...
Resolving com.novocode#junit-interface;0.11-RC1

@donhector
Copy link

+1

In my case just using the plain Junit Parametrized.class runner

@RunWith(Parameterized.class)
public class MyTest extends BaseTest {
// code here
}

My parametrized test ran (6 of them) but in the SBT console I see contradictory results:

[info] Test run finished: 6 failed, 0 ignored, 6 total, 70.937s
[info] Passed: Total 0, Failed 0, Errors 0, Passed 0

My dependencies:
"junit" % "junit" % "4.12" % "test",
"com.novocode" % "junit-interface" % "0.11" % "test -> default"

@mknudsen
Copy link

I think I've encountered this bug in my play project which seems to use this project (if I interpret https://github.com/playframework/playframework/blob/3c530e93603d4005211d466923fff486338faf00/framework/project/Dependencies.scala correctly).

As you can see in the linked issue from the play bugtracker the tests are run (and output to the console) yet they are not counted as either passed, failed or errors.

@devosc00
Copy link

I have the same problem, when use @RunWith, I get zero value test report.
[info] Passed: Total 0, Failed 0, Errors 0, Passed 0

@mkotsbak
Copy link

mkotsbak commented Aug 5, 2015

@RunWith(SpringJUnit4ClassRunner.class) works for me (in "IntegrationTest"). Have you tried the latest sbt version 0.13.8?

@fommil
Copy link

fommil commented Mar 29, 2016

I've also seen the same problem (using org.scalatest.junit.JUnitRunner with the ScalaTest framework disabled), but it's only when the test extends from a class that has the RunWith annotation. When it's on the class directly, it works.

@kovacshuni
Copy link

Having the same issue. Having a class annotated with @RunWith(MockitoJUnitRunner.class), and sbt test doesn't run anything. Even if i comment it out, still won't run my JUnit 4 tests. I'm searching for the problem.

@kovacshuni
Copy link

managed to have it run by adding crossPaths := false in build.sbt.

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

7 participants