Is there a way to incorporate Fitnesse into C ++ code?

I am trying to use Fitnesse to interact with some C ++ code, but the Fit Cpp project file provided on fitnesse.org does not work (this is VC ++ 6, which I don’t have, but I have Visual Studio 2005 and 2008). I can’t even open the solution file in VS2005 or VS2008 (perhaps because it was created in VC ++ 6?).

Could anyone get this job? Is there a way to write a test device in C # that communicates with C ++ code? If so, how do I do this.

Here is the website with the code: http://fitnesse.org/FrontPage.FitServers.CppFit.CppTestTools.SetUpCppTestTools

Ideally, I would like to be able to work on this in Visual Studio and avoid cygwin. Should I just bite a bullet and go with a qigwin ... not sure if it will even work ... have not tried.

Any help would be greatly appreciated. Thanks in advance.

+6
source share
2 answers

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.

+2
source

VC6 again had no decision files. Instead, VC6 used workspaces stored in .dsw files. The project files were .dsp.

If you open .dsw or .dsp in a new Visual Studio, it should offer you to convert it, and this should lead to the creation of new .sln and .vcproj files created for the project. I converted many complex projects from VC6 to VS 2005, 2008 and 2010, in my experience the conversion works quite reliably. If there are any problems with the conversion, VS will show you this in the conversion log.

0
source

Source: https://habr.com/ru/post/898776/


All Articles