Stack Exchange Network

Stack Exchange network consists of 175 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.

14
votes
5answers
47k 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 ...
12
votes
3answers
12k 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, ...
11
votes
3answers
10k 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.
7
votes
2answers
14k 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
2answers
22k 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 ...
7
votes
3answers
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 ...
6
votes
5answers
890 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 ...
6
votes
1answer
825 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 ?
6
votes
2answers
174 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
2answers
7k 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
5answers
7k 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 ...
5
votes
1answer
4k 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 ...
5
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 ...
5
votes
1answer
17k 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
8k 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: ...
4
votes
4answers
191 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
3answers
4k 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 ...
4
votes
2answers
11k 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
2answers
212 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
6answers
9k 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("...
4
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 ...
4
votes
1answer
1k 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
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 ...
3
votes
3answers
349 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
2answers
5k 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 ...
3
votes
2answers
1k 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
1answer
117 views

How should I handle failing tests caused by external dependencies?

I have a situation where an dependent application is down and I cannot execute the test case. The test execution is automated. The test first calls the dependent application API and this API returns a ...
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
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
2answers
292 views

Which test execution framework for Java has the highest test coverage?

I found TestNG failing occasionally and when I started to investigate I found it has little test coverage. It looks like the test framework itself is poorly tested. Which other test execution ...
3
votes
2answers
16k 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
6k 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
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
1k 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
8k 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
1answer
5k 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
4answers
12k 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
2answers
657 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 ...
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 ...
3
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 ...
2
votes
3answers
3k 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
64 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 ...
2
votes
2answers
5k views

What is the difference between Priority and Depends on Method in TestNG?

I am lagging behind to understand the concept of dependsOnMethods and priority. I googled but I didn't get enough info about this. A one line answer will be greatly appreciated. Can we write multiple ...
2
votes
4answers
3k views

Assert in TestNG (Actual int value, Expected int value)

Is there anyway to assert that, actual int value = expected int value not equal to 0 Something like, Assert.assertEquals(length, 0);
2
votes
2answers
994 views

TestNg not executes @BeforeGroup if the method is in another class

My code structure is like this: I have four classes having ten tests and one @BeforeClass method to run before any of the tests. In each of four classes all tests are of one single group. And I have ...
2
votes
4answers
34k 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 ...
2
votes
2answers
2k views

Logging every action with custom “debug” method. Good idea?

I'm creating my first full framework using Selenium and TestNG and recently implemented the ability to have logging enabled which will track every action (before and after). public class CustomLogs { ...
2
votes
4answers
2k 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 ...
2
votes
2answers
575 views

Element is currently not visible" random text fields

I am getting this error "Element is currently not visible" when I try to input into textbox which is visible I've created a script to signup and I am getting this error randomly sometimes on "password"...
2
votes
2answers
6k views

How can I ensure testNG test method does not abort if any assert fails

I know there is a difference between assert and verify in Junit; the assert results in a runtime exception, causing test method execution to abort. To overcome this problem, we can have verify which ...