Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

0
votes
1answer
6 views

Selenium WebDriver “Cannot instantiate class ” error is coming

Below is my Base Class: package com.mercury.qa.base; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.util.Properties; import java.util....
0
votes
2answers
32 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
votes
0answers
24 views

How to handle java.lang.NullPointerException in testNG? [on hold]

I am getting below issue: java.lang.NullPointerException at org.testng.remote.strprotocol.TestResultMessage.<init>(TestResultMessage.java:127) at org.testng.remote.strprotocol....
0
votes
2answers
22 views

How to use assertion to compare both different size of the rows?

I want both size of the rows shouldn't be matched. int firstnum = 0; List<WebElement> preRoutlList = driver.findElements(By.xpath("//*[@id='txBottomTable']/table/tbody/tr")); ...
2
votes
1answer
43 views

Unable to pass dynamic xpath in repository file?

My code is : for (int z = 0; z < rows.size(); z++) { rows.get(z).findElement(By.xpath("//*[@class='ng-scope'][" + (z + 1) + "]//*[@placeholder='Stop Name']")).sendKeys(shuttleObj.getStopArea()); ...
0
votes
1answer
41 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
votes
0answers
27 views

TestNG--java.lang.AssertionError— result: expected [] but found [] [closed]

Code:- softAssert.assertEquals(sheet.getRow(2).getCell(2), "", "result: "); Log TestNG--java.lang.AssertionError-- result: expected [] but found []
1
vote
2answers
33 views

Chrome Driver - testNG parallel issue

I am trying to run selenium test classes parallel using testNG like this thread-count="3" parallel="classes" . But the issue is at closing the chrome driver and everything else works fine. while ...
0
votes
1answer
47 views

Unable to find the correct xpath for input field?

Unable to locate the element. <div class="col-md-4"> <label class="radio-inline"> <input type="radio" name="routing_option" data-ng-model="generateRoutes" data-ng-value="'...
0
votes
1answer
38 views

Getting 'java.lang.NullPointerException' on executing test Cases

import org.openqa.selenium.WebDriver; import org.testng.Assert; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations....
-2
votes
1answer
51 views

How to assert that particular element is not displayed? [duplicate]

Can someone help me fixing NoSuchElementException. Let me explain what I am trying to do. I am trying to login into an application with multiple sets of data. Lets say, 1) Valid username and ...
0
votes
1answer
35 views

Getting error message on webpage but test cases get passed -using testng with selenium

Driver class: package com.deere.gmsr; import java.util.Properties; import java.util.concurrent.TimeUnit; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; ...
-1
votes
1answer
39 views

Getting “java.lang.NullPointerException” exception when i try to run my POM test [duplicate]

I have 2 classes in my project First class contains all the webelements Second one for method where i am using this elements package facebook; import org.openqa.selenium.By; import org.openqa....
-1
votes
2answers
43 views

What is the best implementation strategy of Driver creation in Selenium Webdriver with Java?

As in my framework, I am creating the driver object by collecting the info from the test suite itself. We are passing the driver name through the testng suite and at runtime, we are collecting the ...
0
votes
1answer
36 views

Is there any possibility to open a new tab in existing window in selenium? [duplicate]

I have tried to open new tab in existing browser but it opens in new browser.
0
votes
0answers
79 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"}) testng.xml &...
-1
votes
2answers
46 views

How locate dynamic text field element inside dialog box?

I tried to using absolute xpath to locate the dynamic text field element after search but it fails. <div class="pzbtn-rgt" data-click="..."> <div class="pzbtn-mid" data-click="...."> <...
-1
votes
3answers
64 views

Getting Null pointer expections “ java.lang.NullPointerException ”

[RemoteTestNG] detected TestNG version 6.14.3 1553664942228 mozrunner::runner INFO Running command: "C:\Program Files\Mozilla Firefox\firefox.exe" "-marionette" "-foreground" "-no-remote" "-...
1
vote
0answers
40 views

How to launch 10 browser instances using Selenium Grid in the same machine

I'm trying to launch 10 browser instances (IE) in a virtual machine and execute same script 10 times parallelly on those browsers. I updated the IE node to have maxInstances=10" -maxSession 10 and ...
0
votes
2answers
54 views

Using TestNG framework : How to call other class of the methods

Using TestNG framework : How to call other class of the methods I have created one class for login and another class for add customer details. My scenario is: Once user login after add customer ...
0
votes
1answer
25 views

the Gecko path is not working

