Questions tagged [testng]

TestNG is a testing framework, inspired by the JUnit/NUnit unit testing frameworks. TestNG is intended to support more than just unit testing, allowing functional, end-to-end, integration, etc.

Filter by
Sorted by
Tagged with
1
vote
2answers
61 views

Is it necessary to Assert web page title in every case?

I am writing a script in Selenium and TestNG to automate Add User profile pages. Now, when I land on every new page, then do I need to write Assert.equals("add user profile", driver.gettitle(...
0
votes
0answers
19 views

Selenium- Parallel test case using testng not working correctly. The same working fine in sequential mode

The driver instance initializes as Threadsafe. Till the launching of the browser and pass the URL everything seems to be working. But the credentials passing on anyone's browser, instead of all ...
0
votes
0answers
19 views

I am not able to open Extent report that was generated at a specific timestamp when the Test ends?

I am trying to run a Cucumber Selenium project which is written in Java and use Test NG to run the Suite. Now, in the @AfterSuite Method, im trying to popup the Extent Html and pdf report both ...
0
votes
3answers
47 views
0
votes
1answer
20 views

Why dont we use the main() method in TestNG class?

public class Tests{ @Test public void run(){ sop("this is test method 1"); } } How will Jvm know about entry point of the program? 🤔
0
votes
0answers
29 views

TestNG parallel execution get failed becouse im using same WebDriver on all tests

There is a situation where I have 150 test cases and I have set up Test NG parallel test execution. Unfortunately, I'm using the same web driver which initialized at the test base class on all the ...
0
votes
0answers
21 views

Jenkin fail without explanation running tests process exitcode 143

I have multiple test suites running on jenkins, however there is only one which never completes. It gets interrupted but never shows why The only thing I see in my console of the build is this: 04:13:...
0
votes
2answers
97 views

How can I run a login test for 100 users at the same time using Selenium, TestNG and Cucumber? [closed]

I am a newbie in Automation testing. I have a list of 100 users in a excel spreadsheet: User1: userid1/password1 User2: userid2/password2 ... and so on. I need to create a script and make all 100 ...
0
votes
0answers
8 views

Running testNG suites dynamically_code just pick up same tesng.xml file every time

I'm using below code to dynamically load and run, testng.xml suites via, tCaseName variable(who's value is coming from excel file). I have 2 testng.xml files, who's name i have renamed to some ...
0
votes
2answers
31 views

Seeing NullPointerException on running TestNG Selenium Framework

Written the Test Script in TestNG framework where the Open browser activity is happening in "baseClass" under @BeforeTest annotation and the Test Script is written in Test Packages under as @...
0
votes
0answers
45 views

When Tests Execute Randomly and in alphabetical order in TestNG?

When in TestNG, the @Test methods execute randomly and in what case they execute in alphabetical order? I have not using any priority tags or grouping tags either as parameters or as xml tags. https://...
0
votes
1answer
78 views

Custom Test Case Name in TestNg HTML reports

I am trying to override the test case name in the testNg HTML report since I am using the data provider and each test data depicts something different. To do this, I added the following: I am setting ...
0
votes
0answers
41 views

Build run test cases twice in Jenkins (Build now) with Maven Testng

Problem statement: Build run test case twice in Jenkins Build. working fine in the local environment Skills/Tools: Java, Maven, TestNG, Jenkins. I have tried removing testng.xml test classes. Don't ...
0
votes
0answers
169 views

Anyone had success running TestNg with Java 9 or above?

Has anybody successfully run the TestNG with >=Java 9? I tried and it failed. I also had no luck finding any helpful information from Google search. This is the error I got, Error occurred during ...
0
votes
3answers
47 views

How to have just one pre-requisite check in TestNG for multiple tests distributed across classes

I have a Test Automation project using TestNg. I want to make sure certain configurations are enabled before I start some of the tests. I have written this as a test and marked other tests as ...
1
vote
2answers
134 views

How to automatically execute failed testing cases on Jenkins using extent report

I'm looking for a solution to execute failed test cases automatically on Jenkins. I'm currently running test cases through pom.xml which points to testng.xml I'm using extent reports to capture and ...
1
vote
1answer
243 views

@BeforeMethod/@AfterMethod(onlyForGroups) methods did not execute, if a test method belonging to this group is executed

I am running a test suite with the test methods belonging to a certain groups. Below is the Selenium code: public class BaseClass { @BeforeMethod(onlyForGroups = {"P1"}) public void ...
0
votes
1answer
139 views

TestNG: @BeforeMethod/@AfterMethod methods having no groups assigned are executed for the test method which have groups assigned

I am trying to run all the test methods irrespective of whether they belong to any group or not. Below is the Selenium code: public class BaseClass { @BeforeMethod(onlyForGroups = {"P1"}...
1
vote
1answer
38 views

How to retrieve test method status and other values in IReporter implementation

I need to retrieve test method status, actual result, expected result & other attributes in IReporter implementation. Is it possible to use ITestResult to pass required data to generateReport() ...
2
votes
2answers
2k views

java.lang.UnsupportedClassVersionError -CucumberJvm4SMFormatter -Java runtime Version error

My testing framework is built with Cucumber, TestNG, Java 1.8 and Maven I recently updated my IntelliJ IDE Details: IDE : IntelliJ IDEA Ultimate 2020.3 - Runtime version : 11.0.9 Cucumber is ...
1
vote
1answer
149 views

Automated testing of Google Pub/Sub

I'm new to test automation and Google Pub/Sub. I'm developing automation scripts for regression testing. My automation framework is built with Java, Maven, Cucumber and TestNG My application is a ...
0
votes
1answer
586 views

Cucumber- Selenium Getting null pointer exception while openBrowser method

I am getting null pointer exception when selenium tries to launch the browser. I have already checked step Definition. Selenium OpenBrowser Method. Chrome browser version. ( I have driver 87.04 ...
2
votes
1answer
56 views

How to debug TestNg Test Execution getting crashed due to large number of test cases

I have a test suite having 10000+ test cases, and as all these test cases run under one suite (Regression Suite), my suite getting crashed always due to very high memory consumption, maybe the size of ...
0
votes
1answer
2k views

Maven is not running any tests called using testng suitexml files in POM.xml

I am trying to run a test using Maven by providing the testng.xml file. It is not running any test, although the build is successful. POM.xml <project xmlns="http://maven.apache.org/POM/4.0.0&...
0
votes
1answer
603 views

Shows "[Utils] [ERROR] [Error] java.lang.NullPointerException" for data driven(excel File) API Automation test(Rest Assured)

It throws a java.lang.NullPointerException, but why it shows that, I could not find. Here is my code. ExcelUtil package Utils; import java.io.FileInputStream; import java.io.FileNotFoundException; ...
1
vote
1answer
45 views

Fetching wrong Employee count corresponding to office location in Selenium

I am fetching Employee count according to locating using Map Highlighted No of employees count is mismatch in Image like If i search in Web table Tokyo there count is 5 but here getting 6 for ...
0
votes
1answer
2k views

how to read the following data from excel using cucumber-java

Heading How to get the username and password from excel using cucumber package com.qa.excel; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import org.apache.poi.ss....
0
votes
1answer
541 views

I'm using ExtentSparkReporter for generating extent reports in cucumber with testng ...how to add screenshot for failure scenarios

package cucumberhooks; import java.util.HashMap; import java.util.Map; import com.aventstack.extentreports.ExtentReports; import com.aventstack.extentreports.ExtentTest; import com.aventstack....
-1
votes
1answer
288 views

TestNG - java.lang.NullPointerException [duplicate]

My code: package test; import org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.testng....
1
vote
4answers
5k views

TestNG- No tests found. Nothing was run

UTF-8 io.rest-assured rest-assured 4.1.2 test org.testng testng 6.14.3 ...
0
votes
1answer
385 views

Null Pointer Exception Error at Selenium TestNG

I'm trying to automate the search box but I'm getting null pointer exception. package LICT.Maven_ReCheck_Search; import java.util.concurrent.TimeUnit; import org.openqa.selenium.WebDriver; import ...
1
vote
2answers
343 views

Passing arguments to a DataProvider method using TestNG

Given my data CSV file: jones;1293039, smith;2938949, johnson;1203939, clark;8293044 And my DataProvider: @DataProvider(name="data") public Iterator<Object[]> custDataProvider(){ ...
0
votes
0answers
352 views

TestNG Listener not working on XML

My testing XML is like below <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"> <suite name="...
0
votes
0answers
51 views

How to execute test cases after ide crashed

Kindly suggest if I have 100 test cases after executing 40 Test Cases my IDE was crashed. So, on the next time when I am restarting my Test Cases again the execution should be start from 41 to 100. I ...
0
votes
1answer
404 views

How to split data passed from a .CSV file to a TestNG DataProvider

Given my .csv data file in format name:reference :- Johnson;464758, Smith;839393, Jones;940392, Davidson;182939, Arthurs;938494 And given my test code: final static String DELIMITER = ","; ...
3
votes
0answers
80 views

How to avoid using same data in parallel execution

This question is similar to How to manage application data when running multiple tests in parallel? But I want to know if there's a way or listener in testNG that will lock certain method when running ...
0
votes
0answers
1k views

Not able to run my test from testng.xml file

I'm not able to run by test case from testng.xml file after run of file I'm getting that Total tests run: 0, Failures: 0, Skips: 0 but if I will try to run the test class directly then test will run. ...
1
vote
1answer
633 views

testNG, Java: How to combine a few Data Providers in one test?

in the provided test I need to read the data from the cell in Excel and it works. I would also like to add the functionality to store the price of the product in another cell in the Excel. I've ...
2
votes
2answers
1k views

Get class name of the calling class

I needed to get a class name from my calling class. I will not make too much confusion. I have 3 classes . Class A{ //do something } Class B extends Class A { @Test(dataProvider = "dp&...
1
vote
1answer
149 views

Selenium Dataprovider returns a NegativeArrayException when called from different class

I have an excel which contains multiple worksheets in it. Each worksheet contains multiple columns. I have a class like this. public class dptwo extends dpone { @Test(dataProviderClass = testdp.class, ...
3
votes
1answer
112 views

Problem implicit wait with wait.until

In my code, I want to wait a certain time until the command fails with implicit wait for the driver. I have parts which were loaded after entering the page and a loading-icon is visible. In these ...
2
votes
3answers
421 views

How to pass excel column values into different test methods of a class in Java Selenium

I have an excel which contains 4 columns with N rows. Let us say Col1, Col2, Col3, Col4 are the headers. Now I have a java class and there are 3 methods inside it. public class test(){ @Test(...
0
votes
1answer
88 views

java.lang.NullPointerException in Page object Model

I have created this program using TestNG and i'm getting this error java.lan*g.NullPointerException I have initialized the Webelement .But still i'm getting error POM.java package TestPOM; import java....
1
vote
2answers
2k views

Jenkins doesn't execute tests

I have a Maven project and I'm using TestNG. My build completes in Jenkins, but the tests I want to run from my testng.xml file are not actually executed. I have my console output from Jenkins and ...
0
votes
2answers
280 views

Is there a way in TestNG to validate something but not fail the test case at the end (not soft assert)?

I'm using TestNG to run a test and I've been using the Assert.assert statements in Java. Now there are a few places where I would like to validate whether a function returned true or not. If it didn'...
1
vote
1answer
130 views

TestNG: Go to the next test after one iteration of dataProvider

So I have two tests, one that check the sign up "test01_signIn", if it's a PASS, it goes to the the second test "test02_CheckNewsStandElements", which checks the visibility of an element of the ...
0
votes
1answer
43 views

java.lang.NullPointerException on my POM project. I have my Page factories initialized and cant figure out the issue [duplicate]

I am getting the following error message in my IntelliJ The "TestBase.java:33" and "LoginPageTest.java25" essentially both point to the if(browserName.equals("chrome")) line of code in the base ...
-1
votes
1answer
40 views

Is there any course available online on designing ui automation framework using Selenium and Java?

Is there any good course available online that explains designing UI automation framework using Selenium and Java, integrating logging, reporting, etc. ? Maybe also talk about some best practices. ...
0
votes
1answer
2k views

Getting “testng.xml is not a valid file” error in Jenkins

I’m getting the following error when trying to run a Selenium/TestNg test from Jenkins. [ERROR] Suite file /development/apps/config/jenkins/jobs/teste-automatizado/workspace/Abc/testng.xml is not a ...
0
votes
1answer
247 views

TESTNG, how to validates test case results to pass fail status [duplicate]

Need help, my question here is how can I code it such when the result is not expected testNG will display the test case as failure/fail? if the result is expected test case result is passed? very new ...

1
2 3 4 5
8