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
1
vote
1answer
51 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 ...
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 ...
2
votes
3answers
11k views

Using multiple instances of webDriver

I have defined an object of Web driver in one class as Static WebDriver driver; and want to use that instance in another class to automate the browser. Is it possible? Or will I have to define ...
0
votes
1answer
19 views

Unsuccessful Test Continues to Next Test With No Output

setUp: To save time starting/closing browser, logging in/out, I've started grouping regression tests in common classes. I know there are other ways to do this, this one made most sense for our ...
1
vote
2answers
5k 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....
4
votes
6answers
8k 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 ...
4
votes
3answers
12k 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) ...
5
votes
4answers
1k 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 agile 2 week sprints. We have a release after every 3 sprints. In our framework we ...
0
votes
2answers
33 views

How to rerun failed test from where they instead of from beginning? (TestNG)

Is there any way to re run the failed testcase from the page where it got failed instead of running the testcase from beginning in Selenium Java ?
0
votes
2answers
74 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
15 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 ...
1
vote
2answers
2k views

Class Under Test vs Object Under Test

What is the difference between Class Under Test (CUT) and Object Under Test (OUT)? CUT is used to test a class and OUT is used to test an object. I'm unable to find any difference other ...
0
votes
1answer
47 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
80 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
0answers
18 views

Looking for a java library automate third party Java-Swing application without access to the source code

I'm looking to automate a third party java swing application that my company uses. I don't have access to it's source code so a lot of the swing testing libraries like Assert-J won't work. I'd like to ...
0
votes
1answer
46 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
1answer
34 views

TestNG with multiple datadriven

My code structure logic is this: I have to fill three sequential forms to add a entry in a list whose data is from Excel. I need each form to have entries from different Excel sheet, i.e first form's ...
0
votes
1answer
81 views

Selenium TestNG - java.lang.NullPointerException in automation testing

I am trying to test the login function to my android app. But it displays an exception error java.lang.NullPointerException. Code as follows: package tests; import java.io.IOException; import java....
0
votes
2answers
56 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
97 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). ...
1
vote
5answers
29k 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 ...
0
votes
1answer
100 views

How to resolve the “java.lang.nullpointerexception null value in entry url=null ” in Selenium(POM)

1.TestCommands.java public class TestCommands { public void click(By locator,WebDriver driver){ try { WebElement element = driver.findElement(locator); element.click(); ...
12
votes
3answers
13k views

Automated tests pass every time when run individually, but when they are clumped into a test suite it's a toss up if the tests will pass

I have around 200 test classes for my web application at the moment. I use Selenium2/Webdriver and the tests are written in java, with TestNG used as my framework. When I run each test by itself, ...
0
votes
2answers
417 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 ...
-1
votes
2answers
10k views

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

[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....
1
vote
1answer
22 views

Unable to get multiple browsers working with Chrome and IE Edge browsers

I am new to QA testing; I was practicing automating test case in TestNg but can't seem to get the cross browsers to work. The test keeps failing. It worked when it was just one browser. Any ...
0
votes
1answer
33 views

gitignore of Selenium WebDriver TestNG

For selenium webdriver testng using git, what should be part of gitignore so my scripts can run on any computer without any conflict. Thanks!
7
votes
5answers
2k views

Page Object Model or External property file for Selenium Object Repository

I am a beginner in Selenium WebDriver (Java with TestNg). I'm trying to create a framework of my own. My question here is what would be the better option to store my objects (basically all the ...
1
vote
3answers
2k 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 ...
0
votes
2answers
11k 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"...
0
votes
1answer
983 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(...
4
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
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 ...
4
votes
3answers
2k views

Running failed test cases in TestNG

I have a suite which consists of 2 test cases. When I run this suite, the results should be 1 passed and 1 failed. When I am trying to run the failed test cases through TestNG-failed.xml file, it is ...
4
votes
1answer
2k views

TestNG: Multiple suite files are not running but single xml file is running multiple times

This is my testng.xml file: <suite name="Suite1" verbose="1" parallel="true" thread-count="5"> <suite-files> <suite-file path="xml-files/live.xml"></suite-file> ...
0
votes
0answers
15 views

PackageRelationshipCollection issue in selenium

Exception in thread "main" java.lang.IllegalAccessError: tried to access method org.apache.poi.util.POILogger.log(ILjava/lang/Object;)V from class org.apache.poi.openxml4j.opc....
0
votes
3answers
208 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
1answer
59 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 ...
-1
votes
1answer
57 views

Extent reports issue in maven project

I am using extent reports in my project but it is showing me error and I am not getting solution for this error: [RemoteTestNG] detected TestNG version 6.14.3 Starting ChromeDriver 75.0.3770.140 (...
0
votes
2answers
31 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 ...
0
votes
2answers
218 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
1answer
43 views

Unable to Run Tests on Edge browser in Jenkins

I am trying to run my Tests in the Jenkins using Microsoft Edge. When I click on build now, I am getting the below error in the Console Output ------------------------------------------------------ ...
-1
votes
1answer
31 views

Can I use this library for Junit?

I put this library: import org.apache.commons.io.FileUtils; but it sends an error The import org.apache.commons.io cannot be resolved what library is equivalent exist for Junit?
0
votes
2answers
109 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 ...
0
votes
2answers
1k 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 ...
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
1answer
65 views

How to handle multiple tests in same webdriver instance without closing and opening browser again?

Below is my testscript, have called other class methods to it. I would like to divide the testcases to different tests. Now running all in one that would increase my count again more. @Listeners(...
-1
votes
1answer
42 views

How to validate test logic for date dropdown?

I have a close date field where the date is already populated, and a date creation field which is the actual activity creation date and the logic I want to validate is below - Validate that the ...
0
votes
1answer
32 views

Using priority in test cases with retry listener

I have test cases which have priority tags on them. Let's say 30 cases run sequentially one by one. But this does not allow me to attach a retry listener to my cases due to tests being dependent on ...
1
vote
2answers
355 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 ...