I’ve had a few requests to get CSlim working with Visual Studio. I’ve done so but with Visual Studio 2010. I did not try using Visual Studio 2008 because it appears to lack support for regular expressions. If you’re looking to working with Visual Studio 2008, you are on your own for that.
What follows are instructions to get you started. Consider these Alpha instructions. I’m not sure I’ll be doing more with this any time soon because of deadlines. In any case, this should get you started.
What follows are the instructions for building the supplied cslim examples and getting them to (mostly) run. After that, you’ll be on your own to get a project up and running in Visual Studio.
Building The Examples
You can now build cslim using the command line tools of visual studio. I made my own clone of the github project so I could make a few minor changes. The changes include things that should be able to be moved into the main github repository. I’ve submitted a pull request. If the updates do get pulled, I’ll update these notes accordingly.
Now for the detailed instructions.
Start a command shell using the Visual Studio Command Prompt (2010)
Create a top-level directory for your work, I’ll be using C:\cslim_vs2010 for these instructions
Copy (or move) the jar file you just downloaded into your top-level working directory (C:\src\cslim_vs2010)
Your directory should resemble the following:
Make sure you are in the top level directory and start FitNesse with the following command: java -jar fitnesse.jar -p 8080
Note: The first time you run FitNesse, it will expand the help wiki. This will not happen upon subsequent runs unless you replace fitnesse.jar with a newer version.
Copy Example Pages
Create a new shell (because you’re running FitNesse in your original shell)
The cslim distribution comes with some example pages. You’ll want to copy a directory from one place to another to see those tests
The directory to copyfrom is: *cslim\fixtures\pages*
The directory to copyto is a bit more involved. You’ll want to copy the directory to a directoryunder the FitNesseRoot directory created when you started fitnesse in the previous shell.However, you’ll need to name the directory as a valid wiki word (starts with a capital letter, has at least one more capital letter, does not have 2 or more consecutive capital letters). For this example, I’ll recommend you copy it asCslimExamples. Notice that onlyC andE in examples are capital letters. That’s important.
You can use the explorer or some tool. Here’s what you’re copying:
Here’s what things should look like after the copy (I have some unix tools installed, so I used cp):
You’ll need to edit the page you just created and set its contents to:
Now you can hit theSuite button. You will see some passing tests, missing fixtures and Exceptions.
If you get an exception related to a difference in the version of the slim protocol implemented by cslim versus the one expected by FitNesse, you’ll need to change the “!define SLIM_VERSION {0.0}” to the version used by what cslim is implementing.
There are problems with exception handling. I’ll be looking into that but that causes the fixture called ExceptionsExample to fail. (These are alpha instructions after all!)
The class TestSlim is part of the examples and it seems to be missing.
Where to go from here
If you want to use this in your own project, and use VS 2010, here are some bullets to get you started.
You’ll need to link the library CSlim.lib created by the NMakefile
You’ll need to add cslim\include\CSlim to your include path
You’ll need to add cslim\include\Com to your include path
You’ll need to add a -DCPP_COMPILING to your build
You’ll need to copy the contents of the fixtures directory into your solution. You can remove the example fixtures but keep Main.c and Fixtures.c (just update it).
Comments