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.
344
questions
0
votes
1answer
85 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
1answer
273 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
5answers
5k views
Print all product details in search results using Selenium Java
I am trying to print product details from searched results from this page.
This is the function I used for that.
@Test(priority = 1)
public void printSearchItem() {
// print the product details
...
0
votes
1answer
34 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 ...
1
vote
1answer
34 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 ...
20
votes
6answers
82k views
How to handle dynamic changing ID's In XPath?
How to Handle Dynamic Changing IDs In XPath?
for example :
//div[@id='post-body-3647323225296998740']/div[1]/form[1]/input[1]
In this xpath id "3647323225296998740" is changing every time when ...
2
votes
3answers
3k views
Can't use if condition using selenium webdriver
I've got the following situation:
I want to fill a field which is displayed some times and others don't.
So, to solve this I used a if condition along with page objects.
public static WebElement ...
2
votes
1answer
776 views
How to select a dropdown value in Selenium WebDriver using Java appium?
I am new to Selenium, currently am working on selenium webdriver. I want to select a value from the drop-down. But I am not able to do it because of some error. Also, I want to inform you that in my ...
1
vote
2answers
13k views
Selenium IE Webdriver showing “Only Local connection are allowed” in TestNG
I am trying to launch my application in IE browser in selenium using TestNG framework. But, after the IE browser is launched, the Eclipse console shows an error that "Only Local Connection are allowed"...
1
vote
1answer
1k views
Import TestNG results from Jenkins to ALM
I have Jenkins on localhost, configured test project, which is generating passed test:
@Test
public void aFastTest() {
System.out.println("---- ---- ----");
Assert.assertTrue(...
1
vote
1answer
191 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 ...
0
votes
1answer
2k views
Maven TestNG multiple suites in different folders
I'm working on a mobile automation task where I need to run test suites in parallel for 3 different iOS apps. Each test suite has its own testng.xml with a section configured to run on a device.
I ...
0
votes
2answers
674 views
TestNG with Eclipse: How to add main class?
How can I add main class in eclipse cucumber project. I am running cucumber feature file and using TestNG but getting error: "cannot find class in classpath" and as a resolution of this I am geeting ...
0
votes
3answers
2k views
Test cases stop execution for next test cases after using soft assertion
I have used soft assertion in my test cases, but it stops the execution of all the next test cases. what I know if we are adding soft assertion then particular test case should fail and it should jump ...
0
votes
2answers
59 views
Java Selenium: Custom Assert Message for Multiple Checkbox
I'm working with an automated script for multiple checkboxes that has dependent permissions.
Given there are multiple checkboxes
Checkbox A
Checkbox B
Checkbox C
Checkbox D
Checkbox E
When I ...
2
votes
1answer
950 views
TestNG reports email after test executions
I've found various links for sending TestNG reports to be emailed after test executions here are two of the links
https://loganathan1988.wordpress.com/2014/11/03/how-to-email-automated-test-execution-...
1
vote
3answers
191 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
2answers
168 views
Not able to enter case-sensitive credential in android app
I am writing a test case for an android app where the app requires case-sensitive credentials. I writing test cases using appium and TestNG.
Steps I am following are -
Launching app
Entering ...
1
vote
1answer
38 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
2answers
2k views
Can we access the value of a member or class variable of a test class in the testListner methods
I have a situation where 'xyz' is member variable of my testClass and I want to print some information in my report using that variable only.
So I want to access 'xyz' in my 'onTestFailure' listner ...
0
votes
1answer
56 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 ...
1
vote
1answer
1k views
How to open messaging app during one android app test case is running to fetch otp
How do I open messaging app when test case is running for any other app.
Need to fetch OTP from messaging app during a test case is running for my android app.
I have tried to create new instance ...
0
votes
2answers
292 views
Getting nullpointer exception for 2nd test case working fine for login
Driver set to null for 2nd test case, working fine for login.
Driver class:
public class Driver {
private static WebDriver driver;;
/**
*
* @return
* @throws Exception
*/
public static ...
1
vote
1answer
119 views
In gradle 4.6, how to force all tests in a class gets executed first before moving to tests in next class?
I am using Gradle 4.6 with testng. My test suite has tests organized something like these.
java class1
{
test 1.1
test 1.2
test 1.3
test 1.4
}
java class2
java class3
java class4
java class5
All ...
0
votes
1answer
243 views
Unable to execute single tc, login then run other application features, right now its running as a suite
I have to execute my test cases as a single as well as a suite, right now its running as a suite but not as a single test case in selenium webdriver: Below is my test which are calling methods present ...
0
votes
2answers
88 views
Element located when put in a single test case but not located when put in separate test case
I am in a weird situation where I found that my element is located when I wrote in a single test case. But as soon as I put that element in a separate test case, Unable to locate element Exception is ...
0
votes
4answers
1k 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
46 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 ...
5
votes
1answer
2k views
Dependent methods in the same class run out of order only when included in a ātestng suiteā; running class independently respects the dependency
I have a class with dependent methods using the TestNG annotation
dependsOnMethods
The test runs fine 100% of the time if I simply run it as a TestNG Test from the package.
When I include the test ...
0
votes
0answers
180 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
2answers
99 views
How can we run only selected testcases from extent.html report in selenium webdriver?
I'am running testng suite and then extent.html report is being generated.
Now I want to customize my report like; i should be able to select only failed testcases in my report and then should be able ...
1
vote
2answers
657 views
Cannot initiate TestNG test
I'm learning to use selenium WebDriver with TestNG plugging for Eclipse and I ran into this issue where I can't execute the test case (it is unfinished but it has no compile errors nor warnings).
...
5
votes
3answers
8k views
Difference between Selenium and TestNG
Am a beginner in Selenium and am trying to learn selenium on my own by googling. One thing which I noticed was in many of the posts which I read about selenium the name of the framework by name "...
0
votes
2answers
575 views
Unable to read the parameter value inside a class using TestNG
To achieve parallel execution, I am updating my existing Junit project to TestNG.
The requirement here is to run one scenario in different browsers using TestNG
RunnerClass is as follows:
import ...
0
votes
1answer
203 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;
...
0
votes
1answer
128 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....
3
votes
7answers
52k views
Cannot get a STRING value from a NUMERIC cell. How can I resolve this issue in selenium webdriver using POI?
I am trying to read data from an excel sheet and write on my application.But shows an error while trying to pass a numeric value using string. Please suggest me how can I resolve the issue. Please see ...
3
votes
3answers
2k views
Is it possible to test dynamic web sites using selenium?
I have a dynamic web site which is developed using angular (front end). Elements cannot be identified using ID,name etc... as they are not used to name elements. But models have used to name elements ...
0
votes
1answer
719 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
0answers
2k views
Cucumber and TestNG, how to pass parameter?
Could you please tell, how to pass parameter in Cucumber using TestNG?
I have following code, but it does not work.
Error in stepDefinition.java on the line @Parameters({"environment"})
...
0
votes
0answers
132 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="...
-1
votes
1answer
78 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....
0
votes
1answer
171 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 ...
0
votes
0answers
34 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
121 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
53 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
1answer
46 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....
0
votes
0answers
404 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.
...
4
votes
5answers
68k views
Unable to locate element throwing a org.openqa.selenium.NoSuchElementException in TestNG
Am unable to click on element after executing a First test second test showing a org.openqa.selenium.NoSuchElementException .
My code Here:
public class snapooh {
WebDriver driver;
@BeforeTest
...
1
vote
1answer
167 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 ...