All Questions
Tagged with automated-testing testng
147 questions
26
votes
6
answers
122k
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 ...
14
votes
3
answers
20k
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, ...
7
votes
2
answers
30k
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
3
answers
30k
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)
...
6
votes
3
answers
15k
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 "...
6
votes
5
answers
2k
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 ...
5
votes
9
answers
105k
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 ...
5
votes
4
answers
241
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 ...
5
votes
5
answers
10k
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
6
answers
25k
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
3
answers
11k
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
6
answers
12k
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
3
answers
14k
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 ...
3
votes
2
answers
76k
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 ...
3
votes
4
answers
7k
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 ...
3
votes
2
answers
703
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
4
answers
9k
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
2
answers
2k
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
3
answers
2k
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 ...
3
votes
4
answers
9k
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
1
answer
11k
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
1
answer
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
1
answer
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
2
answers
2k
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
4
answers
19k
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
0
answers
1k
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
3
answers
26k
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
2
answers
77
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
4
answers
7k
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
3
answers
17k
views
Using multiple instances of webDriver
I have defined an object of Web driver in one class as
Static WebDriver driver;
and want to use that instance in another class to automate the browser. Is it possible? Or will I have to define ...
2
votes
1
answer
327
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 ...
2
votes
2
answers
8k
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 ...
2
votes
2
answers
247
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(...
2
votes
1
answer
2k
views
testNG, Java: How to combine a few Data Providers in one test?
In the provided test I need to read the data from the cell in Excel and it works.
I would also like to add the functionality to store the price of the product in another cell in the Excel.
I've split, ...
2
votes
2
answers
8k
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 ...
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 ...
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 ...
2
votes
1
answer
218
views
Selenium Dataprovider returns a NegativeArrayException when called from different class
I have an excel, which contains multiple worksheets in it. Each worksheet contains multiple columns. I have a class like this.
public class dptwo extends dpone {
@Test(dataProviderClass = testdp.class,...
2
votes
1
answer
33
views
Unable to get multiple browsers working with Chrome and IE Edge browsers
I'm new to QA testing.
I was practicing automating test case in TestNg, but can't seem to get the cross browsers to work. The test keeps failing.
It worked when it was just one browser. Any ...
2
votes
2
answers
6k
views
How to execute just 50 test cases out of 500 test cases in testNG
There are 500 test cases in my suite. I want to select only 50 test cases and execute them. Is there a way to do it using testNG
2
votes
1
answer
1k
views
Is there any ways to run any method or line of code after @AfterSuite in TestNG?
I am having below configuration,
Maven project
Execute test case through testng.xml
External code to write report
Here I have write code to generate reports. It depends on complete all test cases ...
2
votes
0
answers
337
views
BeforeClass doesn't get displayed in TestNG test results window
We are expanding our TestNG suite to run multiple tests. Doing so we've encountered a strange occurrence.
In one suite I have two tests. Both tests have one class each. Tests in IntegrationTest.java ...
2
votes
2
answers
1k
views
Alternative ways to implement Data-Driven Testing for Selenium 3.0?
Currently I am using Selenium 3.0 with the TestNG framework and a page factory setup for maintaining the page setup. I have been using wini for fetching data from the text file using section and ...
2
votes
1
answer
6k
views
send testng report(emailable-report.html) file through mail after executing all test cases
I am trying to send an email after executing the test cases with an attachment of testng generated emailable-report.html file ,But I am resulting in error.
please find the stack trace here and do ...
2
votes
0
answers
752
views
How to keep test cases synced with HP ALM after refactoring?
We're planning to automate test synchronization between HP ALM QC and our TestNG test cases. We want to keep them synced in the following scenarios:
Test adding: When creating TestNG test, a test ...
2
votes
0
answers
1k
views
How to report test execution method when using @Factory in TestNG? [closed]
I am using @Factory annotation from TestNG to create tests dynamically. It will read a property file that contains the list of test cases to be executed and return them.
@Factory
public Object[] dp()...
1
vote
3
answers
211
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
1
answer
1k
views
Null Pointer Exception Error at Selenium TestNG
I'm trying to automate the search box but I'm getting null pointer exception.
package LICT.Maven_ReCheck_Search;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.WebDriver;
import ...
1
vote
2
answers
1k
views
How to write meaningful test case title in TestNG+Selenium
When writing manual test cases, the test case title used to be something like
TC1: Verify that the user is able to login to facebook and react using
heart.
When trying to automate the scenario ...
1
vote
5
answers
32k
views
Get Text of a WebElement
I'm learning selenium and writing automation script for this website.
I'm trying to get value of the error message, I identified Error Message WebElement using xpath:
".//*[@id='ajax_loginform']/p[@...