Skip to main content

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
0 votes
0 answers
22 views

Cucumber selenium testng getting error in testrunner

package Runner; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; import io....
Anil's user avatar
  • 1
0 votes
0 answers
22 views

Using Driver Factory, create reusable method

Objective: In our automation suite, we are using the driver factory implementation and would like to have it in a reusable method. So, In our tests, we do the following ( want to get away from this ...
Michael J Frazier's user avatar
0 votes
4 answers
131 views

why do we need to verify test page title in selenium

I am a new to use selenium to do web automation test. Why do we need to verify the page title by assertEquals(actualTitle, expectedTitle) to do the test? The actualTitle value I copied from HTML title ...
user3559982's user avatar
0 votes
0 answers
851 views

io.restassured.path.json.exception.JsonPathException: Failed to parse the JSON document

[RemoteTestNG] detected TestNG version 7.8.0 FAILED: files.Dynamic.addBook io.restassured.path.json.exception.JsonPathException: Failed to parse the JSON document at io.restassured.path.json....
poorna pragna's user avatar
0 votes
1 answer
56 views

Cucumber, TestNG, Parallel - sometimes webdriver not controlling browser

I'm using Cucumber, TestNG, WebDriver, WebDriverFactory and PicoContainer. Scenarios run in parallel. I'm getting strange intermittent failures - every now and then (perhaps one in 20 runs) in one of ...
Scott Deagan's user avatar
0 votes
0 answers
192 views

How can I run all the tests of a class sequentially using each dataset from @DataProvider in TestNG

I have a test class with few tests in it. A data provider which takes data from excel sheet. What I am trying to achieve is having one data set, say dataset1, and run all the tests of the test class, ...
Pypal's user avatar
  • 31
0 votes
0 answers
67 views

The selector is not recognized by selenium java

I have the following HTML code for a button: <div class="link" data-background-color="#fb00ff" style="background-color: rgb(251, 0, 255);"> <div data-replace-...
AAa's user avatar
  • 1
0 votes
0 answers
69 views

Execute same test scenarios in two different browsers simultaneously

We have created web automation scripts for particular website. And now the manual QA team requested to automate mobile responsiveness as well so we are using below code to achieve mobile ...
Darshani Kaushalya's user avatar
0 votes
0 answers
47 views

Multiple verifications under one test - if one of the verification fails how to continue to verify the remaining

I'm working with selenium/Java /TestNG Maven project. Main function calls multiple validation from java class. If any one of the verification fails, the remaining are skipped. From the below code if, ...
Padmaja's user avatar
1 vote
1 answer
216 views

What is the best practice of dependsOnMethods in TestNg?

I know that having interdependent tests is a bad idea. But, then my question is: What are the valid usecases of dependsOnMethods which TestNg team provided ? In other word, under what conditions i can ...
Jimmy's user avatar
  • 249
0 votes
0 answers
40 views

why my page is not scrolling full at the bottom in selenium testNG(java)?

The images below are my codes(Singleton,homepage and test classes) I'm new to automation and I tried to achieve POM using Singleton now my problem is whenever I try to run my test cases it navigates ...
Shabbin Hossain's user avatar
0 votes
0 answers
17 views

Getting NullPointerException while running the simple testNG script

Code as below: Public class sample { @Test Public void test() { Syso("hi"); } }
user55826's user avatar
0 votes
0 answers
415 views

Cucumber TestNG Gradle Parallel Execution ThreadCount

I am trying to run my Cucumber scenarios in parallel using the TestNG. But when I run it 'parallel=true' it executes the test cases in thread count=10 (testng default). I want to customise the thread ...
Alok's user avatar
  • 760
0 votes
2 answers
1k views

perform button click if specific element is present

I have a product list and some products have discount available. I want to click buy if discount price text is available. Below is a product with discount <article class="commerce-product--...
Darshani Kaushalya's user avatar
0 votes
1 answer
2k views

Test has been compiled by a more recent version of the Java Runtime (org/testng/annotations/TestNG)

I found my issue below when using this dependencies: </dependency> <dependency> <groupId>io.appium</groupId> <artifactId>java-...
barzilai zio's user avatar
0 votes
1 answer
587 views

Verify search results using boolean value in if else

I have to automate the functionality of search.There are 2 possible out comes. one is result is generated the other is results not found. if there are matching results to search criteria a new div ...
Darshani Kaushalya's user avatar
-2 votes
1 answer
4k views

Getting javascript error: element is not defined

I am trying to verify carousel has auto flash and manual selection options. For manual option I checked the slick dots are clickable. For auto flash option I am checking the style animate-repeate is ...
Darshani Kaushalya's user avatar
0 votes
2 answers
12k views

Loop through list of elements and perform a button click

I'm trying to loop through a list of products and identify a product with discount/promotion. if product with discount is available I want to go inside that product clicking buy now and exist for loop....
Darshani Kaushalya's user avatar
0 votes
2 answers
2k views

Stale Element Exception when looping through list of elements

I am trying to loop through a list of products, identify products with discount and click on the first product with discount and and navigate to product page. While looping through for loop I get ...
Darshani Kaushalya's user avatar
0 votes
0 answers
355 views

How to verify the Json response field data type in rest assured test

How can we verify the Json data type of mentioned fields such as "price", "ck", "name", "enabled" and "tags" in rest assured test. { "odd":...
swapnil shirke's user avatar
0 votes
1 answer
8k views

Run as testng is not found in eclipse

I have switched to a new branch and created new TestNG XML to run different test suite. But when I tried to run it as a TestNG suite eclipse only suggests run as configurations. I have set the suite ...
Darshani Kaushalya's user avatar
0 votes
1 answer
1k views

Is there any way to trigger before Method only for specific test methods

I need to prepare some data before running some test methods in my test class. But these data will be used only in 5 test methods only. The entire test class has 25 test cases. So is there any way to ...
ChathuD's user avatar
  • 2,147
0 votes
1 answer
375 views

My TestNG BeforeMethod and AfterMethod annotations are not executing before or after the @Test annotated method

Folksm I'm using TestNG 7.5 and Selenium 4.2.2, with IntelliJ and Java 11. I've got all my bits imported and my tests will run individually, but I'm trying to get my setup and cleanup methods to work ...
shaidyn's user avatar
0 votes
1 answer
7k views

Cannot invoke "org.openqa.selenium.SearchContext.findElement(org.openqa.selenium.By)" because "this.searchContext" is null error

I am trying to verify a functionality as a guest user and logged in user. In order to do that I log out form the system and verify the guest user actions then login again and verify logged in user ...
Darshani Kaushalya's user avatar
0 votes
1 answer
805 views

Compilation stuck at find element by xpath without giving any error

I'm trying to automate a project using selenium page object model. Below is the html code <div class="type-1 overflow-hidden card"><div class="col-xl-8 offset-xl-2">&...
Darshani Kaushalya's user avatar
0 votes
1 answer
244 views

Appium: Parallel execution halts if test is complete on one of the device

I am trying to run 2 different tests on 2 different emulators parallelly. But my execution halts on 1 device as soon as the test on other device is complete. I am using the below driver setup code ...
Sanjay Bhatia's user avatar
0 votes
1 answer
1k views

Problem finding element with text when the text contains &nbsb;

I have the following element in the DOM: <div id="sourceListDiv"> <select id="sourceList" onkeydown="uil.handleKeyDown(this)" size="15" ondblclick=&...
Haris Psarropoulos's user avatar
0 votes
1 answer
134 views

How do i get rid of duplicated local variables

I have a multiple drop-downs and need to automate them. I added the code below, how do I add them in one step? or make it easier or how do I add them in one function? I'm using eclipse and TestNG ...
user52764's user avatar
-1 votes
1 answer
426 views

Custom Framework for Writing a Test that Reads a CSV File into a HashMap

I am trying to complete a lab where we are asked to write a unit test that can read a csv file into a hashmap. So far I have this: import java.io.BufferedReader; import java.io.FileReader; import java....
Seeth's user avatar
  • 11
0 votes
1 answer
109 views

Override Static Method for TestNg Class

Is there a way to add a screenshot in this Assert method? When my softAssert fails, I need it to take a screenshot here. Method of Assert.class : static public void fail(String message) { throw ...
Yan's user avatar
  • 11
0 votes
0 answers
1k views

Facing error java.lang.RuntimeException: java.lang.NoSuchMethodException: jdk.proxy2.$Proxy9.proxyClassLookup() on run appium with POM

Hi everyone im facing this error on run appium with POM here is complete error java.lang.RuntimeException: java.lang.NoSuchMethodException: jdk.proxy2.$Proxy9.proxyClassLookup() at io.appium....
uzair shahid's user avatar
2 votes
2 answers
245 views

Is it necessary to Assert web page title in every case?

I am writing a script in Selenium and TestNG to automate Add User profile pages. Now, when I land on every new page, then do I need to write Assert.equals("add user profile", driver.gettitle(...
Nitin67's user avatar
  • 31
1 vote
0 answers
464 views

Selenium- Parallel test case using testng not working correctly. The same working fine in sequential mode

The driver instance initializes as Threadsafe. Till the launching of the browser and pass the URL everything seems to be working. But the credentials passing on anyone's browser, instead of all ...
Niks 's user avatar
1 vote
3 answers
3k views

When should we use Assert.true() instead of Assert.equals() method in Selenium?

What's the difference between these 2 Assert class methods?
Tester68's user avatar
0 votes
1 answer
200 views

Why dont we use the main() method in TestNG class?

public class Tests{ @Test public void run(){ sop("this is test method 1"); } } How will Jvm know about entry point of the program? 🤔
Tester68's user avatar
0 votes
1 answer
1k views

TestNG parallel execution get failed becouse im using same WebDriver on all tests

There is a situation where I have 150 test cases and I have set up Test NG parallel test execution. Unfortunately, I'm using the same web driver which initialized at the test base class on all the ...
ChathuD's user avatar
  • 2,147
0 votes
2 answers
2k views

How can I run a login test for 100 users at the same time using Selenium, TestNG and Cucumber? [closed]

I am a newbie in Automation testing. I have a list of 100 users in a excel spreadsheet: User1: userid1/password1 User2: userid2/password2 ... and so on. I need to create a script and make all 100 ...
matt038's user avatar
  • 13
0 votes
2 answers
54 views

Seeing NullPointerException on running TestNG Selenium Framework

Written the Test Script in TestNG framework where the Open browser activity is happening in "baseClass" under @BeforeTest annotation and the Test Script is written in Test Packages under as @...
Rahil Kumar's user avatar
0 votes
1 answer
1k views

Custom Test Case Name in TestNg HTML reports

I am trying to override the test case name in the testNg HTML report since I am using the data provider and each test data depicts something different. To do this, I added the following: I am setting ...
MarioBros's user avatar
0 votes
3 answers
63 views

How to have just one pre-requisite check in TestNG for multiple tests distributed across classes

I have a Test Automation project using TestNg. I want to make sure certain configurations are enabled before I start some of the tests. I have written this as a test and marked other tests as ...
Deepak Gopal's user avatar
1 vote
2 answers
840 views

How to automatically execute failed testing cases on Jenkins using extent report

I'm looking for a solution to execute failed test cases automatically on Jenkins. I'm currently running test cases through pom.xml which points to testng.xml I'm using extent reports to capture and ...
Shavaiz Safdar's user avatar
1 vote
1 answer
1k views

@BeforeMethod/@AfterMethod(onlyForGroups) methods did not execute, if a test method belonging to this group is executed

I am running a test suite with the test methods belonging to a certain groups. Below is the Selenium code: public class BaseClass { @BeforeMethod(onlyForGroups = {"P1"}) public void ...
Sandesh Sawant's user avatar
0 votes
1 answer
701 views

TestNG: @BeforeMethod/@AfterMethod methods having no groups assigned are executed for the test method which have groups assigned

I am trying to run all the test methods irrespective of whether they belong to any group or not. Below is the Selenium code: public class BaseClass { @BeforeMethod(onlyForGroups = {"P1"}...
Sandesh Sawant's user avatar
1 vote
1 answer
90 views

How to retrieve test method status and other values in IReporter implementation

I need to retrieve test method status, actual result, expected result & other attributes in IReporter implementation. Is it possible to use ITestResult to pass required data to generateReport() ...
senura's user avatar
  • 21
2 votes
2 answers
3k views

java.lang.UnsupportedClassVersionError -CucumberJvm4SMFormatter -Java runtime Version error

My testing framework is built with Cucumber, TestNG, Java 1.8 and Maven I recently updated my IntelliJ IDE Details: IDE : IntelliJ IDEA Ultimate 2020.3 - Runtime version : 11.0.9 Cucumber is ...
Hima's user avatar
  • 31
1 vote
1 answer
570 views

Automated testing of Google Pub/Sub

I'm new to test automation and Google Pub/Sub. I'm developing automation scripts for regression testing. My automation framework is built with Java, Maven, Cucumber and TestNG My application is a ...
Hima's user avatar
  • 31
0 votes
1 answer
4k views

Cucumber- Selenium Getting null pointer exception while openBrowser method

I am getting null pointer exception when selenium tries to launch the browser. I have already checked step Definition. Selenium OpenBrowser Method. Chrome browser version. ( I have driver 87.04 ...
Hemant Varhekar's user avatar
2 votes
1 answer
136 views

How to debug TestNg Test Execution getting crashed due to large number of test cases

I have a test suite having 10000+ test cases, and as all these test cases run under one suite (Regression Suite), my suite getting crashed always due to very high memory consumption, maybe the size of ...
Nikunj Aggarwal's user avatar
0 votes
1 answer
10k views

Maven is not running any tests called using testng suitexml files in POM.xml

I am trying to run a test using Maven by providing the testng.xml file. It is not running any test, although the build is successful. POM.xml <project xmlns="http://maven.apache.org/POM/4.0.0&...
Sandesh Sawant's user avatar
0 votes
1 answer
1k views

Shows "[Utils] [ERROR] [Error] java.lang.NullPointerException" for data driven(excel File) API Automation test(Rest Assured)

It throws a java.lang.NullPointerException, but why it shows that, I could not find. Here is my code. ExcelUtil package Utils; import java.io.FileInputStream; import java.io.FileNotFoundException; ...
Almas Hossain's user avatar

1
2 3 4 5
8