Skip to main content

All Questions

0 votes
0 answers
65 views

Migration from TestNG to JUnit4 - dealing with static methods required by junitparams @Parameters annotation

I have a problem with migration of some tests from TestNG to JUnit. This is how the tests were looking before I have tried to migrate them: @Autowired private ContentRepository contentRepository; @...
hc0re's user avatar
  • 1,976
0 votes
1 answer
2k views

NullPointerException thrown when Mocking a service method call (from an internal forEach loop), what is the correct way to implement this mock?

I have a very basic Spring Boot application. It consists of a Controller a Service and a Repository. I want to test the Controller which basically just calls the Service, which in turn calls the ...
mal's user avatar
  • 3,192
0 votes
2 answers
223 views

Using jira key as part of the unit test case name

my project is entering a system test phase. I would like to introduce the practice of every bug leading to code change to be supplemented with relevant Unit Test testing the modification. I was ...
Alexander Petrov's user avatar
0 votes
0 answers
139 views

Could Spring be used as Auto Mocking Container?

Looking other technologies than Java, I came accross the 'Auto Mocking Container' strategy. An easy to use integration of Mockito and Spring (and for TestNG, since it's my preference over Junit) ...
Gauthier Peel's user avatar
0 votes
0 answers
776 views

java.util.logging.LogManager.readConfiguration -- java.lang.Error: Can't find java.home?

Getting following error while running UT cases in TestNG: FAILED: TC1 java.lang.Error: Can't find java.home ?? at java.util.logging.LogManager.readConfiguration(LogManager.java:1295) at java.util....
quintin's user avatar
  • 838
32 votes
4 answers
66k views

assertEquals, what is actual and what is expected?

I always wondered what exactly is the meaning of actual and expected in assertEquals in libraries like TestNG. If we read the Java Docs we see: public static void assertEquals(... actual, ... ...
insumity's user avatar
  • 5,421
1 vote
1 answer
3k views

How would you implement so each Test class logs output to a separate file?

Using Java, with either TestNG or JUnit, if you wanted to log some information gathered during a test to a file, and have each test class (such as TestClass1.class) keep a separate output file named ...
djangofan's user avatar
  • 29.4k
2 votes
2 answers
846 views

TestNG for Unit testing on Android to test Asynchronous methods

I'm working on Unit testing of a Library for Android platform. We used JUnit, and we find some issue with asynchronous method testing. Issue - We have a method for ex - Func1() in a library, which ...
user1117058's user avatar
0 votes
0 answers
1k views

TestNG tests don't run in Maven Project alongside JUnit4 projects

This is a project that uses both TestNG and JUnit4. I am not able to run the TestNG test suite for any reason. The error stack trace is given below. -----------------------------------------------...
Kartik's user avatar
  • 2,601
1 vote
3 answers
1k views

JUnit vs TestNg - For a New Project that using Spring MVC

Looking at the latest versions of JUnit[v 4.11] and TestNg[v 6.8.5] as of today, I see no big differences in both the frameworks. If I am using Spring MVC in my project and have several layers and ...
jagamot's user avatar
  • 5,416
48 votes
12 answers
38k views

How to execute JUnit and TestNG tests in same project using maven-surefire-plugin?

Right now I have both type of tests but when I say "mvn test" it only executes TestNG tests and not Junit. I want to execute both one after another. Any Idea ?
ravinikam's user avatar
  • 3,686