简体   繁体   English

C#项目中的Specflow和Nunit单元测试

[英]Specflow in c# project and Nunit unit test

I would like to say thanks to everyone here ,because i am learning many things from stackoverflow...every time i am living with new energy ..its all here. 我想对这里的每个人表示感谢,因为我每次都从stackoverflow中学习了很多东西……每次我都生活在这里。

yes of course ,i need oxygen to breath again...all helping hands i want ...may be my questions are silly but really day to day am brushing and growing as kid of stackoverflow school. 是的,当然,我需要氧气才能再次呼吸...我想要的所有帮助之手...可能是我的问题很愚蠢,但实际上,随着Stackoverflow学校的孩子的成长,我每天都在刷牙和成长。

i have little knowledge on working with c# project and unit test(Nunit/xunit)..where i use Nunit test to debug my code which i have written in c# project. 我对使用c#项目和单元测试(Nunit / xunit)知之甚少。在这里,我使用Nunit测试来调试我在c#项目中编写的代码。

now i got a new challenge to do WCF service automation in BDD approach using specflow. 现在,我遇到了一个新挑战,即如何使用specflow在BDD方法中进行WCF服务自动化。

i tried by adding spec-flow features and steps for couple of scenarios into Nunit unit test project and was able to run and identified tests. 我尝试通过将规范流程功能和几个场景的步骤添加到Nunit单元测试项目中来进行尝试,并且能够运行并确定测试。

where as if i create same set of features and steps ,not identified any test and not run anything .even not recognized [Test] or [TestFixture]. 仿佛我创建了相同的功能部件和步骤,没有标识任何测试,也没有运行任何东西。甚至没有识别出[Test]或[TestFixture]。

let me explain what i have in mind, i want create all spec-flow features and steps in c# project and should be run this solution through nunit.exe/console by passing "REGRESSION" or "SMOKE" tests(by configuring environment details) in command prompt. 让我解释一下我的想法,我想在c#项目中创建所有规范流程功能和步骤,并应通过nreg.exe /控制台通过“ REGRESSION”或“ SMOKE”测试(通过配置环境详细信息)来运行此解决方案在命令提示符下。 and for debugging purpose i want call these spec-flow features (in c# project) from my unit test project...is this approach possible? 出于调试目的,我想从我的单元测试项目中调用这些规范流程功能(在c#项目中)...这种方法可行吗?

if possible ,please let me know with few sample and possible explanation/details to implement. 如果可能的话,请让我知道一些示例以及可能的解释/细节。

Issue: 1. I am not able to run any Spec-flow feature from c# project (since not test is identified) 2. Don't know how to call feature from unit test to do debug or to test my code before i integrate to team-city. 问题:1.我无法从c#项目运行任何Spec-flow功能(由于未检测到测试)2.不知道在集成到单元测试之前如何从单元测试中调用功能进行调试或测试我的代码团队城市。

please consider all these my basic doubts and make me to learn. 请考虑所有这些我的基本疑问,并让我学习。

Thanks In Advance, 提前致谢,

In regards to your issue 1 and 2, I guess you are not able to see features in runlist and hence not able to execute. 关于问题1和2,我猜您看不到运行列表中的功能,因此无法执行。

if you are not able to discover specflow features in run list. 如果您无法在运行列表中发现specflow功能。 You can try installing "Specflow for Visual Studio 2013" in extensions and updates. 您可以尝试在扩展程序和更新中安装“ Specflow for Visual Studio 2013”​​。 Please note this is in addition to "Specflow" package that you might have installed. 请注意,这是您可能已安装的“ Specflow”软件包的补充。

Specflow扩展

Specflow功能

You will see such features that can be added and you will have to add steps implementation. 您将看到可以添加的此类功能,并且必须添加步骤实现。 Its not related or part of Unit tests. 它不相关或不是单元测试的一部分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM