Skip to content

Sergiy1987/testng-dataproviders

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TestNg-DataProviders BuildStatus

This project exercises testng dataProviders

Testing

For example test case performs Selenium link count test with the data providers of the following supported data types:

  • Excel 2003
  • Excel 2007
  • Open Office Spreadsheet
  • JSON

The test inputs are defined as table with colums

ROWNUM SEARCH COUNT
1 junit 100

which are the test ID, the seach term and expected minimum count of articles found on the forum by the title search.

The following annotations are provided to the test methods:

@Test(enabled = true, singleThreaded = false, threadPoolSize = 1, invocationCount = 1, description = "searches publications for a keyword", dataProvider = "Excel 2003")
@DataFileParameters(name = "data_2003.xls", path = "${USERPROFILE}\\Desktop", sheetName = "Employee Data")
	public void test_with_Excel_2003(double rowNum, String search_keyword,
			double expected_count) throws InterruptedException {
		parseSearchResult(search_keyword, expected_count);
	}

or

@Test(enabled = true, singleThreaded = false, threadPoolSize = 1, invocationCount = 1, description = "searches publications for a keyword", dataProvider = "Excel 2007")
@DataFileParameters(name = "data_2007.xlsx", path = ".")
	public void test_with_Excel_2007(double rowNum, String search_keyword,
			double expected_count) throws InterruptedException {
		parseSearchResult(search_keyword, expected_count);
	}

or

@Test(enabled = true, singleThreaded = false, threadPoolSize = 1, invocationCount = 1, description = "searches publications for a keyword", dataProvider = "OpenOffice Spreadsheet")
@DataFileParameters(name = "data.ods", path = ".")
	public void test_with_OpenOffice_Spreadsheet(double rowNum,
			String search_keyword, double expected_count)
			throws InterruptedException {
		parseSearchResult(search_keyword, expected_count);
	}

or

@Test(enabled = true, singleThreaded = false, threadPoolSize = 1, invocationCount = 1, description = "searches publications for a keyword", dataProvider = "JSON")
@DataFileParameters(name = "data.json", path = "")
	public void test_with_JSON(String search_keyword, double expected_count)
			throws InterruptedException {
		parseSearchResult(search_keyword, expected_count);
	}

The data provider class would load all columns from Excel 2003, Excel 2007 or OpenOffice spreadsheet respectively and run test method with every row of data. It is up to the test developer to make the test method consume the correct number and type or parameters as there are columns in the spreadsheet.

Links

Maven Central

Status: pending

Author

Serguei Kouzmine

About

This project exercises TestNG data providers: Excel 2003, 2007, Open Office, JSON, csv, Fillo

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Java 100.0%