Questions tagged [junit-runner]

The JUnit runner checks, makes and launches the unit tests.

The default runner implementation guarantees that the instances of the test case class will be constructed immediately before running the test and that the runner will retain no reference to the test case instances, generally making them available for garbage collection

124 questions
3
votes
1 answer

Running Parameterized Tests with JUnitCore

Is it possible to run a parameterized test class with JUnitCore API? I've a class under test called Fibonacci, a parameterized test class called TestFibonacci, and a simple Java class (JUnitParameterized) which executes the TestFibonacci class using…
josecampos
  • 851
  • 1
  • 8
  • 25
3
votes
1 answer

What is the difference between SureFire JUnitCore and JUnit4 Runners

Maven surefire has JUnit4 Runner http://maven.apache.org/surefire/surefire-providers/surefire-junit4/index.html JUnitCore Runner http://maven.apache.org/surefire/surefire-providers/surefire-junit47/index.html What is the difference between…
qwazer
  • 7,174
  • 7
  • 44
  • 69
3
votes
2 answers

How RobolectricTestRunner create a Robolectric.application?

I need to customize the RobolectricTestRunner from Robolectric project, but I found a strange behaviour that I don't understand: RobolectricTestRunner contains the methodBlock which calls setUpApplicationState(bootstrappedMethod,…
M-S
  • 617
  • 7
  • 19
3
votes
7 answers

How to parameterize junit Test Suite

Is it possible to parameterize a TestSuite in junit 4 ? For declaring a class as a test suite I need the annotation @RunWith(Suite.class), but the same annotation is also needed to declare the test as parameterized: @RunWith(Parameterized.class) so…
Sergio
  • 8,532
  • 11
  • 52
  • 94
3
votes
1 answer

Junit Test Case constructor calls in parameterized runner

I wrote a long parameterized test, one of whose parameters is a constructor call with double-brace syntax to construct a different object for each row of the 2D array: Object[][] data = new Object[][] { { 1, 2, 3, new Blah() {{ setA(); }} } { 1, 2,…
orbfish
  • 7,381
  • 14
  • 58
  • 75
3
votes
2 answers

Using JUnit @Rule in Eclipse's JUnit runner

Eclipse 3.7.2 I just implemented an @Rule in some JUnit 4 tests, but when I run them in Eclipse the MethodRule methods are not being called. It's like the Eclipse test runner doesn't recognize the @Rule implementations and doesn't do anything…
E-Riz
  • 31,431
  • 9
  • 97
  • 134
2
votes
2 answers

How to create a XML report by executing a JAR

I want to develop a stand-alone test-solution delivered as a jar that can be used in a CI/CD environment without being recompiled all the time. Therefore I packed a fat-jar from a multi-maven-module containing a few libaries, a Spring Boot…
froehli
  • 904
  • 1
  • 11
  • 35
2
votes
0 answers

Using Parameterized.Parameter in junit 4.13

I am getting a "cannot resolve symbol Parameter" in the impor. I have to use using junit 4.13, I think this code would work in junit 4.12. What changes can I make to get the following code to work? import org.junit.Test; import…
abc123
  • 21
  • 1
2
votes
2 answers

JUnit 5 with Ant junitlauncher: NoClassDefFoundError: org/junit/platform/launcher/core/LauncherFactory

i would like to execute junit5 tests in combination with ant, specifically junitlauncher here is my project structure: and here is my build file:
rome
  • 476
  • 1
  • 9
  • 19
2
votes
0 answers

How can I programmatically run all my unit tests within my app and email failed tests list

I have a requirement I must email list of all my failed tests within my maven spring batch application to my PO in daily manner. Unfortunately I do not have access to any deployment tools like Teamcity so that I could set-up such warning emails. I…
MD. Mohiuddin Ahmed
  • 2,092
  • 2
  • 26
  • 35
2
votes
1 answer

How can I pass a CategoryFilter to the JUnitcore?

How can I dynamically build a category filter and invoke the JUnit core to run my tests? I'm trying to build a simple class with a main method that can be invoked to run my tests but I'm sure if this is a clean way. The idea was to allow the…
Mridang Agarwalla
  • 43,201
  • 71
  • 221
  • 382
2
votes
2 answers

How to use scalacheck prop generators in scalatest FlatSpec

I'm trying to use the scalacheck property generators in a scalatest.FlatSpec test file. The test should fail and be reported by junit framework (and eclipse in my case) but the test pass and error is just displayed in console. import…
raisercostin
  • 8,777
  • 5
  • 67
  • 76
2
votes
1 answer

MethodSorter Name_Ascending not running in order

I know unit tests should be flexible enough to be run in different order. But I have situation where I would want my test cases to run in a specific order. In this scenario I am testing my controllers with fakeApplication and FakeRequest of…
rogue-one
  • 11,259
  • 7
  • 53
  • 75
2
votes
1 answer

How do I stop @Unrolled Spock tests from showing up as "Unrooted Tests" in the Eclipse Junit View?

A coworker has recently introduced Spock unit testing into our team's project, and I'm having an annoying problem with its Eclipse integration: whenever we create a parametrized test and use the @Unroll annotation on it, the Eclipse JUnit view loses…
Kaypro II
  • 3,210
  • 8
  • 30
  • 41
2
votes
2 answers

what is the best place to verify if an external system is available before executing tests?

We are using JUnit to execute integration tests and also the system integration tests which rely on external test systems (not necessarily maintained by our own company). I wonder where to put the code that checks if the system is available prior to…
wemu
  • 7,952
  • 4
  • 30
  • 59
1 2
3
8 9