Skip to content

How to define testdata in codeless

saickorpu edited this page Apr 24, 2019 · 4 revisions
  • First you need to create a folder named testdata in the root folder. All your test data files should be saved in that particular folder
    example_usage/testdata
  • Refer below for how to create a .xlsx or .csv testdata files.
  • If your running a .xlsx file in your excel config sheet set testdata.filename = testdata file name.
    Example: testdata.filename = testdata.xlsx or testdata.csv.
  • If your running a .csv file in your codeless.config.properties set testdata.filename = testdata file name.
    Example: testdata.filename = testdata.xlsx or testdata.csv
  • When you run your test it loads the the testdata file that you mentioned in your config sheet. If testdata file is excel file by default it loads the data from the sheet named datasheet. If testdata file is csv file it loads the data from that csv file and runs the test.
    while reading the testdata the priority will be first it checks the system properties for that particular key. If it's null than it checks for environment property if it's null than it loads the corresponding value for that key from the testdata sheet

Defining a Excel TestData File:

  • Create a .xlsx file in testdata folder and default testdata sheetname should be datasheet and you can have N number of data sheets with customized sheetnames.
  • Enter the data in default datasheet or any other datasheet as key value pairs.
    Example File Name: testdata.xlsx (any name).
    Example sheetnames in the testdata.xlsx file: Default sheetname should be datasheet and there is no specific name for other datasheets .

Defining a Csv TestData File:

  • Create a .csv file with the data as key value pairs in testdata folder. For csv files, sheet name will be same as file name and as you cannot create multiple sheets in the same csv file. You need to create a new csv file for environment specific data with the data as key value pairs.