Using C ++ / CLI is one option. So you can use fitSharp as a bridge from FitNesse to your device code, but your device code can call directly in C ++.
Here is a simple example of testing the Calculator class. Firstly, here is the C ++ code we want to test:
class Calculator { public: int Add(int x, int y) { return x + y; } };
and here is the C ++ / CLI mount code:
public ref class CalculatorFixture { public: property int X; property int Y; property int Z; void Execute() { Calculator calculator; Z = calculator.Add(X,Y); } };
The FitNesse wiki page will look like this:
!define TEST_SYSTEM {slim} !define COMMAND_PATTERN {%m -r fitSharp.Slim.Service.Runner,C:\fitnesse\fitsharp\fitsharp.dll %p} !define TEST_RUNNER {C:\fitnesse\fitsharp\Runner.exe} !path c:\CalculatorFixture.dll !|CalculatorFixture| |X |Y |Z? | |2 |2 |4 | |3 |4 |7 |
One of the issues to keep in mind is that the C ++ / CLI DLLs are usually either 32-bit or 64-bit, while the fitSharp runner is "any processor." Therefore, if you create your C ++ / CLI DLL as a 32-bit one and try to use fitSharp with it on a 64-bit OS, you will get a "wrong format" error. In this case, either create the C ++ / CLI DLL as 64-bit, or use corflags to force fitsharp runner (Runner.exe) to be 32-bit.
source share