Skip to main content

All Questions

Tagged with
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 [...
aisy's user avatar
  • 1
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....
Keerthi Senthil's user avatar
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 ...
user82504's user avatar
  • 111
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:...
Lucien Evans's user avatar
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:/...
Mehul Parmar's user avatar
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 -...
Lemonand09's user avatar
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. ...
Lemonand09's user avatar
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 ...
Jack's user avatar
  • 11
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 &...
Sameera De Silva's user avatar
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 ...
Master Po's user avatar
  • 1,657
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 ...
kanika's user avatar
  • 1
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
Geeta SH's user avatar
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. ...
Mashhood 's user avatar
-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 ...
lee's user avatar
  • 121
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 ...
Itzhak Eretz Kdosha's user avatar

15 30 50 per page
1
2 3 4 5
30