SpecFlow和复杂的对象 [英] SpecFlow and complex objects

查看:136
本文介绍了SpecFlow和复杂的对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我评估 SpecFlow 和我有点卡住了。结果
我发现所有样本我大量工作基本上是与简单的对象。

I'm evaluating SpecFlow and I'm a bit stuck.
All samples I have found are basically with simple objects.

项目依赖于一个复杂的对象。密切样本可能是这个对象:

Project I'm working on heavily relies on a complex object. A close sample could be this object:

public class MyObject
{
    public int Id { get; set; }
    public DateTime StartDate { get; set; }
    public DateTime EndDate { get; set; }
    public IList<ChildObject> Children { get; set; }

}

public class ChildObject
{
    public int Id { get; set; }
    public string Name { get; set; }
    public int Length { get; set; }
}



没有人有任何想法怎么会写我的功能/场景,其中为MyObject 会从一个给定的步骤进行实例化,并在当和那么的步骤?

Does anyone have any idea how could a write my features/scenarios where MyObject would be instantiated from a "Given" step and used in "When" and "Then" steps?

由于使用提前

编辑:就在心中拍:支持嵌套表

Just a shot in mind: are nested tables supported?

推荐答案

有关的例子,你已经证明我想说你'重新cuking错。这个例子看起来更适合写与NUnit的,可能使用的 反对母亲 的。与specflow或类似工具笔试应该是面对客户,并使用相同的语言作为你的客户会用来描述该功能。

For the example you have shown I would say you're cuking it wrong. This example looks more suitable to write with nunit and probably using an object mother. Tests written with specflow or similar tool should be customer facing and use the same language as your customer would use to describe the feature.

这篇关于SpecFlow和复杂的对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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