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
0 votes
1 answer
53 views

Compilation stuck at find element by xpath without giving any error

I'm trying to automate a project using selenium page object model. Below is the html code <div class="type-1 overflow-hidden card"><div class="col-xl-8 offset-xl-2">&...
user avatar
0 votes
0 answers
21 views

Appium: Parallel execution halts if test is complete on one of the device

I am trying to run 2 different tests on 2 different emulators parallelly. But my execution halts on 1 device as soon as the test on other device is complete. I am using the below driver setup code ...
user avatar
0 votes
1 answer
37 views

Problem finding element with text when the text contains &nbsb;

I have the following element in the DOM: <div id="sourceListDiv"> <select id="sourceList" onkeydown="uil.handleKeyDown(this)" size="15" ondblclick=&...
user avatar
0 votes
0 answers
12 views

How can we get an aggregated count of all tests failing for a particular error in Report Portal?

I have multiple scripts failing for a particular assertion error. I need to get a total count of all the tests failing for that error. The logs are enabled in the Report Portal for each test. How can ...
user avatar
  • 23
0 votes
1 answer
46 views

How do i get rid of duplicated local variables

I have a multiple drop-downs and need to automate them. I added the code below, how do I add them in one step? or make it easier or how do I add them in one function? I'm using eclipse and TestNG ...
user avatar
-1 votes
1 answer
111 views

Custom Framework for Writing a Test that Reads a CSV File into a HashMap

I am trying to complete a lab where we are asked to write a unit test that can read a csv file into a hashmap. So far I have this: import java.io.BufferedReader; import java.io.FileReader; import java....
user avatar
  • 11
0 votes
1 answer
31 views

Override Static Method for TestNg Class

Is there a way to add a screenshot in this Assert method? When my softAssert fails, I need it to take a screenshot here. Method of Assert.class : static public void fail(String message) { throw ...
user avatar
  • 1
0 votes
0 answers
20 views

ScreenShot when failed not taken Selenium

I am trying to take a screenshot of the page when an exception is triggered. My main Class : @Listeners(CustomListener.class) public class AjoutPanier extends Base { @BeforeTest public void ...
user avatar
0 votes
0 answers
565 views

Facing error java.lang.RuntimeException: java.lang.NoSuchMethodException: jdk.proxy2.$Proxy9.proxyClassLookup() on run appium with POM

Hi everyone im facing this error on run appium with POM here is complete error java.lang.RuntimeException: java.lang.NoSuchMethodException: jdk.proxy2.$Proxy9.proxyClassLookup() at io.appium....
user avatar
2 votes
2 answers
115 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(...
user avatar
  • 31
1 vote
0 answers
79 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 ...
user avatar
  • 11
0 votes
0 answers
110 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 ...
user avatar
0 votes
3 answers
64 views

When should we use Assert.true() instead of Assert.equals() method in Selenium?

What's the difference between these 2 Assert class methods?
user avatar
0 votes
1 answer
67 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? 🤔
user avatar
0 votes
1 answer
194 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 ...
user avatar
  • 2,093
0 votes
0 answers
86 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:...
user avatar
0 votes
2 answers
317 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 ...
user avatar
0 votes
0 answers
14 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 ...
user avatar
  • 1
0 votes
2 answers
32 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 @...
user avatar
0 votes
0 answers
148 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://...
user avatar
0 votes
1 answer
314 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 ...
user avatar
  • 13
0 votes
3 answers
53 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 ...
user avatar
1 vote
2 answers
281 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 ...
user avatar
1 vote
1 answer
413 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 ...
user avatar
0 votes
1 answer
274 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"}...
user avatar
1 vote
1 answer
49 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() ...
user avatar
  • 21
2 votes
2 answers
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 ...
user avatar
  • 31
1 vote
1 answer
283 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 ...
user avatar
  • 31
0 votes
1 answer
1k 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 ...
user avatar
2 votes
1 answer
68 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 ...
user avatar
0 votes
1 answer
4k 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&...
user avatar
0 votes
1 answer
934 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; ...
user avatar
1 vote
1 answer
49 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 ...
user avatar
0 votes
1 answer
3k 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....
user avatar
0 votes
1 answer
873 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....
user avatar
-1 votes
1 answer
494 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....
user avatar
  • 1
1 vote
4 answers
9k 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 ...
user avatar
0 votes
1 answer
542 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 ...
user avatar
1 vote
2 answers
540 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(){ ...
user avatar
  • 373
0 votes
0 answers
546 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="...
user avatar
  • 487
0 votes
0 answers
76 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 ...
user avatar
0 votes
1 answer
639 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 = ","; ...
user avatar
  • 373
3 votes
0 answers
137 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 ...
user avatar
0 votes
0 answers
2k 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. ...
user avatar
1 vote
1 answer
989 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 ...
user avatar
  • 187
2 votes
2 answers
2k 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&...
user avatar
1 vote
1 answer
182 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, ...
user avatar
3 votes
1 answer
222 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 ...
user avatar
2 votes
3 answers
559 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(...
user avatar
0 votes
1 answer
193 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....
user avatar

1
2 3 4 5
8