如何从中加载值。 Cucumber-jvm步骤类中的属性文件 [英] How to load a value from . properties file in Cucumber-jvm step class

查看:84
本文介绍了如何从中加载值。 Cucumber-jvm步骤类中的属性文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经编写了一个黄瓜集成测试,并且运行正常。

I have written a cucumber integration tests and it is running ok.

然后,我想要来自step.java的一些类变量从.properties中获取它们的值。值

And then i wanted some class variables from the step.java to get their values from .properties values

public class cucumberStepClass { 
    @Value("${value.from.propertiesfile}")
    private String variable
//rest of integration test
}

有人吗知道如何注入这些值以便测试可以使用它们吗?

Does anyone know how can i inject those values so my test can use them?

推荐答案

您是否启用了Spring依赖注入的集成?您需要为此添加 cucumber-spring 依赖项。参见 https://docs.cucumber.io/cucumber/state/#spring

Have you enabled integration with spring dependency injection? You need to add the cucumber-spring dependency for that. See https://docs.cucumber.io/cucumber/state/#spring

这篇关于如何从中加载值。 Cucumber-jvm步骤类中的属性文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