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
19
votes
5answers
75k views

How to handle dynamic changing ID's In XPath?

How to Handle Dynamic Changing IDs In XPath? for example : //div[@id='post-body-3647323225296998740']/div[1]/form[1]/input[1] In this xpath id "3647323225296998740" is changing every time when ...
13
votes
3answers
18k views

Is it possible to automate drag and drop from a file in system to a website in selenium using TestNG

Is it possible to automate drag and drop from a file in system to a website in selenium using TestNG? Same as we do in Gmail where we can send attachment by drag and drop operation? please suggest.
12
votes
3answers
15k 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, ...
9
votes
4answers
19k views

TestNG vs Robot Framework - pros and cons

What are the pros and cons of using Robot Framework with selenium2Library (webdriver). Which one is the better option for web application testing - TestNG or Robot Framework?
7
votes
5answers
3k 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 ...
6
votes
2answers
29k views

What is the difference between jUnit & TestNG?

I have started Selenium scripting in my one of the project and I want to know the exact difference between Junit & TestNG. Which one is useful for Tester in Selenium? Any reference link/Site for ...
6
votes
1answer
6k views

What is the max number of threads allowed for running TestNG tests in parallel?

I’m trying to run TestNG tests in parallel, right now I’ve set “parallel=tests” & ‘thread-count=25’ but I see that only 10 threads are running at a time. Is this testNG’s thread limit? Is there ...
6
votes
5answers
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 have ...
6
votes
2answers
215 views

Is it possible to move after and before methods to interface with Java 8?

The problem is that my test class is already implemented some class: public class MainTest extends ExecutionContext ... Thus, I can move general logic to parent class as it is usually done: public ...
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 ...
5
votes
2answers
8k views

Difference between Selenium and TestNG

Am a beginner in Selenium and am trying to learn selenium on my own by googling. One thing which I noticed was in many of the posts which I read about selenium the name of the framework by name "...
5
votes
1answer
21k views

How do I verify a Link URL using Selenium Webdriver / TestNG?

I'm trying to do an assert to make sure a correct XMLHttpRequest is made. I know that I can get the exact Request URL from the Developers Console -> Network tab -> XHR tab's general information ...
5
votes
5answers
9k views

IE not executing test case properly in selenium webdriver

I am running test cases on firefox and chrome browsers, it worked fine for me using selenium webdriver. But when it comes to using IE versions(9-11)- 1. I'm getting below mentioned error messages: ...
5
votes
1answer
1k 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 ?
5
votes
6answers
16k views

How to locate an element which is inside the iframe?

I'm new to automation testing (I'm using TestNG framework and Java language) I'm having trouble in locating an element which is inside iframe. WebElement iframeSwitch= driver.findElement(By.id("...
5
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 ...
4
votes
3answers
19k 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) ...
4
votes
3answers
7k views

How much time it takes to automate 10 test cases of an module using selenium

It's an Interview question: If each test case contains 8-10 lines within it. Then what would be the average time to automate them? I think it depends on the following factors: Complexity of the ...
4
votes
4answers
201 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 ...
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 ...
4
votes
2answers
14k views

How and where to store dynamic result/data using webdriver java

I want to know "How and where to store dynamic (Search results) result/data", I am getting the results and not sure what to do next. Also, after saving these results I want to use this in another ...
4
votes
3answers
5k 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 ...
4
votes
2answers
2k views

Is there any test result reporting tool for TestNG & Selenium WebDriver with Java?

I am using TestNG and Selenium webdriver via Java. Is there any tool that can help generate detailed test results, for example, suppose I have a test case that fails more often than not, is there a ...
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> ...
4
votes
2answers
213 views

How does TestNG influence on project performance?

The task is to measure changes in performance of a system during daytime execution. Test system description Tests are performed on java desktop application which is started with cmd command: java -...
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 ...
3
votes
2answers
91 views

What is the difference between BeforeClass and BeforeTest in TestNG - Selenium WebDriver

