有没有一种方法可以使用.feature文件作为输入 [英] is there a way to use .feature file as input

查看:137
本文介绍了有没有一种方法可以使用.feature文件作为输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在尝试学习bdd技术并尝试其框架.这个想法来自测试到代码,但我想尽可能以相反的方式使用它.

i'm currently trying to learn bdd techniques and trying frameworks for it. the idea comes from test to code, but i want to use it in revers way if possible.

我目前正在使用specflow,硒和nunit组合.我想向任何人(非开发人员)开放我的工作,以添加新的示例或测试用例.假设我已经实现了所有用例,但是更改步骤顺序或修改/添加示例将使我的测试用例更加丰富.

i'm currently using specflow, selenium and nunit combination. i want to open my work to anyone (non-developers) for adding new examples or test cases. let's say i have implemented all use cases but changing step orders or modifying/adding examples would enrich my test cases.

问题是我必须为功能文件中的每个更改构建项目.有可能以这种方式使用这种技术吗?

the problem is that i have to build the project for each change in feature files. is it possible to use this technique in that way?

Given I have scenarios
And I have step definitions
When I want to add new tests
Then I should be able to load .feature file as input

如果不可能的话,我正在考虑一些解析操作以将其映射到我的方法中,我想有一种更好的方法来实现这个想法.

if not possible, i'm thinking about some parsing operation to map them with my methods, i guess there is a better way to implement this idea.

推荐答案

据我了解,您希望避免针对功能文件中的更改而重建测试 您所建议的问题是您假设映射非常简单:

From what I understand, you want to avoid having to rebuild your test for changes in your feature file The problem with what you are suggesting is that you are assuming your mapping is as simple as:

Feature file <---> StepDefs

但是实际上发生了什么:

But in reality whats happening is:

.Feature File<--->FeatureFile.feature.cs<--->StepDefs

使用测试构建时自动生成的第3个文件将功能映射到步骤defs.这会将两个文件映射在一起.因此,即使您只是传入一个.feature文件,您仍然必须进行某种构建才能生成.cs文件并将这两个文件映射在一起.

The features are mapped to the step defs using a 3rd file that is auto generated when your test builds. This maps the two files together. So even if you were simply passing in a .feature file you would still have to do some kind of build in order to generate the .cs file and map the two files together.

这篇关于有没有一种方法可以使用.feature文件作为输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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