Stack Exchange Network

Stack Exchange network consists of 174 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
15 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
26 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
40 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
53 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
48 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
60 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
39 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
26 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
79 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
70 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
60 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(...
0
votes
1answer
50 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
147 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
241 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 ...
0
votes
1answer
42 views

UI for automated tests

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
98 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
44 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
137 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
43 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
57 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
144 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
1k 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
85 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
211 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
94 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
548 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
202 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
47 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....
2
votes
2answers
399 views

How to automatically rerun failed TestNG tests on Jenkins and update the final results to pass if retries passes?

How to automatically rerun failed TestNG tests on Jenkins and update the final results to pass if retries passes? Description: I have two tests that ran. Test1 passed, but Test2 failed then on retry ...
0
votes
1answer
81 views

TestNG + Appium + Java : [TestNGClassFinder] Warning: Can't link and determine methods of class

Question: How to fix : [TestNGClassFinder] Warning: Can't link and determine methods. More info: My Automation is getting failed suddenly. I know it was working well before & even yesterday. ...
1
vote
1answer
220 views

How to control TestNG to iterate all Tests in each iteration instead of iterating individual tests before moving on to the subsequent test

Problem - I have 6 tests and one dataprovider with 2*2 object array. I want TestNG to pick first data, use it in First test and then subsequent tests are executed based on the data picked in first ...
0
votes
1answer
574 views

Selenium Webdriver TestNG (Java) using While loop for all tests

I am new to Selenium Webdriver Testng and trying to Develop Data Driven framework using CSVReader I have 5 tests in Testng and have to run those all on different environments. So basically I have to ...
0
votes
1answer
64 views

Dynamic Tests using TestNG selnium arrays

What is the best approach of the follwoing scenario. I have to run a number of tests which take in dynamic data. The first set of values are pretty standard but then one is dynamic and can be any ...
0
votes
0answers
676 views

how to execute batch file of TestNG class of maven project

I am trying to execute a batch script for my testng class of maven project. Can anyone provide a solution for fixing the error? The scenario is When I try to run my Specific TestNG class without ...
1
vote
3answers
632 views

Multiple @tests but did not execute the priority 2 and priority 3

Can someone let me know why it stops execute after the first @test(priority=1)? It ran the @beforeclass, then @test(priority 1) then @aftermethod. So it skipped @test(prority=2) and @test(priority=3) ...
0
votes
1answer
311 views

How to Create “Runnable jar” testng file for deployment?

I tried: TestListenerAdapter tla = new TestListenerAdapter(); TestNG testng = new TestNG(); List<String> suites = Lists.newArrayList(); suites.add("testng.xml");//path to xml..in src testng....
0
votes
3answers
76 views

Why my code is not working when I click on the same button for multiple times?

I have same Skip button types kept for 99 products. When I need to click that, it will bring a popup. In the popup I need to click the Cancel button. Each time when I click on the Skip buton it will ...
0
votes
2answers
291 views

Is it possible to store value, return it and validate in another test case by calling previous method

I have created a method which is as follows: @Test(priority = 61) public void Schedule_Valid_Promocode_Discount () throws InterruptedException { WebElement Discount = driver.findElement(By.xpath("...
3
votes
2answers
463 views

When and how to do regression testing?

I am learning selenium. I am trying to get into more and more automation. Scenario (example): We are working in the agile. 2 weeks of sprint. We have a release after every 3 sprint. In our framework ...
1
vote
1answer
60 views

java.lang.nullpointerexception

lang.nullpointerexception while running the below code. package aditi; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import java.util.concurrent.TimeUnit; import ...
0
votes
1answer
19 views

Automated Test Framework for testing Data provided in two files

I would like to develop an automated test framework for testing/verifying the data model of a Desktop application using Java. Basically, the approach I would like go for is to retrieve the data in to ...
2
votes
2answers
2k views

testng.xml is not executing when we run pom.xml for maven project selenium

While executing my pom.xml file through maven test my BUILD is getting SUCCESSFUL but my testng.xml is not executing. I tried with executing 13 classes and with single class for both the time it ...
1
vote
2answers
817 views

How to resolve NoSuchElementException in Selenium with java?

CODE: driver.findElement(By.name("USER")).sendKeys("XYZ"); driver.findElement(By.name("PASSWORD")).sendKeys("abc"); I have tried various ways not just name but by xpath, css selectors but every time ...
1
vote
3answers
254 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
2answers
70 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
0answers
255 views

How to control order of testNG package test execution without Priority or Dependency?

I have a package containing the tests I want to run. There are no priority or dependency setings at the testcase or suite level. <suite thread-count="1" name="reg 1"> <listeners> ...
0
votes
1answer
3k views

Order of execution for Tests in TestNg, If Priority set only for few Test Methods

I have three methods as mentioned below, two with priority ( 0 , 1 ) and third method(Test) with no priority attribute. What is the order of execution. Code snippet given below.. @Test(priority = 1) ...
1
vote
3answers
422 views

How to solve java.lang.NullPointerException error in button click event?

I'm using Java,Selenium web driver and TestNG framework. I have a method to click a button in web page. But it didn't work. When debugging I could find xpath is not passed to the button. Then I tried ...
0
votes
2answers
1k views

How to find a button using both xpath and button text?

I have three buttons withing a div. All three buttons belong to same class (class names are same). What I want to do is capture each button using its text (Buttons have different texts) and xpath of ...