What is the difference between BeforeClass and BeforeTest in TestNG - Selenium WebDriver, please suggest me best link or site for this.
3
votes
3answers
584 views

How to implement a lock in Selenium with Java?

I want the Script to Openfile.exe only if the previous one i.e CreateNew.exe has finished executing. Right Now whats happening is, when I run TestNG.xml file it runs all the @Test priority wise and ...
3
votes
5answers
60k views

Unable to locate element throwing a org.openqa.selenium.NoSuchElementException in TestNG

Am unable to click on element after executing a First test second test showing a org.openqa.selenium.NoSuchElementException . My code Here: public class snapooh { WebDriver driver; @BeforeTest ...
3
votes
7answers
46k 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 ...
3
votes
2answers
2k views

How to Pause your script in selenium untill your Autoit script gets completed?

I want Selenium to wait untill and unless Autoit Script is completed. Right Now whats happening is When I run TestNG.xml file it runs all the @Test Priority wise and within 5 sec TestNg output ...
3
votes
4answers
6k 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 ...
3
votes
2answers
1k views

How to run multiple Test cases on different browsers in TestNG with Java

I'm new at TestNG. So, I want to know more details about how to run multiple test-cases on different browsers. Which Framework model should I use in my project? So that each & every part of my ...
3
votes
1answer
69 views

Problem implicit wait with wait.until

In my code, I want to wait a certain time until the command fails with implicit wait for the driver. I have parts which were loaded after entering the page and a loading-icon is visible. In these ...
3
votes
4answers
5k 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 ...
3
votes
2answers
26k 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....
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 ...
3
votes
1answer
2k 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 ...
3
votes
1answer
3k views

Is Parallel Testing possible in Cucumber with TestNG?

I am trying to implement Cucumber in my current project with TestNG and I need to execute my script parallely on multiple browsers. Is Parallel Testing possible in Cucumber? If Yes, Can any one ...
3
votes
1answer
9k views

How to run multiple browser instance with Webdriver, Java, and Junit/TestNG?

I have a test ready to be executed but it takes a long time to finish. In this test I'm feeding in csv data, so basically the whole test will run 56 times. I was wondering if there's anyway I could ...
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 ...
3
votes
1answer
6k views

The jenkins build fails when any testng test case fails. How to make it so that the build succeeds when all test-cases are run regardless of result? [closed]

In my Test Automation, when we execute the TestNg Suite XML then whenever any test case fails the Jenkins Build also fails. But I require that the TestNG report shows the proper result, either Pass ...
3
votes
1answer
2k views

Can I execute selenium test cases in a real browser with Jenkins Selenium and Maven

I am working on selenium project with Jenkins + Maven + Selenium + TestNG I have following questions. Can I execute selenium test cases in Jenkins by launching browsers? Currently it gets executed ...
3
votes
4answers
14k views

How to run TestNG failed test cases in Jenkins for Maven project?

I am new to Jenkins and I have configured it on my Windows PC. I have to run failed test cases twice before considering that they are failing. I am using TestNG and Selenium Webdriver for writing test ...
3
votes
0answers
337 views

Using maven to create a standalone jar file that executes in any OS

I am trying to create a standalone selenium-TestNG tests Jar file that can be executed in any OS as part of CI/CD. My POM.xml is as follows: <project xmlns="http://maven.apache.org/POM/4.0.0&...
3
votes
0answers
730 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(...
3
votes
1answer
6k views

Selenium webdriver - Java with Webservices

In our application we are using web-services and DB, is it possible to integrate Selenium webdriver with web-services (Soap UI)? If two different frameworks are integrated, whether this is good?. My ...
2
votes
3answers
15k 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....
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 ...
2
votes
2answers
70 views

Getting Nullpointer Exception

While i run this below code i am getting Null pointer exception. import java.util.concurrent.TimeUnit; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import ...

1
2 3 4 5
7