‘No JUnit tests found’ in Eclipse

Right Click on Project > Properties > Java Build Path > Add the Test folder as source folder. All source folders including Test Classes need to be in Eclipse Java Build Path. So that the sources such as main and test classes can be compiled into the build directory (Eclipse default folder is bin).

How do I test a class that has private methods, fields or inner classes?

Update: Some 10 years later perhaps the best way to test a private method, or any inaccessible member, is via @Jailbreak from the Manifold framework. This way your code remains type-safe and readable. No design compromises, no overexposing methods and fields for the sake of tests. If you have somewhat of a legacy Java application, and you’re not allowed to change … Read more

Getting “Skipping JaCoCo execution due to missing execution data file” upon executing JaCoCo

jacoco-maven-plugin:0.7.10-SNAPSHOT From jacoco:prepare-agent that says: One of the ways to do this in case of maven-surefire-plugin – is to use syntax for late property evaluation: Note the @{argLine} that’s added to -your -extra -arguments. Thanks Slava Semushin for noticing the change and reporting in the comment. jacoco-maven-plugin:0.7.2-SNAPSHOT Following jacoco:prepare-agent that says: [org.jacoco:jacoco-maven-plugin:0.7.2-SNAPSHOT:prepare-agent] Prepares a property pointing to the JaCoCo runtime agent that can be passed as … Read more

Eclipse No tests found using JUnit 5 caused by NoClassDefFoundError for LauncherFactory

You ran into Eclipse bug 525948 which has already been fixed and which will be published in the upcoming release Oxygen.3 (4.7.3), March 21, 2018. As workaround, put your test code in a separate project and add the project under test to the modulepath, but do not add a module-info.java to your test project. With your project, class and module naming, … Read more

org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms

I’m trying to run a Junit Test case which i exported from Selenium IDE. Im getting above exception.I’m using Windows XP,Firefox 20.0.1,and using selenium-server-standalone-2.28.0.jar.Upon run, a blank Firefox window is opened. When I close that window i get below exception in console This exception in JUnit Failure trace