All Questions
Tagged with testng unit-testing
440
questions
0
votes
0
answers
69
views
How to correctly mock object in Java when using a helper method from another class?
My stack uses java, mocikito, junit, and testng. I'm fairly new to unit testing in general so it would appreciated if someone could explain me what's wrong with this and why in a helpful way.
I get a [...
0
votes
0
answers
29
views
Convert powermockito testcase code into testng testcase
Here I am using whenNew method in powermockito.
@Test
public void test() {
MsgTransmit msgtransmit= mockm(MsgTransmit.class);
String userId= id101;
Powermockito....
0
votes
1
answer
92
views
Mockito mock a method calls actual method
I have been trying to mock a method of a class. The method is reading a configuration from file. The file consists of a URI of a service. Method is reading URI from file and creating a WebTarget ...
2
votes
0
answers
148
views
how to make idea continue unit tests when one test failed?
I am using testng to do some unit tests. When I run it on the idea of my local windows pc, one of these unit tests failed, and the subsequent unit tests were skipped. It shows like this:
My BackGroud:...
0
votes
0
answers
153
views
Error running unit tests in intellij : Caused by: org.xml.sax.SAXParseException: Attribute "thread-count" must be declared for element type "test"
/Library/Java/JavaVirtualMachines/zulu-sa-1.8.0_232.jdk/Contents/Home/bin/java -ea -Didea.test.cyclic.buffer.size=1048576 -javaagent:/Applications/IntelliJ IDEA CE.app/Contents/lib/idea_rt.jar=52696:/...
0
votes
1
answer
174
views
How can I run the same test cases for all the data in a list using testng?
I am using data provider and test ng to run the same test multiple times using different values from a list. However, I have several tests and I want them all to run one by one so Test 1 -> Test 2 -...
1
vote
1
answer
367
views
How to run the same test on values from a list of Objects and on nested lists?
I have generated a list of Objects of type Household Object, that has a String name and a List colours, from a CSV file.
I want to run the same tests on every element in my list of Household objects.
...
0
votes
2
answers
107
views
Test System.out message printed in catch block
I would like to create a test case to test this catch block
I want to test this message "File does't exit, please put the file inside resources folder."
and FileNotFoundException exception ...
3
votes
0
answers
111
views
TestNG get the value of "test" level parameter from "ISuiteListener" class's "onStart" method
In my TestNG.xml file , I have two different values for Test level parameter, "TestRailRunId".
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM &...
1
vote
1
answer
909
views
Is it a proper way to write unit tests by mocking all the dependencies of an object under test?
Please see my example below. I've got a class (MyService) in which I'm trying to unit test a particular method (handleStudentActivity). MyService has dependencies on InputValidator and ...
0
votes
1
answer
828
views
Running test from different modules using a testng suite in maven multi module project?
I want to run unit test present in different modules of my maven project from a testng suite that contains specific test classes.
One method that i have tried is to make another module and add ...
0
votes
0
answers
465
views
How to automatically re-run failed test cases using TestNG
I tried with Retry Listener, but after the failed test case execution, rest all the test cases are executing twice(with maxRetryCount=1)
Please suggest me any solution
0
votes
1
answer
482
views
How to write TestNG annotations like 'before test, before method, before class, after class' for code
I'm new to TestNG notations, can anyone help me with how can I write down TestNG test cases (testing annotations like before test, before method, before class, after class) for the following code.
...
-1
votes
1
answer
2k
views
Golang how to unit test private method with receiver
In Go, how to unit test private method with receiver? For example, how to unit test code segment as below.
If initiate an instance of srv , then isShare is hidden through handle of the instance. So in ...
2
votes
2
answers
2k
views
Is there a way to give a specific name to test case using TestNG data providers?
I am writing unit tests in Java with TestNG 6.14.3 using @DataProvider
What I want to achieve:
I want to give each data provider case a name.
I do not want to the name to be one of the parameters but ...