1

I am not java expert so need your guidance. I am new to Karate. I want to run Karate using data from Excel file. After research I am able to replace secanrio outline examples with the excel data however I am not able to call it from the karate runner file.

Feature File :

Code Snip -

Examples:

|DemandId|

@externaldata@./src/test/java/examples/TestData.xlsx@Sheet1

Code Snip-

Runner Class:

public void testParallel() throws InvalidFormatException, IOException, InterruptedException {
    FeatureOverright.overrideFeatureFiles("./src/test/java/examples");
    String karateOutputPath = "target/surefire-reports";
    KarateStats stats = CucumberRunner.parallel(getClass(), 5, karateOutputPath);
    generateReport(karateOutputPath);

When I run for the first time, the execution fails after that in the feature files examples are updated with data from the excel.

Can you please suggested me how should i need to call the below function in the runner class to override the feature file with Data from excel.

FeatureOverright.overrideFeatureFiles("./src/test/java/examples");

Community
  • 1
  • 1
vinay
  • 11
  • 1

1 Answers1

0

I'm the dev of Karate and I strongly advise you not to use Excel it will just complicate your life in the long run.

Please refer to this answer: https://stackoverflow.com/a/47954946/143475

Peter Thomas
  • 54,465
  • 21
  • 84
  • 248
  • Hi Peter, Thanks for the response. I know you and have meet you in one of the conference in TRV. I have gone through your previous responses , but our customer is insisting on using the excel for data. Can you please suggest how should I call function for over riding data for scenario outline examples . Currently the first run error out but the data get updated . I am struggling on this and need your help here. – vinay Jun 13 '18 at 03:46
  • @vinay you can still use excel if you insist. just write a java utility to convert your excel into JSON. the Karate project cannot do this because everybody's needs and data formats are different. if you can't write a Java utility to read Excel or CSV (plenty of examples if you search) please give up on using Karate. all the best. – Peter Thomas Jun 13 '18 at 03:49