-
Notifications
You must be signed in to change notification settings - Fork 5
CSV Data Provider
Michael Altmann edited this page Sep 21, 2016
·
5 revisions
This extension is a data provider for CherrySeed which defines and loads test data from CSV files.
Install CSV Data Provider via NuGet.
You have to define one CSV file per entity. The name of the CSV file have to match with the entity name. How to Have a Match? For example the CSV file name is 'Person.csv' and the entity class name is 'Person'.
Within the CSV file the entity fields have to be defined in the first row. All the test data have to be defined starting second row.
This extension provide some configurations which can set via class CsvDataProviderConfiguration:
| Setting Name | Description | Default Value | Example |
|---|---|---|---|
FolderPath |
Folder path containing CSV files | "C:\Temp\TestData\" |
|
CsvFilePaths |
List of CSV file paths | "C:\Temp\TestData\Person.csv" |
|
Delimiter |
Delimiter separating values in CSV files | ";" |
"," |
This code block initiates a CSV data provider and sets it globally in CherrySeed.
var csvDataProviderConfiguration = new CsvDataProviderConfiguration()
{
FolderPath = "C:\Temp\TestData\",
Delimiter = ","
};
var csvDataProvider = new CsvDataProvider(csvDataProviderConfiguration);
var config = new CherrySeedConfiguration(cfg =>
{
...
cfg.WithDataProvider(csvDataProvider);
...
});
- Initial version