2

I have followed a couple of different tutorials for setting up a simple slim fitnesse environment with .NET. I have attempted this with both fitsharp and netrunner but both end up in my test page being ignore. Everything imports fine and even running RunnerW.exe provides nothing. I have checked numerous times and all of my paths are correct. In the end, when running the test, all I get are what is displayed in the screenshots below. I have been struggling with this for a few hours now so any help would be greatly appreciated.

NetRunner:
Result: 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:
Result: 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; }
    }
}
Manushin Igor
  • 3,398
  • 1
  • 26
  • 40

2 Answers2

0

Please change a little you C# code and 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;
    }
}

What I did:

  1. Test Container - a class with the list of the functions which are visible by NetRunner. These and only these functions are used for testing. You can create any count of the such classes, all function lists will be unioned
  2. I created function Employee (the first row of FitNesse table). This name is the same with first table row. 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. Function CheckName uses out parameter for result checking.

FitNesse changes:

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

What I did:

  1. Important: add fit mode to the top of the FitNesse text: !define TEST_SYSTEM {fit}
  2. First row is name of function. It should be bold (three ' before and after text). The bold text is meta-data (function names, parameter names, etc.). Non-bold text is related to variables.
  3. Second row - list of the parameter names (or property names, see here the same example). NetRunner will find function with the same parameter list.
  4. Next rows: input and output values. I used string type as the simplest way, however you can use any input/output types.
Manushin Igor
  • 3,398
  • 1
  • 26
  • 40
0

You're using a fixture from the Fit test system, ColumnFixture, with the Slim test system: !define TEST_SYSTEM {slim}

If you want to use ColumnFixture, then !define TEST_SYSTEM {fit}

If you want to use Slim, use the Decision table: http://www.fitnesse.org/FitNesse.UserGuide.WritingAcceptanceTests.SliM.DecisionTable

Mike Stockdale
  • 5,256
  • 3
  • 29
  • 33