Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [junit]

Popular unit testing framework for Java and Scala. The latest version, JUnit 5, supports rich annotation-based and parameterized tests. Consider using in conjunction with the Java or Scala tag to indicate your use case.

9,009 questions with no upvoted or accepted answers
15 votes
1 answer
1k views

How to automate upgrade testing for android

We have been using espresso for android automation, and that includes upgrade testing For upgrade testing, we need to perform 3 steps: Make some actions in the old version to prepare some data ...
Sugre's user avatar
  • 861
12 votes
1 answer
2k views

PowerMockito VerifyStatic not working in 2.0.0-beta5

I am getting an issue using powermockito (2.0.0-beta5) to verify a static method was called a certain number of times when I call a different (also static) method. The classes are prepared for test ...
jbird's user avatar
  • 506
12 votes
1 answer
2k views

Mock FingerprintManager in Android tests

Is there a way to simulate or mock FingerprintManager.authenticate()? I want to write instrumented tests for my fingerprint authenticator. I'm fine if there's a solution with a restriction that the ...
Juuso Ohtonen's user avatar
12 votes
1 answer
8k views

Jenkins xUnit test result report

I have a Jenkins job to copy some test reports(XML) to local and convert them to JUnit reports via xUnit. The issue is that there are no failed or skipped tests, but I always get [xUnit] [INFO] -...
Jay Cui's user avatar
  • 137
12 votes
1 answer
527 views

How should a custom Guice scope be integrated with TestNG?

We use a custom Guice scope, @TestScoped, for some of our JUnit tests that lasts for a single test method, and a JUnit @Rule to enter and exit the scope appropriately. It looks like this: public ...
Tavian Barnes's user avatar
12 votes
1 answer
3k views

Running JUnit tests with Hadoop 2.2 on Windows 7

I'm trying to run a simple JUnit test with Hadoop 2.2. on my Windows 7 machine. I have an exemplary test available at http://grepalex.com/2012/10/20/hadoop-unit-testing-with-minimrcluster/ so I'm ...
Jakub's user avatar
  • 3,129
10 votes
0 answers
884 views

Android Studio runs Instrumentation tests as Junit Tests

I have my instrumentation tests located in a separate module. I have applied the plugin "com.android.test" in build.gradle file and when I call gradle connectedCheck, the tests in the main source set ...
Codebender's user avatar
  • 14.4k
10 votes
1 answer
3k views

Robolectric + PowerMock + Mockito not working

I'm struggling to get this rare combination works, but I haven't got luck. My project uses JUnit + Mockito + Robolectric for testing and Roboguice for injection, when I added PowerMock to the equation ...
JavierSP1209's user avatar
9 votes
0 answers
924 views

Firestore local junit tests

Is there a library to get a mocked version of Firestore for local unit tests like the one for google app engines datastore: private final LocalServiceTestHelper helper = new ...
user1185087's user avatar
  • 4,748
9 votes
3 answers
1k views

Using PowerMock causes java.lang.VerifyError exception

The following causes an exception at runtime: import com.sun.net.httpserver.HttpServer; import org.junit.runner.RunWith; import org.powermock.modules.junit4.PowerMockRunner; import java.net....
traveh's user avatar
  • 2,779
9 votes
0 answers
2k views

Robolectric test runs in Android Studio, but not by gradle in the console

I recently updated a few libraries in my gradle file, and as a result, some (but not all) of my unit tests fail when I run them in the console by "./gradlew clean test". However, all my tests pass ...
happyhuman's user avatar
  • 1,591
9 votes
1 answer
3k views

Misterious `classMethod` test in Gradle Scala unit testing with JUnit 4

I'm having an issue with Gradle, JUnit and Scala test execution, in our Scala language extension for Vert.x. Recently we upgraded from Vert.x 2.1.RC1 to 2.1.RC2, we started seeing that in some ...
Galder Zamarreño's user avatar
9 votes
1 answer
2k views

How to execute junit Rules inside AbstractTransactionalJUnit4SpringContextTests transaction?

I want to do some database operations INSIDE the test method transaction. I would like to use junit TestRules for this. But the rules are executed outside of the transaction. Is there any way to have ...
Janne Mattila's user avatar
8 votes
1 answer
521 views

Example for replacement for InstrumentationRegistry.getContext()

With AndroidX the InstrumentationRegistry is now deprecated. The documentation states This method is deprecated. In most scenarios, getApplicationContext() should be used instead of the ...
DoDo's user avatar
  • 2,386
8 votes
1 answer
2k views

Cypress mocha-junit-reporter - pass test filename to reporter output filename

I'm using Cypress to run a suite of automated tests. The current version of cypress provides mocha-junit-reporter out of the box, and provides configuration options to pass to the reporter. One of the ...
mjg's user avatar
  • 181

15 30 50 per page
1
2 3 4 5
601