为什么我的测试页被忽略了?

时间:2015-02-23 23:01:58

标签: fitnesse fitnesse-slim fitsharp

我已经使用了几个不同的教程来设置一个简单的使用.NET的slimnesse环境。我已经尝试过使用这个问题,但是两个都在我的测试页面中被忽略了。一切进口都很好甚至运行RunnerW.exe什么也没提供。我已经检查了很多次,我的所有路径都是正确的。最后,在运行测试时,我得到的就是下面屏幕截图中显示的内容。我已经在这几个小时内苦苦挣扎,所以任何帮助都会非常感激。

NetRunner:
结果:http://screencast.com/t/mBdkCyGow

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NetRunner;
using NetRunner.ExternalLibrary;

class Employee : BaseTestContainer
{
    private string firstName;
    private string lastName;
    private string number;

    public Employee() { }

    public Employee(string firstName, string lastName, string number)
    {
        this.firstName = firstName;
        this.lastName = lastName;
        this.number = number;
    }

    public string FirstName
    {
        get { return firstName; }
        set { firstName = value; }
    }

    public string LastName
    {
        get { return lastName; }
        set { lastName = value; }
    }

    public string Name
    {
        get { return firstName + " " + lastName; }
    }

    public string Number
    {
        get { return number; }
        set { number = value; }
    }
}

Fitsharp:
结果:http://screencast.com/t/GMqdgwxA6

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using fit;

class Employee : ColumnFixture
{
    private string firstName;
    private string lastName;
    private string number;

    public Employee() { }

    public Employee(string firstName, string lastName, string number)
    {
        this.firstName = firstName;
        this.lastName = lastName;
        this.number = number;
    }

    public string FirstName
    {
        get { return firstName; }
        set { firstName = value; }
    }

    public string LastName
    {
        get { return lastName; }
        set { lastName = value; }
    }

    public string Name
    {
        get { return firstName + " " + lastName; }
    }

    public string Number
    {
        get { return number; }
        set { number = value; }
    }
}

2 个答案:

答案 0 :(得分:0)

请改变一下C#代码和FitNesse:

C#:

internal sealed class MyTestContainer : BaseTestContainer
{
   public EmployeeArgument Employee()
   {
       return new EmployeeArgument();
   }
}

internal sealed EmployeeArgument : BaseTableArgument
{
    public void CheckName(string firstName, string lastName, out string name)
    {
        name = firstName + " " + lastName;
    }
}

我做了什么:

  1. 测试容器 - 包含NetRunner可见功能列表的类。这些和仅这些功能用于测试。您可以创建此类的任何计数,所有函数列表将联合
  2. 我创建了函数Employee(FitNesse表的第一行)。此名称与第一个表行相同。 You can also use attributes to have different function names in code and in FitNesse.
  3. The BaseTableArgument - specific type to execute the same function on the each table row
  4. 功能CheckName使用out parameter进行结果检查。
  5. FitNesse更改:

    | '''employee''' |
    | '''First Name''' | '''Last Name''' | '''Name''' |
    | Ryan | Cheek | Ryan Cheek |
    | Ryan | Cheek | abc |
    

    我做了什么:

    1. 重要提示:add fit mode to the top of the FitNesse text:!定义TEST_SYSTEM {fit}
    2. 第一行是功能名称。它应该是粗体(三个'文本之前和之后)。粗体文本是元数据(函数名称,参数名称等)。非粗体文本与变量相关。
    3. 第二行 - 参数名称列表(或属性名称,请参阅here相同的示例)。 NetRunner将找到具有相同参数列表的函数。
    4. 下一行:输入和输出值。我使用字符串类型作为最简单的方法,但您可以使用any input/output types

答案 1 :(得分:0)

您正在使用Fit测试系统中的夹具ColumnFixture和Slim测试系统:!define TEST_SYSTEM {slim}

如果您想使用ColumnFixture,请!define TEST_SYSTEM {fit}

如果您想使用Slim,请使用决策表:http://www.fitnesse.org/FitNesse.UserGuide.WritingAcceptanceTests.SliM.DecisionTable

相关问题