Java Test Automation / Quiz
@DataProvider: Feeding the Machine
Object[][], Iterator laziness, dataProviderClass, and parallel data feeds, TestNG's answer to running one test a hundred ways.
- Difficulty
- Medium
- Format
- Quiz
- Points
- 150
- Estimate
- 9 min
// MISSION BRIEF
Your Mission
Data-driven testing is TestNG's home turf. A @DataProvider turns one test method into N reported invocations, and its details (return types, naming, cross-class wiring, parallelism) are exactly what interviews and code reviews probe.
Know the mechanics cold: what a provider may return, how the test finds it, and what parallel = true really does.
// FIRST CONTACT
Battle teaser
A classic @DataProvider method returns:
- AList<String> only
- BObject[][], each inner array being the argument list for one test invocation (Iterator<Object[]> also works)
- Cvoid, it fills a shared context object
- DA CSV file path that TestNG parses
Answers, scoring, hints, and the full battle stay sealed.
// SKILL TAGS
javatestngdataprovider