Questions tagged [testng-annotation-test]

Test Annotations: The @Test annotation marks a class or a method as part of the test.

@Test Annotation: The @Test annotation marks a class or a method as part of the test.

Documentation: TestNG

75 questions
1
vote
1 answer

Cucumber tags as TestNG group in QAF and Spring boot environment

I have 4 tests in a feature file with 2 different tags @first and @then. I would like @first tests to run first with parallelism and @then tests to run after all @first tests finished, with parallelism too. The project is here…
marie
  • 457
  • 8
  • 27
1
vote
1 answer

How to execute a non compiled testNg test case in Java web application programmatically?

I am running test cases (TestNg testcases) programmatically, using java, by creating testng xml through code. Running Perfectly okay. Problem: I want to execute testcases which are being uploaded live, meaning my server is running and I am uploading…
1
vote
0 answers

Using @Factory and @DataProvider in TestNG with a map to iterator

I want to iterate through the excel sheet and get data using @dataprovider Then want the methods to executed in the following pattern using @Factory and @dataProvider the data type the @dataProvider returns is This is the execution pattern I…
1
vote
1 answer

TestNG&Allure: stop test execution after 1st failure

I have a flaky test which fails once per 10-20 attempts because of intermittently reproducible bug. I'd like to have this test to be marked as Failed after first failure. No further retries needed. This is how the Test annotation looks like: …
1
vote
2 answers

TestNG - Order of Tests execution in selenium script

I'm using selenium 3.8.1 and TestNG 6.9.2 version,while test execution before completing the @Test method another @Test method is starts,because of this i'm getting error in selenium script After completion of Test Cases execution. One Class public…
0
votes
1 answer

@Before and @After annotations execution order for and tag in groups

In a testing.xml file, when executed with and tag, it has different behavior in execution @Before and @After annotations and kindly confirm if this is how it is designed. I have a below BaseClass file with annotation defined for @BeforeSuite,…
Ramkumar
  • 116
  • 1
  • 11
0
votes
0 answers

Cannot inject @Test annotated Method [OrderHistory] with [class java.lang.String]

I am having issue with this error. it used to work fine earlier. then now i am learning on TestNG extentreports and Listeners. created those classes and all. now this error is bothering me. Cannot inject @Test annotated Method [OrderHistory] with…
Nirali
  • 1
  • 1
0
votes
1 answer

WARNING: Connection reset java.net.SocketException: Connection reset

Apr 04, 2023 7:43:38 PM org.openqa.selenium.remote.http.WebSocket$Listener onError WARNING: Connection reset java.net.SocketException: Connection reset at java.base/sun.nio.ch.SocketChannelImpl.throwConnectionReset(SocketChannelImpl.java:394) …
0
votes
0 answers

Dataprovider and TestNG: Is there a way to access next row data to compare with current row?

For example I have an row1, row2, row3 and I want to compare col1 data for each @Test(dataProvider = "Login") public void someTest(String num) throws InterruptedException { //how to access below nextRow(num)?? if (current row num.equals…
0
votes
1 answer

Unable to run multiple test cases from multiple classes in a single instance of browser in TestNG

I'm trying to run multiple test cases that are placed in different classes, but when I run the code, the last class creates a new instance of chrome driver. This code is related to company's work hence I can't share the full code in detail but I'll…
0
votes
1 answer

Get testCaseKey value from TestCase in TestNG

I have a test case like this: @TestCaseKey(testCaseKey = "TestCase-001") @Test(groups = {WEB}, description = "Verify this and That") public void verify(){ System.out.println("Print this"); } I want to get value of…
0
votes
1 answer

How to fetch single row from excel sheet and pass into testng data provider using java

I have a scenario to fetch entire 3rd row data from excel sheet and pass to data provider. I can fetch all the row available in excel sheet (Please find the code below). But, I want to fetch nth row of data and pass to data provider annotation.…
0
votes
0 answers

Is it possible to get test count of each class separately from testng xml file?

Currently we use testng ITestContext to get the test count running via testng xml file. My file contains multiple classes and context.getPassedTests().size() returns the total count of passed tests from all the classes mentioned in the xml file my…
0
votes
0 answers

Getting Method error depends on nonexistent method "loginAsAgent"

am trying to implement depends on methods i have given depends on login as agent for booking an appointment but its showing non exist method ihave given @data provider and depends on method this is login test case public class TC001_Login extends…
0
votes
0 answers

Cannot instantiate class error on running TestNG class & SessionNotCreatedException

enter image description hereenter image description hereI'm trying to run a TestNG class and my chrome & chromedriver is of version same version(107) but im getting the below error. And please note when i run any junit class its running successfully…