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
0answers
18 views

Maven-Extent Reports-Exception in thread “main” java.lang.NoClassDefFoundError: com/aventstack/extentreports/reporter/ExtentHtmlReporter

I am using testng to run automation scripts and ExtentReports for report generation. I have a main method that calls the testng.xml file. When i run the main class->Run as -> Java application-> ...
0
votes
2answers
27 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
0answers
21 views

Is it possible to test a particular part of code in Selenium TestNG based on the result of the @BeforeTest results?

I'm using testNG for my testing, I have created 4 test functions for different seniors like create profile, login etc.., Some time my home page is showing 505 error. So, during that time I don't want ...
0
votes
3answers
49 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 ...
0
votes
1answer
52 views

How to format TestNG reports in second not millisecond ?

I want convert the milliseconds to seconds in TestNg emailable report. Please help?
0
votes
0answers
18 views

Launch appium desktop programmatically' and link to a testNG TestCase for mac. How do I do this?

I have created a java test class to run appium programmatically . I cannot use a .bat file as I am a Mac user and .bat files only work on windows o/s This is my FIRST appium framework so I am ...
1
vote
1answer
97 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="...
0
votes
0answers
18 views

Sliding element horizontally

As example Amazon.com I made a JavaScript object Using that object I scrolled down the page But when I selected the element and tried scrolling it horizontally, neither the page is scrolling down ...
-1
votes
3answers
54 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
24 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
98 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
0answers
48 views

Not able to run selenium scripts from Jenkins

I am running selenium scripts using eclipse.Now I want to schedule it using jenkins. Which are the jars apart from selenium jars should I place in my project lib folder and what should be the content ...
0
votes
1answer
39 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
53 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
195 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
27 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
317 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
217 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
131 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
66 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
58 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
208 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
46 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
17 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 ...
1
vote
1answer
793 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
0answers
368 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
123 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
50 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
0answers
76 views

Selenium Java + TestNG with TFS integration-

I have my selenium code in Java with TestNg framework (used Eclipse as code editor), but now I need to integrate it in TFS. I am very new to TFS but I have seen many ppl told it is possible so if ...
1
vote
0answers
165 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
333 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) ...
0
votes
3answers
269 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
146 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 ...
0
votes
1answer
605 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 ...
0
votes
1answer
126 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 ...
0
votes
1answer
40 views

Appium - test scripts are not executing on new activity

I am performing a sign in operation on the Android application using appium test scripts. The test scripts doesn't execute the lines of code related to the new activity. It works on debug mode or ...
-2
votes
1answer
87 views

Page chaining in POM method

I have created three packages. generic webpage script In generic I have base test and other common methods. In webpage I created class for each web page. In Script I have my testcases. I need ...
1
vote
3answers
2k views

How to print a message after checking through TestNG's Assert.assertEquals method?

I'm getting a string value from a function. Now I want to print a message saying whether expected string and actual string are different or not. To compare these string I'm using TestNG's Assert....
1
vote
1answer
46 views

When submitting a form by fetching values from excel file it is showing Internal Server Error

When submitting a form by fetching values from excel file it is showing Internal Server Error but when I put static values in code and run it successfully submits the form without any error. Here is ...
0
votes
1answer
520 views

Getting 'nullPointerException' in @AfterMethod [closed]

Code: import java.util.concurrent.TimeUnit; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.testng.annotations.AfterMethod; import org.testng....
0
votes
0answers
74 views

While generating XSLT Reports it is showing “testng-results.xml does not exist” need help to figure out if I am missing something

C:\Users\mc\eclipse-workspace\XSLTPractice>ant generateReport Buildfile: C:\Users\mc\eclipse-workspace\XSLTPractice\build.xml generateReport: [delete] Deleting directory C:\Users\mc\eclipse-...
0
votes
0answers
462 views

TestNG with cucumber parallel runners, how to use a listener?

I use a parallel plugin for building out testNG runners for cucumber scenario/feature files. This creates a ton of customised runners in /target as part of the maven lifecycle. How can I use some ...
1
vote
0answers
231 views

How can I make my solution thread safe for testNG parallel execution?

Background: For quite some time I have ran automated tests using forked JVM processes, this proved quite easy when injecting a driver object using spring, I could simply provide the following: @Bean(...
2
votes
4answers
480 views

Assertion message with TestNG

I use TestNG for assertion, for example with this assertTrue: Assert.assertTrue(boolean b, String s) If the assert is failed, then the String s will be printed out, and if assertion is passed, then ...
1
vote
2answers
69 views

Selenium WebDriver: Should all @Test modules connected to each other?

1. Should all automated test modules connected to each other ? Like, when I have a @Test module for Registration, after executing that module, can I connect this test to @Test Login, @Test Login to @...
1
vote
2answers
280 views

Selenium: Getting error with webElement or Webdriver “Drive” Variable

New to automation. Help is greatly needed Anybody could help me with following code Why i am getting NullPointerException? Error: Null pointer access: The variable driver can only be null at this ...
0
votes
0answers
627 views

Due to TestNG versioning in Eclipse Oxygen Test cases are not running

I am using TestNG 6.8.5 with Spring. While running the test cases eclipse console gives following exception: [RemoteTestNG] detected TestNG version 6.8.2 org.testng.TestNGException: Cannot ...
1
vote
2answers
788 views

Can't use if condition using selenium webdriver

I've got the following situation: I want to fill a field which is displayed some times and others don't. So, to solve this I used a if condition along with page objects. public static WebElement ...
0
votes
1answer
140 views

Remove tests that were not executed from Allure report

While running test I use different test-suites (xml files with list of tests to execute). E.g. I need to run smoke-tests so I choose corresponding xml with simplest tests (login/logout; selecting main ...
2
votes
3answers
1k views

How to test using one excel dataprovider in TestNG for multiple test cases

I created a testdata in Excel with multiple test cases. Ex: #UserName# #Password# #PhoneNumber# invalidUsername validPassword validPhoneNumber vaidUsername invalidPassword ...