Import data from CSV file to DataTable

Hi there,

I’d like to completely separate test data from test codes, and maintain test data in CSV files for better view and editing, any easy way to do?



I found a solution, and it works for me:

function readFile(): string[] {
  const rawdata = fs.readFileSync(pathToFile);
  return JSON.parse(rawdata.toString());

const scenarioCases = new DataTable(['type']);
readFile().forEach(case => {

Data(scenarioCases).Scenario('Test Scenario', async (I, current) => {
// test