Questions tagged [testng-dataprovider]

TestNG @DataProvider annotation

Refers to @DataProvider, a TestNG annotation that allows combinations of parameters (test data) to be automatically injected into your test methods. It's encountered often with Selenium.

Related tags :

Reference links :

449 questions
0
votes
0 answers

How to run TestNG test classes in parallel with their own WebDriver?

I have created test classes to test specific page templates for my company's websites. For example: I have written a class called ArticleTests which inherits from a BaseTest object, which takes a URL in its constructor. My company owns many sites,…
0
votes
0 answers

Calling groovy functions from TestNG test case written in Java

The issue that I am facing is with import of the groovy package. The build error is: error: package dataProviders.singleOrder does not exist import dataProviders.singleOrder.NOSDataProvider; I have a data provider written in groovy: The groovy file…
The Roy
  • 2,178
  • 1
  • 17
  • 33
0
votes
1 answer

Getting exception in dataprovider using testNG framework

I am trying to return a map from dataprovider method in testng while reading excel using Apache POI framework. The code I have written is this @DataProvider(name="dp") public Object[][] getExcelData(String testcaseID)throws IOException { …
nikhil udgirkar
  • 367
  • 1
  • 7
  • 23
0
votes
2 answers

TestNG parallel DataProvider in tabs

I'm very new using TestNG and Java programming in general and I have a question in regards to runing testcases with dataprovider in parallel, in order to run dataprovider test cases in multiple tabs in a single chrome window instead of many…
0
votes
0 answers

Parallel execution causing test data mixing across tests

I'm automating Selenium tests using TestNG's data-provider-thread-count which runs tests in parallel. But I could see that username, password of one test i.e. driver is being passed to another one. I analyzed my code and there I could see that for…
Alpha
  • 13,320
  • 27
  • 96
  • 163
0
votes
1 answer

why data provider in testng returns 2D object array?

I am working on testNg these days but I have no idea what was design idea to return 2D object array in data provider method.
Yash Varshney
  • 365
  • 1
  • 5
  • 16
0
votes
1 answer

How to get the Numneric Value from a cell in an excel sheet

Below is the my excel sheet snapshot and code. I am trying to get the values in numeric format for Dob column. I have tried to use the line mapData.put(sheet.getRow(0).getCell(j).toString(),…
Sushobhan
  • 69
  • 1
  • 1
  • 10
0
votes
0 answers

Is it possible to make a dependency on a parameterized test in TestNG?

I have a test that runs multiple times using a data-provider and it looks something like: @DataProvider(name="data-provider-carmakers") public Object[][] dataProviderCarMakers() { return new Object[][] { {CarMaker.Ford}, …
Rodrigo Vaamonde
  • 463
  • 1
  • 6
  • 23
0
votes
2 answers

Testng delete test name data provider parameters

I have the following problem I have a test with a randomName, and I have to log two test params I provide from a DataProvider. I have implemented a method to log them as custom processed test params by concatenating them into the name. However…
ib23
  • 95
  • 1
  • 7
0
votes
1 answer

TestNG - How to pass variable's value as dataProvider name?

I have a string variable whichSet that can hold either 3 values "prd", "stg" and "int". In the Test I want to pass the value as dataProvider like this: @Test(enabled = true, dataProvider = whichSet, dataProviderClass = TestDataProvider.class) But i…
Kiddo
  • 1,910
  • 8
  • 30
  • 54
0
votes
1 answer

Why I am getting NullPointerException for the following code

I am reading an excel file using Apache POI API. I have written a Utility class. But when i call this Method, I got an error which is mentioned below. Please help me to find out the error. public class TestUtil { public static int…
khawar
  • 112
  • 1
  • 5
0
votes
2 answers

How to remove any test from TestNG results or ITestContext

Background: I am using TestNG DataProvider Requirement: Need to eliminate 1 test from the TestNG report after execution is finished. My Solution: Suppose, I need to remove the 'XYZ' test case from the report. String testName = "XYZ"; private void…
0
votes
1 answer

Use TestNG dataProvider with dependsOnGroups to set order of execution

I have several test cases that depend on each other. The order of execution can be defined in TestNG using groups and dependsOnGroups in the @Test annotation: public class MyTest { @Test(groups = { "group1" }) public void testCase1() { …
arnep
  • 5,971
  • 3
  • 35
  • 51
0
votes
2 answers

TestNG - Cannot add a list of String as data provider

I'm trying to pass a list of string as a DataProvider, here is my code: @DataProvider(name="test-urls") public Object[] testUrls(){ ArrayList data = new ArrayList<>(); // do something here to add elements //…
Kiddo
  • 1,910
  • 8
  • 30
  • 54
0
votes
2 answers

An element could not be located on the page using the given search parameters (Appium 1.13.0)

I am working on Automation for Android App. While running the script, Appium unable to find the elements. I tried using Id, Xpath. Please help me with this... Android version: 5.1.1 & 9 Appium Version: 1.13.0 Maven Project @Test public void login()…
Gireesh05
  • 1
  • 4