小编Jee*_*ian的帖子

如何在Feature文件的'Examples'中传递csv文件,并从Java黄瓜中的CSV文件中读取值

  1. 在Cucumber的"特征文件" - >"示例"中,如何设置CSV文件的路径.

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 |
Run Code Online (Sandbox Code Playgroud)

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{   

}
Run Code Online (Sandbox Code Playgroud)

使用的CSV文件

**temp.csv**
    name,
    Google,
Run Code Online (Sandbox Code Playgroud)

但是我没有从temp.csv文件中检索值,结果是0场景0步骤0m0.000s

2.也想在Java Cucumber中了解Serenity,如何从Feature文件中提到的CSV文件中读取值.

java cucumber-serenity

6
推荐指数
0
解决办法
2205
查看次数

标签 统计

cucumber-serenity ×1

java ×1