是否可以从Specflow中的外部文件夹引用特征文件,就像我们在Java中使用Cucumber粘合一样 [英] Is it possible to reference feature files from external folders in Specflow like we use glue in Java with Cucumber

查看:99
本文介绍了是否可以从Specflow中的外部文件夹引用特征文件,就像我们在Java中使用Cucumber粘合一样的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在为API创建测试.我想用Java和.Net编写测试,而我首先使用Cucumber和Rest Assured Library来编写Java.现在,当我尝试使用Specflow用.Net编写相同的测试时,但是我想重用Java Project使用的相同功能文件,并为其编写步骤定义.

I been working on creating tests for API's. I wanted to write tests in both Java and .Net and I started of with Java using Cucumber and Rest Assured Library. Now when I am trying to write the same tests with .Net using Specflow, But I want to reuse the same feature files that the Java Project is using and write step definitions for it.

是否可以为Specflow项目定义功能文件的位置?像Glue with Cucumber这样的东西,我可以指定特征文件的位置吗?

Is it possible that I can define the location of the feature files for a Specflow project? Something like Glue with Cucumber wherein I can specify my feature files location?

我的项目"具有以下三个文件夹,

My Project has the following three folders,

JavaTestCases FeatureFiles DotnetTestCases

JavaTestCases FeatureFiles DotnetTestCases

JavaTestCases中的测试能够使用胶水从FeatureFiles文件夹中引用功能文件,但对于DotnetTestCases,我无法这样做.

Tests in the JavaTestCases are able to refer to the feature files from FeatureFiles folder using glue but I am unable to do so for the DotnetTestCases.

试图在Google上研究替代品,但似乎我没有在Specflow中找到与胶水相当的东西

Tried researching for alternatives on Google but seems like I did not find anything as an equivalent of glue in Specflow

推荐答案

可以,但是SpecFlow要求.csproj文件中包含用于测试项目的条目.这可能是Visual Studio中的手动复制和粘贴操作.

Yes you can, but SpecFlow requires entries in the .csproj file for your test project. It will likely be a manual copy and paste operation in Visual Studio.

由于您具有多个API或应用程序,因此很难相信这些功能文件是真正可重用的.如果是的话,如何证明其他组成部分是合理的?

Being that you have multiple APIs or applications, I find it hard to believe that the feature files are truly reusable. If they are, how can the other components be justified?

您现在可以重用特征文件的事实可能只是巧合.我认为这是复制和粘贴实际上可以防止以后出现头痛的情况之一.

The fact you can reuse feature files now may be coincidence only. I think this is one of the cases where copy and paste might actually prevent headaches later on.

这篇关于是否可以从Specflow中的外部文件夹引用特征文件,就像我们在Java中使用Cucumber粘合一样的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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