How to pass a csv file in 'Examples' in Feature file and read values from CSV file in Java cucumber
Asked Answered
A

0

6
  1. In Cucumber 'Feature file '-> 'Examples' , how to set path for CSV file.

Sample.feature

    Feature:Launch an app 
    Scenario Outline:Validation of the application
        Given User navigates to application
        When User logs in using valid appname '<Name>'
    Examples:    
        @sources:src/test/resources/data_tables/temp.csv
        | Name |

Junit Runner:

package definitions;
import net.serenitybdd.cucumber.CucumberWithSerenity;
import cucumber.api.CucumberOptions;
import org.junit.runner.RunWith;

@RunWith(CucumberWithSerenity.class)
@CucumberOptions(features = "src/test/resources/features/Sample.feature" )
public class AcceptanceTestSuite{   

}

Used CSV file

**temp.csv**
    name,
    Google,

But I didnt retrieve values from temp.csv file, result was 0 Scenarios 0 Steps 0m0.000s

2.Also wanted to know in Java Cucumber with Serenity, how to readvalues from CSV file that is mentioned in Feature file.

Alyss answered 7/6, 2016 at 13:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.