Questions tagged [testng]

TestNG stands out as a versatile testing framework specifically designed for conducting unit and functional tests within the Java programming realm. Its robust set of features includes support for parallel testing, data providers, dependencies, groups, and more, making it an invaluable tool for software quality assurance.

I am unable to retrieve a comprehensive report of all the test cases that have been executed using programmatic TestNG

Utilizing the TestNG object, I have set up to execute test cases. If the execution type in the parameters matches "Yes," it is marked as a flag for the test case name and retrieved from an Excel file. package ForNewFramework; import java.io.IOException; ...

The default maxSession in Selenium Grid2 appears to be malfunctioning when executing a testng suite with the attribute parallel="classes"

Issue Encountered - Upon observation, I noticed that the tests are executing sequentially within a single session of FireFox browser on one node. Desired Outcome - In the specific scenario of the class "IntegrationTest" containing 20 test methods(@Test), ...

Reattempting cucumber failed scenarios: Filters are not aligned: [@test1, @test, 23, 36]. Please use only one filter type [line, name, tag] at a time

Encountering an error message while attempting to re-execute failed Features in Cucumber using the rerun option, [Utils] [ERROR] [Error] java.lang.IllegalArgumentException: **Inconsistent filters: [@test1, @test, 23, 36]. Only one type [line,name,tag] can ...

Tips for utilizing one catch block to handle both TestNG assertion errors and RunTime exceptions

In my TestNG framework with Java and Selenium, I have created two custom methods to handle WebElement interactions. Here they are: // Checks if a WebElement is present on the screen public boolean isElementPresent(WebElement element) { try { e ...

Issue encountered with Windows Handle Selenium operation

Here is the code I wrote to validate a new window opening after clicking on a link: package pages; import java.io.IOException; import org.openqa.selenium.By; import org.testng.Assert; import org.testng.annotations.AfterMethod; import org.testng.annotatio ...

I'm currently in the process of automating tests for a nopCommerce website as a way to improve my skills, however, I've

Currently, I am in the process of practicing test automation on the website . However, I am facing an issue where the test stops after the first and second steps, indicating that it has passed without proceeding to the subsequent steps. The automation tool ...

How to execute parallel tests using Selenium, Java, and TestNG with the Page Factory pattern?

I am having trouble with my test execution. When running the tests sequentially they pass, but when run in parallel multiple times across different browsers, they fail. I have tried using threadlocal and manipulating driver object hashcodes, but nothing se ...

Getting elements from a table in Selenium Web Driver in JAVA is a common task for automating