package firsttestngpackage; import org.openqa.selenium.*; import org.openqa.selenium.firefox.FirefoxDriver; import org.testng.Assert; import org.testng.annotations.*; public class FirstTextNGFile { ...
1
vote
2answers
60 views

TestNG @Test can have a testID?

I'm trying to adapt testrail api. I want to set a integer testID value for a @Test and get the value at iTestListener. In testNG, is there a way to specify a test id for each @Test? I tried ...
0
votes
1answer
32 views

TestNG Listener from one xml file is applied to another

I have two xml files to run tests - api.xml and ui.xml In ui.xml I have TestNG Listener, but this Listener also is applied when API tests run. I run tests using testng.xml ui.xml <!DOCTYPE suite ...
0
votes
1answer
51 views

How to read multiple test data files in same script?

I'm trying to use data in multiple test data files in the same script here. Suppose there are 2 data files with login credentials (Login1.csv and Login2.csv). I need to use credentials in Login1.csv ...
1
vote
2answers
60 views

How to run same Selenium/testNG project in a different environment with different credentials?

Currently, I'm running a selenium script in one environment (on-premise) with separate login credentials. There are 5 different users and they have separate login credentials. Suppose there are 50 ...
2
votes
2answers
80 views

How to execute just 50 test cases out of 500 test cases in testNG

There are 500 test cases in my suite. I want to select only 50 test cases and execute them. Is there a way to do it using testNG
1
vote
1answer
26 views

Do Test Runner and Testing Framework exists separately in Java?

As per my knowledge, test runner is any software that takes testing code and as per the configuration, executes the code and collate the results while the testing framework is basically the name given ...
2
votes
2answers
64 views

Getting Nullpointer Exception

While i run this below code i am getting Null pointer exception. import java.util.concurrent.TimeUnit; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import ...
1
vote
1answer
126 views

How to pass the data provider data when page factory method is applied

I have created a sample project using the page factory. Now I want to use the data provider in the code and this is how I have done below. Is the approach correct? I have defined CommonElements class ...
0
votes
1answer
30 views

after click on submit button record will added to the table, so how to verify that record is added or not in the table

There is add employee form, so how to verify the record, should I match the all fields of form which display on table or just match the name, also table is dynamic with pagination.
0
votes
2answers
305 views

How to use TestNG (ITestContext context, Method)?

I found the below code snippet from a real-time project and tried to understand the use of TestData(ITestContext context, Method m) but I was not able to do this. I would like to know how to use ...
0
votes
2answers
157 views

returning values in hash map

I'm trying to return values stored in a hashmap using data provider but it's not working. I'm getting the below error. Thanks in advance. @DataProvider(name="DP") public HashMap<String, String&...
1
vote
1answer
111 views

Where to initialize TestNG TestContext

I have a TestRunner class that starts my TestNG like this: TestRunConfigs configs = TestRunConfigs.parseCommandLine(args); TestNG testRunner=new TestNG(); testRunner.setXmlSuites(getXmlSuites(...
1
vote
2answers
65 views

Web Service Testing Site

I practice web services testing but I don't have any web service testing site. Could anyone please suggest a good web service testing site? Please help. Thanks in advance.
0
votes
1answer
383 views

how to run same testcase in 2 different URL in selenium JAVA [closed]

How do I run the same test case in 2 different URL which has same functionality
-1
votes
1answer
732 views

Getting error message while running selenium script

I am facing this problem, please give me a solution [RemoteTestNG] detected TestNG version 6.14.2 Starting ChromeDriver 2.42.591088 (7b2b2dca23cca0862f674758c9a3933e685c27d5) on port 7027 Only local ...
1
vote
1answer
64 views

How can users run TestNG cases without using an IDE?

I run my test using Java, Selenium and TestNG. When I execute my test suite I have it set up where the testng.xml has all the configurations to run my tests. I am wondering, if I can set up some UI ...
0
votes
1answer
406 views

Can't able to run TestNG its show an error below I mentioned

[RemoteTestNG] detected TestNG version 6.14.2 org.testng.TestNGException: Cannot instantiate class testing.test at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:30) ...
0
votes
1answer
53 views

Simplifying Setup of TestNG/Selenium WebDriver Test Classes (using Google Guice?)

I am developing test cases using Selenium and TestNG, and am following the Page Object Model design pattern. Currently, my page classes look like this (Page1 is just a placeholder, they all have ...
0
votes
1answer
524 views

Taking screenshot on test failure (Selenium WebDriver/TestNG)

I am using Selenium WebDriver and am looking to have the driver take a screenshot upon test failure. For this purpose, I am using the following code for the onTestFailure() method of my TestNG ...
0
votes
1answer
50 views

I need to verify a dynamic table record, if they match with data then PASS else Fail the test case using Assert

Page Object Class public class Transactions { WebDriver driver; boolean result1; public Transactions(WebDriver driver) { //super(); this.driver = driver; } public void ...
0
votes
2answers
65 views

POM Model -Fetching mobile number from excel sheet like 9.5512395512E9

Working on Page Object Model by using Data driven Framework, fetching data from Excel sheet.When executing the test script the mobile number displays like 9.5512395512E9. In excel sheet Original ...
0
votes
2answers
415 views

How to pass the web driver instance from one testcase class to another testcase class in TestNG?

InitializeDriver.java: public class InitializeDriver{ WebDriver driver; public WebDriver getDriver() throws Exception{ driver = new FirefoxDriver(); System.out.println("Initialize ...
0
votes
1answer
3k views

org.testng.TestNGException: Cannot find class in classpath: com.facebook.qa.testcases.LoginPageTest

[RemoteTestNG] detected TestNG version 6.14.2 org.testng.TestNGException: Cannot find class in classpath: com.facebook.qa.testcases.LoginPageTest at org.testng.xml.XmlClass.loadClass(XmlClass....
0
votes
2answers
129 views

I got the following error while automate the webpage using testNG

package browserhandling; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebDriver; import org.openqa....
0
votes
3answers
542 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 ...
-1
votes
1answer
145 views

How to format TestNG reports in second not millisecond ?

I want convert the milliseconds to seconds in TestNg emailable report. Please help?
1
vote
1answer
878 views

TestNG not executing all tests in suite

TestNG fails to execute all of my tests. XML file looks like this: <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"> <suite name="Guru Test Suite"> <parameter name="...
-1
votes
3answers
352 views

How to click on the image inside a grid using selenium webdriver?

I have to click on an image inside a grid. Grid elements have dynamic ID's. Therefore it's impossible to capture elements as usual. How can click on this image? I have boxed the image I ...
1
vote
0answers
118 views

How do you get Jenkins to count the build run as pass when failed testng tests are retried and passes? [duplicate]

How do you get Jenkins to count the build run as pass when failed TestNG tests are retried and passes? Description: I have two tests that ran. Test1 passed, but Test2 failed then on retry it passed....