Skip to content

Managing different data approaching for using on tests scripts

License

Notifications You must be signed in to change notification settings

eliasnogueira/manage-testing-data-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Manage Testing Data with Java

This project belongs to a series of posts on my blog about this subject. Please feel free to contribute and send your pull requests with either better or new ways to manage data.

Run this project

As it is a testing project you don't need too much. You will need the following:

  • IDE of your choice
  • Java JDK 23+
  • Maven

Managing data through a property file

Approach Test class Support classes
Local solution to read a property file PropertiesFileTest.java ReadProperties.java, and data.properties
Solution using Owner library PropertiesFileWithOwnerTest.java PropertiesManager.java, PropertiesFile.java, and data.properties

Data Driven with JUnit

Approach Test class Support classes / files
Using the @ValueSource annotation JUnitValueSourceTest
Using the @MethodSource annotation with internal data methods InternalMethodSourceTest.java
Using the @MethodSource annotation with external data methods ExternalMethodSourceTest.java ExternalData.java
Using the @ArgumentsSource annotation with an argument provider ArgumentProviderTest.java ProductsDataArgumentProvider.java
Using the @CsvFileSource annotation with an external csv file CsvFileSourceTest.class products.csv
Using the @CsvSource annotation with the CSV notation as data provider CsvSourceTest.class

Data Driven with TestNG

Approach Test class Support classes / files
Using the @Parameters annotation TestNGParametersTest.java testng_data_parameters.xml
Using the local @DataProvider TestNGLocalDataProviderTest.java
Using an external @DataProvider TestNGExternalDataProviderTest.java TestNGDataProvider.java

About

Managing different data approaching for using on tests scripts

Resources

License

Code of conduct

Stars

Watchers

Forks

Languages