Seeking ways to pinpoint Elements within the page. A table is present with numerous rows containing multiple Inputs. How can I retrieve Input from the various table rows? Below is my Java class definition: public class Setting extends Page { /**L ...

Obtaining a list of child span elements using xpath in Selenium

I am looking to retrieve all child span elements based on the following xpath //label[@for='someText']/span Expected result: <span class="someClass">"Find this text"</span> <span id="someId">" ...

What is the best way to restrict the number of threads in a TestNG dataprovider method functioning as a factory?

My current testing setup involves using Selenium to test a single-page application. I load the page in a @beforeClass method and then run all the tests within the class. Finally, I tear down the driver in the @afterClass method. To facilitate browser setu ...

What steps can be taken to proceed with test execution following a failed assertion?

Although I realize this question may be a duplicate, I have been searching for a solution since yesterday without any luck. I am currently using Selenium Webdriver 2.47.1 and TestNG for automation purposes. My automation script consists of 12 tests, wherei ...

Avoiding Selenium POM and TestNG NullPointerExceptions

I am currently working on automating my tests using web driver, testng, and the page factory. However, I have encountered a null pointer exception while executing the code provided below. HomePage Page Object Class This is the page factory class. packag ...

AssessmentMonitor using Selenium

I have implemented TestWatcher to perform certain actions based on test output. However, the function that I need to call, createScreenShot in testFailed, requires a driver as an input parameter. Unfortunately, the driver is protected and not static, as al ...

Running TestNG.xml with Datagenerators: A Step-by-Step Guide

Upon running the TestNG.xml, only the tests without data generators are executing while those with data generators are not running. This issue is resulting in a NullPointerException. Interestingly, when running the class containing a data generator on its ...

Encountering an error message stating that the element is unclickable at coordinates (355, 160

My script is encountering an issue due to the following exception: org.openqa.selenium.WebDriverException: unknown error: Element is not clickable at point (355, 160) During page loading, if the element appears in the background, Selenium attempts to ...

An issue with Maven, TestNG, and Surefire: the AfterClass method is not being executed

Could there be a reason why Maven is not executing my AfterClass method with alwaysRun=true? The BeforeClass method runs without any issues and the test passes according to the Surefire report. I am running the command in the terminal: mvn -Dtest=TestSuit ...

Would it be acceptable for me to establish a single Web Driver Instance that can be utilized throughout my entire test project, rather than creating a new one in each test class?

In my project, I typically create a Web Driver instance in all of my test classes and initialize it with Firefox Driver. Is this standard practice for automation, or should I only create it once and use it throughout the entire project? If the latter is re ...

What is the best way to create an XPath that can target specific data in an HTML table column that might change its position?

List<WebElement> brandNames = driver.findElements(By.xpath("//tbody/tr/td[1]")); I am attempting to create an xpath for "Brand Name" that will capture all the values under the "Brand Name". Each time I refresh, the "Brand Name" moves to an ...

TestNG is failing to run after the setup

What could be the issue in the code that is preventing it from running? Please provide guidance on how to resolve this. package tc1; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org ...

Tips for organizing tests and functions in TestNG

I'm a beginner with TestNG Selenium Webdriver and I'm looking to organize my tests into different classes. I'm also struggling to understand how to pass parameters to each test from the actual code. Here's an example of my current code: ...

Is it possible to create two separate 'cookie' sessions with the same browser using WebDriver?

Is it possible to have two separate 'Cookie' sessions with the same browser in WebDriver? I made changes in my TestNG file to run two test classes simultaneously using two different threads. The problem arises when both scripts try to log into an acc ...

Looking to confirm the contents of a text box?

In need of assistance to assert a value that appears in the text field labeled blNo. Struggling with using a proper assert method, any suggestions would be greatly appreciated. ...

Is there a way to run specific test cases, such as TC5 and TC10, using TestNG?

Is there a way to execute specific automation test cases out of a list of 10 using TestNG, such as TC5 and TC10? ...

Issue arises when attempting to access parameter value from testng.xml while running test class as 'TestNG Test'

My approach to retrieving the browser type (on which I want to run Selenium tests) from testng.xml involves the following code: public class TestClass { @BeforeClass public void beforeClass(ITestContext context) { String browser = con ...

What is the best way to download a file without interference from automated

I am currently working on automating tests for some websites using WebDriver, TestNG, and Java code. I have encountered a challenge with downloading files. Specifically, I am trying to download a file from the following link: http://www.labmultis.info ...

Having difficulty running cucumber test in Maven project

Below are the details of the pom file, runner file, and console output: Pom.xml file contains information about dependencies and plugins used <dependencies> <dependency> <groupId>javax.annotation</groupId> < ...

Jenkins is experiencing issues running Selenium scripts on Chrome and Firefox

My configuration includes the Selenium webdriver, along with TESTNG and Maven. I have successfully run tests on IE, Chrome, and Firefox from Eclipse. However, when I attempt to schedule these tests using Jenkins, they only work on IE and fail on Chrome an ...

Creating a TestNG runner file with the cucumber-jvm-parallel-plugin: A step-by-step guide

I am having trouble generating the TestNG runner file from my POM file. I have double-checked all the configurations and they seem to be correct. Can someone please help me with the correct configuration? <build> <pluginManagement> ...

Exploring the Differences Between Selenium-Webdriver with Java and TestNG versus Ruby

Currently, I have an automation suite using selenium-webdriver in Ruby with TestUnit. However, I have noticed that Java offers TestNg, which comes with many additional features. I am considering switching all my suites to Java and TestNg, but I also wond ...

What is the best way to transfer a string from one TestNG method to another?

During my tests, I encountered a challenge where I need to capture a string in one method and later utilize it in another method. The scenario is illustrated below: public class stackOverflowExample { public static WebDriver driver; public static Propert ...

Trying to create an allure report for my gradle IntelliJ project using a terminal command, but it seems to be taking forever to load. Additionally, I'm encountering a 404 error on

I completed running tests with the first command and then generated a report using the last command to view it. As I am new to using Allure reports, I would appreciate some guidance on how to interpret the report. Project Details Gradle: 7.2 Kotli ...

"Encountering difficulty in retrieving a parameterized value from the testNG xml file

Here is the content of the testNG.xml File: https://i.stack.imgur.com/Ojg4e.png The contents of the day4.java File are as follows: ] Displayed below is the console Result. Can anyone help me with resolving this issue? I attempted using the @optional ...

When executing concurrent "tests" in a TestNG suite, the data provider values are being duplicated for the same field

Let's consider an example scenario: In my application, there is a username field where the username is passed through a dataProvider. For instance, if I send the username as "[email protected]" During parallel test execution, the data prov ...

Before the completion of the initial test, the second selenium test has already been initiated

I am facing an issue while running two Selenium tests sequentially. I have implemented waiters in the tests to wait for elements to become visible before interacting with them. Sometimes, the second test starts executing while the first test is still waiti ...

Exploring the capabilities of TestWatcher alongside TestNG

Hey everyone, I have been using JUnit and TestWatcher in combination with Selenium (Java). Whenever a test fails or passes, I make API calls to a bug tracking tool to log the test cases and defects. Now, I am looking to generate reports for my Selenium t ...

During the second test, Selenium was unable to locate the element

Encountering the same issue with every test script I attempt to create using selenium + TestNG. After the first @test method, webdriver fails to identify elements in the following @test methods. Illustratively, consider the scenario: The web driver loads ...

What could be the reason why my TestNG xml file is not directing to my Java Class?

Why isn't my TestNG XML file able to locate my Runner Class? This is how my XML File looks like: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" > <suite name="Cucumber Framework" verbo ...

Error message: "Execution of taskkill executable not found in Selenium WebDriver"

Every time I run the driver.quit() command, it successfully opens and quits the firefox browser but I keep getting an error message saying "Unable to find executable for: taskkill". I have already set the environment variable PATH to "C:\Windows&bso ...

Is there a way to execute a TestNG/Selenium test suite concurrently in Internet Explorer across various servers?

Currently, I am working with a Selenium test suite that utilizes the IEDriver and is executed using TestNG. The main objective is to use this test suite for regression testing. My aim is to run this test suite against all of our production servers. Present ...

The extension could not be loaded from: /tmp/unzip1122743988331191494stream

In order to be compliant, the 'manifest_version' key needs to have a value of 2 and should not include quotation marks. For more information, refer to developer.chrome.com/extensions/manifestVersion.html. ...

Is there a TestNG Listener that can automatically clear the temporary folder, even if the test run is aborted through

When I run my tests, I utilize Java Selenium WebDriver along with TestNG. In the final test, I include driver.quit() to ensure that any files created in the /tmp/ folder are removed. However, if the run is interrupted (e.g. via Jenkins), the contents of ...

Is it possible to split and execute TestNG tests in portions instead of running the entire suite at once?

I am facing an issue with my testng.xml file where most of the tests are failing due to timing problems. However, when I run them in smaller chunks, they work fine. One solution I attempted was dividing the small number of tests into multiple testng.xml f ...

Tips for validating the format of a date using Selenium 2

Looking for guidance on verifying email and date formats using Selenium WebDriver with TestNG. Can anyone help? ...

Problem encountered when integrating Jenkins with Maven

Encountering a PluginResolutionException while running code through Jenkins. The code works fine in Eclipse, but throws an exception when executed in Jenkins. public class LoginPageTest extends TestBase { // Code snippet here } This is the content of t ...

Is it advisable to implement exception handling when utilizing TestNG with Selenium?

I am currently implementing a selenium keyword driven framework where I have incorporated exception handling for the methods used by the keywords. One of the methods looks like this: public void adminvehicletitle(WebElement vehicletitle, String title) { ...

Executing TestNG tests without the need of an XML file utilizing TestNG code

I have a set of tests ready, but I am facing an issue with running them. Currently, I am working in normal Java environment and to run multiple tests, I am using TestNG. However, I am unsure about how to write the code to run multiple tests using TestNG an ...

How can one extract the text specifically from the immediate element excluding any text from its sub-nodes?

<li class="lvprice prc"> <span class="bold"> $252.00 <div class="medprc"> <span class="prcVS">Trending at</span> <span class="median"> $259.85 Take a look at this Scre ...

Encountering a java.lang.StackOverflowError when executing a class as a TestNG Test in Selenium

This project serves as a demonstration, utilizing the Page Object Pattern and Data-driven framework for implementation. Within this project, concepts of inheritance and constructors are applied. The configuration file config.prpoerties contains details s ...

Validating Active element through Java with WebDriver

When logging in to Yahoo mail, the cursor automatically focuses on the Yahoo ID text field. I need to confirm whether the cursor is indeed focused on the Yahoo ID field. Here is the HTML code for the text field: <input name="login" id="username" maxlen ...

Maximize Efficiency: Running TestNG Tests Concurrently With XML and Priority Settings

In my current situation, there is a requirement for a class labeled as "Pre-Requisite" to be executed initially. Following that, I have 5 TestNG classes which need to utilize specific data gathered from the "Pre-Requisite.java" class and then run all 5 cla ...

Is it possible to run both TestNG (group) and Cucumber (tag) tests simultaneously using a single command in Maven?

I have encountered a challenging issue that has left me stumped despite numerous attempts to solve it. The current setup involves a testng framework for GUI testing, where tests are executed based on groups in a maven command. I have been tasked with creat ...

Ensure that a TestNG test is reliant on the successful completion of a previous test

I have a set of Selenium TestNG tests written in Java, where the success relies on an initial test that registers a user and completes a tutorial. Subsequent tests use the login credentials from this first test. Despite implementing retry logic (IRetryAna ...

Having trouble retrieving the value from the XML file when the key is passed as a parameter

Latest QAF Version 2.1.13 along with 2.1.14-RC1 The XML file contains the following test data - <registration> <existingdata> <title>Mr</title> <firstname>Narendra</firstname> <lastnam ...

The execution of the Selenium TestNG executable JAR is encountering errors and not

I have created a Selenium + TestNG maven project in Java using Eclipse IDE, located in the directory I:Projects. When I run the testng.xml file by right-clicking the project, it successfully launches the Chrome browser. I decided to export this project a ...

Setting up the TestNG classpath in a Maven project

I encountered a problem while executing my Testng Project Error: Unable to locate or load main class org.testng.remote.RemoteTestNG Here is the content of my POM.xml file <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org ...

Screenshot of TestNg Report

When it comes to using TestNG for reporting, I often attach screenshots as hyperlinks to test cases using Reporter.log. However, the issue arises when these screenshot file paths are located on my local system folder. How can others access these screensh ...

Struggling to retrieve data from the HTML Dom? I have already tried using getAttribute() and getText() methods within Selenium WebDriver

I attempted to extract text/value from the Html Dom using getAttribute() and getText() methods in WebDriver, but I wasn't able to retrieve any values in the console. Could someone please assist me in resolving this issue? The image provided does not contai ...

Set up the testng.xml file to execute tests in a sequential order effortlessly, without the need to

Currently, I am using selenium to automate tests for a point-of-sale application that requires communication with external devices. However, due to the limitations of an external program managing this interaction, only one browser session can be open at a ...

Is it possible to transfer parameters from an XML file to the @beforesuite method?

Is it possible to pass parameters from an XML file to the @beforesuite method? Here is a snippet from the TestNG.xml file: <suite name="Suite" verbose="1"> <test name="Selenium_TestFF"> <parameter name="Browser" value="Firefox"/> ...

Testing the number of web browser instances

Whenever I execute my tests using TestNG, multiple browser instances are launched before the tests begin. This is how my testng.xml file looks: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"> ...

Can TestNG handle multiple test suites simultaneously?

Is it possible to run multiple test suites at once? I know we can have multiple tests in one suite, but I am looking to run more than one suite simultaneously. Previous answers on this topic seem unclear. ...

Navigating Alerts with Headless Browsers (HtmlUnitDriver/Phantomjs Driver)

While utilizing the PhantomJs Driver for Headless Testing, I encountered the following exception: Sample code: import static org.testng.Assert.assertEquals; import org.openqa.selenium.Alert; import org.openqa.selenium.By; import org.openqa.selenium.Capab ...

Having trouble establishing a connection with the database using selenium

Attempting to establish a connection with the database for testing purposes led to an error: java.sql.SQLException: Client does not support authentication protocol requested by server; consider upgrading MySQL client at com.mysql.jdbc.MysqlIO.chec ...

Leveraging DataProvider in TestNG with a single instantiation of WebDriver

Trying to validate the login page control using a data provider without reinitializing the webdriver for each username and password input. I want to check all relevant scenarios on the login page at once without restarting another driver. However, I'm ...

Guide for executing two @Test methods within a single class file by utilizing WebDriver and TestNG

As I delve into the world of Web Driver, I encountered a piece of code that sparked my curiosity. Within this code snippet, there are two @Test methods residing in a single class that I am eager to run in parallel using testng.xml. Alas, a nagging questio ...

Is There a Simpler Method for Managing Test Order in TestNG?

Although I've come across similar questions, none have quite addressed my specific query... I'm currently using Selenium Webdriver 2.0 with TestNg and Java, and I'm in search of a more efficient way to manage the execution order of tests. All I really want ...

What steps are needed to generate a testng.xml file that meets these specific criteria?

Execute tests simultaneously in three different browsers - Chrome, Firefox, and IE. Each browser should launch 2 instances, resulting in a total of 6 browser instances when the testng.xml file is triggered. <suite thread-count=3 parallel="tests"> & ...

Is there a way to execute the entire test suite for a failed test case in TestNG?

I am looking to rerun the test class that failed along with its failed test cases in order to address any issues with dependent test cases. After trying to use ITestListener and IRetryAnalyzer, I found myself stuck in an infinite loop of failures when usi ...

The allure report is failing to connect with the HTML report

My attempts to include a screenshot in my allure report have been unsuccessful. @Test (priority = 1, description="SS1 Verify the login section") @Description ("Verify that user mngr116116 can logon to the system") public void login() { page = new ...

How can test case sequencing be controlled in Selenium TestNG without relying solely on the priority attribute?

If I have a test class with 10 tests, I can use the priority attribute to determine their order. Are there alternative methods for setting the priority of test cases? ...

A guide to Java Selenium testing: Extracting data from a CSV file to input into a TestNG test

As I near completion on my project, I have encountered a hurdle in reading specific rows or columns from a CSV file. Currently, my methods and code are functioning correctly. However, the challenge lies in extracting particular data from the CSV file struc ...

Getting the test report link from Jenkins using the surefire-reports testng-results.xml file

Currently, my Jenkins instance is set up to run multiple builds. After each build, a testng-results.xml file is created at target/surefire-reports/testng-results.xml. To review the results, I usually visit the HTML report on the Jenkins job homepage, whic ...

Bypass the entire test suite in the event of a failed assertion in any individual test

JUnit.xml :: <suite name="Suite" maintain-order="true" parallel="false" verbose="1"> <test name="TestCases" maintain-order="true"> <classes> <class name="functionalTests.FunctionalTestCase01"> ...

Steps to Automatically Close Browser Upon Test Failure in Parallel Testing

Struggling to find a solution for closing the browser when a test fails in Selenium. I've tried implementing an AfterMethod but unfortunately, the browser still isn't closing on fail. Any assistance would be highly appreciated! Below is my Java class: pu ...

Can a class variable be used to assign a value to the "enabled" attribute of a TestNG annotation?

My goal is to utilize a class variable called enabled_status and set its value for the enabled annotation in TestNG. Here's an example of how I am trying to achieve this: public class Test{ boolean enabled_status = false; @Test(priority=1, enabled ...