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
3
votes
2answers
24k views

How to call a method from one class to another class when both are TestNG classes

I have 2 TestNG classes which are: ProductCanvas package objectRepo; import java.util.List; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium....
2
votes
1answer
138 views

How should I handle failing tests caused by external dependencies?

I have a situation where an dependent application is down and I cannot execute the test case. The test execution is automated. The test first calls the dependent application API and this API returns a ...
1
vote
0answers
94 views

How to extract adb dumpsys response for validation?

I need to validate few status of the android device. Can any one let me know how to extract the information from adb dumpsys and validate the responses using Java. Your help is much appreciated. Ex: '...
0
votes
1answer
2k views

Getting NullPointerException when tried to test two different pages

I am new to automation testing and I have been stuck on testing two different pages (HomePage and AboutPage) BasePage.java public class BasePage { protected WebDriver driver; public BasePage(...
4
votes
4answers
198 views

How to create test data/pre-requisites if it is required for only few of test cases of a test class?

I've clubbed feature related tests in one test class. Suppose we've 50 tests in that class. Out of 50, suppose there are 5 test cases which require common test data or pre-requisites. If I create/set ...
0
votes
1answer
430 views

How do I execute multiple test class parallely. which using same function in another class using testng

How can I execute multiple test class 'test1' and 'test2' parallely? Which is using the same function in another class using TestNG. When I define the parallel option as 'classes' and thread-count as ...
1
vote
2answers
6k views

Selenium Testng, getting error Null Pointer exception

I'm using below code using Testng, getting error Null Pointer exception: public class Login_SF { public static WebDriver driver; String text; @BeforeTest public void Login() { System....
2
votes
4answers
1k views

How to use java to access excel with selenium webdriver for data for tests

How to access excel files from selenium webdriver using Java ? I am new to selenium Webdriver, I have a scenario where I have to provide different sets of values to the different test case. Let, us ...
0
votes
1answer
570 views

Execute TestNG.xml file from Build.xml(ANT)

Below is my Build.xml file. I am trying to execute my TestNG.xml through Build.xml but I am getting the below error every time: [testng] Cannot find class in classpath: The below file is working ...
1
vote
1answer
257 views

Is throwing custom exceptions by test an anti-pattern?

Sometimes, I can see the tests written like that public void shouldDoX() throws SomeCustomException { ... I think throwing custom exceptions is an anti-pattern because it makes analysis of the test ...
1
vote
1answer
9k views

TestNG--java.lang.AssertionError: expected [5] but found [5]

My TestNG test implementation throws an error despite the expected value matches with the actual value. Here is the TestNG code: int rowCount=driver.findElements(By.xpath(prop.getProperty("xpath")))....
1
vote
2answers
371 views

How to add tolerance for time period using assert command in TestNG tool

I am doing regression testing. In my Aplication I am giving assertEquals() command for time period which is in miliseconds.But it has very small changes time period and my testcase failed.So I want to ...
0
votes
2answers
408 views

How to add the test cases to a test-suite file that calls other test suites in TestNG?

I have a testNG.xml file having the code as mentioned below.This file is calling 2 other test suite files- Suite1 and Suite2. But I want to add some test cases to this file as well. Can I do this and ...
0
votes
1answer
6k views

Getting error while configuring extent reports in selenium

BaseTest.java import org.openqa.selenium.firefox.FirefoxDriver; import org.testng.Assert; public class BaseTest { public WebDriver driver=null; public Properties prop; public void ...
1
vote
1answer
229 views

TestNG reporting dynamic test cases

I have multiple Test Cases using a single test method dynamically. It it possible for TestNG to report the number of passed Test Cases and number of failed Test Cases? If it is possible, how do I ...
0
votes
3answers
1k views

Creating UI to run my 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 ...
1
vote
1answer
6k views

Showing NoClassDefFoundError after executing testng.xml file through command prompt

I am trying to execute a testng.XML file through the command prompt which I will use later in Jenkins with the batch file. Executed XML file gives me the following exceptions. C:\Users\Vinay\...
1
vote
1answer
625 views

How to display data in excel through data provider

@DataProvider(name = "Authentication1") public static Object[][] credentials1() { return new Object[][] { { "12234", " 6576","gfdgfdg"," dfg","gfd "}, ...
1
vote
3answers
25k views

How to pass the WebDriver instance to other Class in Selenium/Java/TestNG?

I have created 2 classes in 2 packages under one project and calling one method of class A into class B by creating object of class but it is giving me null pointer exception below is the code can any ...
0
votes
3answers
1k views

How to run only 1 annotated test method in TestNG ?

I have coded many Test Cases as Test Methods with @Test Annotation. I have used only one class for all methods. I want to run only 1 or 2 particular methods. And not run other methods. Please ...
1
vote
1answer
1k views

Why doesn't testNG assertion message get printed after each test in data-driven testing?

I am running Data-driven tests driven from a spreadsheet which are input to TestNG test Framework. In a nutshell, the framework traverses through outlook mailbox and looks for mails based on the ...
2
votes
2answers
14k views

what does this mean ? : Cannot inject @Test annotated Method [f] with [interface org.openqa.selenium.WebDriver]

My Code : import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.testng.annotations.Test; import org.openqa.*; public class NewTest { public WebDriver ...
1
vote
1answer
2k views

I cannot instantiate class using TestNG and IE Webdriver

I cannot instantiate the follow class using TestNG and IE Webdriver. Can someone identify what is wrong with my source code? public class NewQATEstClassTest { //For use of IE only; Please enable ...
1
vote
1answer
478 views

dataprovider for key value pair to run same test for different dataset

I have a data file in selenium webdriver as below: [Contact_Buyer] Title = Madam Contact_language = French [Contact_Owner] Title = sir Contact_language = English I want my test to run for each ...
2
votes
2answers
682 views

Alternative ways to implement Data-Driven Testing for Selenium 3.0?

Currently I am using Selenium 3.0 with the TestNG framework and a page factory setup for maintaining the page setup. I have been using wini for fetching data from the text file using section and ...
2
votes
5answers
487 views

Managing Test Data for UI testing

I am working on a Java/TestNG UI automation framework and having some difficulties with test data management. I use TestNG's DataProvider to pass data to the test method. I need to pass about 30 ...
1
vote
4answers
3k views

How to close all the browser instances and chromeDriver.exe even if my test cases fails?

I am using testNG with selenium to write my test cases, I observed a strange problem that is When I run my test cases, and if any test case fails or any other exception occur in between the test case ...
4
votes
6answers
9k views

How to run same test case of testng on 100 different URL/Domain?

I have one difficult scenario for automation testing. I want to run one test cases for 100 different URLs/Domain. Precondition : Script is generalize and running individuality properly. Use of ...
3
votes
3answers
5k views

How does TestNG priority work for a group?

Suppose I have five test cases out of which three are grouped in "Smoke Testing" and two have not been grouped at all. If I have set priority for all my test cases from 1 to 5, will the cases from ...
5
votes
1answer
967 views

How to run a TestNG project located on Github from Jenkins?

I know how to configure batch file to run my TestNG project on local from Jenkins. But how to configure batch file command on Jenkins to run it from Git ?
2
votes
1answer
2k views

GeckoDriver error in TestNG that works in plain JAVA

The gecko driver path that works in JAVA is causing an error in TestNG. Environment: Win 10 FF selenium-java-3.0.1 geckodriver-v0.11.1-win64 eclipse-java-neon-2-win32-x86_64 I suspect I'm placing ...
4
votes
3answers
4k views

Selenium WebDriver tests sometimes doesn't find elements

I am pretty new to all the Automated Testing thing and recently I have been having trouble with selenium because sometimes fails finding certain input fields / buttons. I added explicit waits for ...
1
vote
1answer
643 views

Excel Data overite problem

I have generate testcases for the login and register page so,i want to display testresult in excel sheet but problem is that when i run testng.xml file then data is overrite into file .i want to ...
0
votes
1answer
358 views

Display error while generating excel report using TestNG

I am trying to generate excel file for displaying TestNG report into excel sheet. For that I created simple program for creating excel sheet and display static data, but it's displaying error
2
votes
3answers
268 views

How to verify the body context using Assert command [closed]

I want to pass my test.When I run my test it gets fail because expected and actual is not matching. How to do with assert command? When I copy the actual value it shows like an error: {"level":"...
1
vote
2answers
364 views

Test Automation Framework: How to integrate other project to a Black-box Automation Test Framework

I've been spending for at least 3 months building a Test Automation Framework from scratch using Selenium WebDriver(Java) and TestNG. I have adapted the concepts of page-object-model, integrated excel ...
0
votes
4answers
6k views

How to modify TestNG report?

I have generated a test suite and run the testng.xml file and default report is generated accordingly. I want to modify default generated report. I want to display one column which shows the pass ...
0
votes
1answer
881 views

How to display input data in testng report

I have generate TestNG report in eclipse to display results of fail/pass testcases, but in report it does not display which input string I had passed into textbox. So I want to display input string in ...
0
votes
3answers
437 views

How to run testcases on one browser

I have created some test cases in Eclipse. But while running the testng.xml file it opens in a new browser every time. How do I run it in single browser? I am calling below for each test case, so ...
1
vote
1answer
1k views

TestNG Report display Blank

I have created testcases in eclipse. I am trying to run that using TestNG, it displays output in console for fail and pass testcases, but I have open emailable-report.html from the test-output folder, ...
3
votes
1answer
8k views

Executing parallel and sequential TestNG tests in one run

We have a group of tests that can be run in parallel and a group of tests that can only be run sequentially. I would like TestNG to execute all of them in one run but schedule sequential tests ...
2
votes
3answers
5k views

TestNG cannot find parameter for test

I am using selenium webdriver, maven for dependency and java lanaguage and I'm following page object design pattern. This is my first time I am using maven. I am automating a login page. Here browser ...
3
votes
2answers
1k views

How to find broken link in Selenium, when a http page have https link and mail address in page body?

I have a http page. Can I verify any broken link when a page has no https link and mail address in the page body. Is there any way to find the broken link using selenium webdriver in java, when page ...
0
votes
3answers
852 views

WebDriver+TestNG+Eclipse, Failing of Assertion in Try block doesn't pass the debugger to catch block

Please see a simplified code below public class testClass { static WebDriver driver; @Test public void Checking() { driver = new FirefoxDriver(); driver.get("http:/...
0
votes
2answers
12k 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
170 views

Error in my page

I am using selenium with page factory method to automate a login page. An error came when I try to run my code. My complete code is.. package com.docmgr.Pages; import org.openqa.selenium.WebDriver; ...
0
votes
2answers
92 views

Selenium Webdriver testNG [closed]

I have created three classes in TestNG and every time that I run my test.xml file it is then opening up multiple instance of IE. I need to do the the following activity in single browser instance :- ...
3
votes
1answer
1k views

Data Validation Testing using selenium

I am doing functional automation testing for a web application for analytics using selenium+TestNG. This application fetches huge amount of data from database and displays it on the platform after ...
5
votes
5answers
1k views

Reading locators for Testing suite from an external file

I am currently working on a building an automation testing framework using selenium+TestNG with over 1000 test cases. The test cases I am writing use a lot of elements and I was thinking is it a good ...
0
votes
2answers
4k views

TestNG +Selenium : How to resolve exception: “java.lang.IllegalStateException”?

I am getting following error when run my selenium webdriver program using testNG (Using Eclipse Kepler service release 2) Cannot instantiate class TestNG.TestNGClass at org.testng.internal....

1 2 3
4
5
7