问题
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.
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.
回答1:
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
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.
来源:https://stackoverflow.com/questions/28966682/is-there-a-way-to-use-feature-file-as-input