testng-data-driven

Execute TestNG test methods against multiple data sets using DataProviders.

187|20|Updated Nov 20, 2025
One-click install
npx skills add https://github.com/TheBushidoCollective/han --skill testng-data-driven
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testng-data-driven
Source: https://github.com/TheBushidoCollective/han/tree/main/jutsu/jutsu-testng/skills/testng-data-driven
Command: npx skills add https://github.com/TheBushidoCollective/han --skill testng-data-driven

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill covers TestNG data-driven testing, including DataProviders, Factory patterns, and parameterization.

Core Features & Use Cases

  • DataProviders: Drive tests with multiple data sets.
  • Factory Patterns: Generate test instances dynamically.
  • Parameterization: Reuse tests with different inputs.

Quick Start

Create a TestNG test that uses a DataProvider to test multiple input combinations.

Frequently Asked Questions about testng-data-driven

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run the same test with multiple data sets in TestNG?

Data-driven testing in TestNG uses DataProviders to execute a single test method against multiple input combinations. A DataProvider is a method that returns an array of objects, each representing one test case. TestNG automatically runs your test once for each data set, enabling comprehensive coverage without duplicating test code.

What's the difference between DataProviders and parameterization in TestNG?

DataProviders supply test data programmatically from Java code or external sources, offering flexibility and type safety. Parameterization uses XML configuration to inject values directly into tests. DataProviders scale better for complex data sets and support dynamic data generation, while XML parameterization suits simple, static configurations.

Can I use DataProviders with TestNG Factory patterns?

Yes. Factory patterns and DataProviders complement each other in TestNG. Factories dynamically create test instances at runtime, while DataProviders feed multiple data sets to those instances. Together they enable data-driven test class instantiation and method-level parameterization for comprehensive test coverage.

How do I load test data from external sources for DataProviders?

DataProviders can retrieve data from external sources like CSV files, databases, or APIs by parsing the source in your provider method and returning the formatted data array. This decouples test data from test code and enables managing large data sets outside your test suite.

Does TestNG support parallel execution with DataProviders?

Yes. TestNG allows parallel execution at the method and class level, including tests driven by DataProviders. Configure parallel execution in your TestNG XML file, and DataProvider-driven tests will run concurrently across available threads, reducing overall test execution time.

What are method-scoped vs. class-scoped DataProviders in TestNG?

Method-scoped DataProviders supply data to a single test method only. Class-scoped DataProviders share a data set across multiple test methods in the same class. Class-scoped providers reduce redundancy when multiple tests consume the same data, improving maintainability and resource efficiency.