Port of schuchert.wikispaces.com


cpptraining.UsingCSlimWithVisualStudio2010

cpptraining.UsingCSlimWithVisualStudio2010

September 2011

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.

C:\>cd src
C:\src>mkdir cslim_vs2010
C:\src>cd cslim_vs2010
C:\src\cslim_vs2010>
C:\src\cslim_vs2010>git clone git@github.com:schuchert/cslim.git
Initialized empty Git repository in C:/src/cslim_vs2010/cslim/.git/
remote: Counting objects: 542, done.
remote: Compressing objects: 100% (244/244), done.
remote: Total 542 (delta 276), reused 515 (delta 263)
Receiving objects: 100% (542/542), 130.10 KiB, done.
Resolving deltas: 100% (276/276), done.

C:\src\cslim_vs2010>
C:\src\cslim_vs2010\cslim>nmake -f NMakefile

Microsoft (R) Program Maintenance Utility Version 10.00.30319.01
Copyright (C) Microsoft Corporation.  All rights reserved.

        cd C:\src\cslim_vs2010\cslim\fixtures
        cl /MT /EHsc /Zi /IC:\src\cslim_vs2010\cslim\include\CSlim /IC:\src\csli
m_vs2010\cslim\include\Com  /IC:\src\cslim_vs2010\cslim\include\VS2010 -Dsnprint
f=_snprintf /FIstring.h /TP /c  -DCPP_COMPILING=1 *.c *.cpp
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86
Copyright (C) Microsoft Corporation.  All rights reserved.

DecisionTableExample.c
ExceptionsExample.c
Fixtures.c
Main.c
QueryTableExample.c
ScriptTableExample.c
FixtureInCpp.cpp
Generating Code...
        cd C:\src\cslim_vs2010\cslim\src\CSlim
        cl /MT /EHsc /Zi /IC:\src\cslim_vs2010\cslim\include\CSlim /IC:\src\csli
m_vs2010\cslim\include\Com  /IC:\src\cslim_vs2010\cslim\include\VS2010 -Dsnprint
f=_snprintf /FIstring.h /TP /c  -DCPP_COMPILING=1 *.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86
Copyright (C) Microsoft Corporation.  All rights reserved.

ListExecutor.c
SlimConnectionHandler.c
SlimList.c
SlimListDeserializer.c
SlimListSerializer.c
SlimUtil.c
StatementExecutor.c
SymbolTable.c
Generating Code...
        cd C:\src\cslim_vs2010\cslim
        cd C:\src\cslim_vs2010\cslim\src\ComWin32
        cl /MT /EHsc /Zi /IC:\src\cslim_vs2010\cslim\include\CSlim /IC:\src\csli
m_vs2010\cslim\include\Com  /IC:\src\cslim_vs2010\cslim\include\VS2010 -Dsnprint
f=_snprintf /FIstring.h /TP /c  -DCPP_COMPILING=1 *.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86
Copyright (C) Microsoft Corporation.  All rights reserved.

SocketServer.c
TcpComLink.c
Generating Code...
        cd C:\src\cslim_vs2010\cslim
        cd C:\src\cslim_vs2010\cslim
        lib /out:C:\src\cslim_vs2010\cslim\Lib\CSlim.lib src\CSlim\*.obj src\Com
Win32\*.obj
Microsoft (R) Library Manager Version 10.00.30319.01
Copyright (C) Microsoft Corporation.  All rights reserved.

        cd C:\src\cslim_vs2010\cslim
        link /DEBUG /SUBSYSTEM:CONSOLE /OUT:C:\src\cslim_vs2010\cslim\fixtures\s
lim.exe C:\src\cslim_vs2010\cslim\Lib\CSlim.lib C:\src\cslim_vs2010\cslim\src\Co
mWin32\*.obj C:\src\cslim_vs2010\cslim\fixtures\*.obj "C:\Program Files\Microsof
t SDKs\Windows\v7.0A\Lib\WS2_32.Lib"
Microsoft (R) Incremental Linker Version 10.00.30319.01
Copyright (C) Microsoft Corporation.  All rights reserved.


C:\src\cslim_vs2010\cslim>
C:\src\cslim_vs2010\cslim>dir fixtures\slim.exe
 Volume in drive C has no label.
 Volume Serial Number is A8D5-BA48

 Directory of C:\src\cslim_vs2010\cslim\fixtures

08/08/2010  10:11 PM           250,880 slim.exe
               1 File(s)        250,880 bytes
               0 Dir(s)  32,129,187,840 bytes free

C:\src\cslim_vs2010\cslim>

Now that you have a compiled collection of fixtures, you are ready to install FitNesse, copy some pages and get tests to pass.

Install FitNesse

C:\src\cslim_vs2010>dir
 Volume in drive C has no label.
 Volume Serial Number is A8D5-BA48

 Directory of C:\src\cslim_vs2010

08/08/2010  10:14 PM    <DIR>          .
08/08/2010  10:14 PM    <DIR>          ..
08/08/2010  10:09 PM    <DIR>          cslim
08/08/2010  06:51 PM         3,934,696 fitnesse.jar
               1 File(s)      3,934,696 bytes
               3 Dir(s)  32,125,247,488 bytes free
C:\src\cslim_vs2010>java -jar fitnesse.jar -p 8080
Unpacking new version of FitNesse resources.  Please be patient.
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
..................................................FitNesse (v20100728) Started..
.
        port:              8080
        root page:         fitnesse.wiki.FileSystemPage at ./FitNesseRoot
        logger:            none
        authenticator:     fitnesse.authentication.PromiscuousAuthenticator
        html page factory: fitnesse.html.HtmlPageFactory
        page version expiration set to 14 days.

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

C:\src\cslim_vs2010>dir cslim\fixtures\pages
 Volume in drive C has no label.
 Volume Serial Number is A8D5-BA48

 Directory of C:\src\cslim_vs2010\cslim\fixtures\pages

08/08/2010  10:09 PM    <DIR>          .
08/08/2010  10:09 PM    <DIR>          ..
08/08/2010  10:09 PM                26 content.txt
08/08/2010  10:09 PM    <DIR>          CounterTest
08/08/2010  10:09 PM    <DIR>          DivisionTest
08/08/2010  10:09 PM    <DIR>          ExceptionsTest
08/08/2010  10:09 PM    <DIR>          FirstCslimTest
08/08/2010  10:09 PM    <DIR>          MultiplicationTest
08/08/2010  10:09 PM    <DIR>          PayRollTest
08/08/2010  10:09 PM               284 properties.xml
               2 File(s)            310 bytes
               8 Dir(s)  32,117,592,064 bytes free
C:\src\cslim_vs2010>cp -r cslim/fixtures/pages FitNesseRoot/CslimExamples

C:\src\cslim_vs2010>dir FitNesseRoot\CslimExamples
 Volume in drive C has no label.
 Volume Serial Number is A8D5-BA48

 Directory of C:\src\cslim_vs2010\FitNesseRoot\CslimExamples

08/08/2010  10:23 PM    <DIR>          .
08/08/2010  10:23 PM    <DIR>          ..
08/08/2010  10:23 PM                26 content.txt
08/08/2010  10:23 PM    <DIR>          CounterTest
08/08/2010  10:23 PM    <DIR>          DivisionTest
08/08/2010  10:23 PM    <DIR>          ExceptionsTest
08/08/2010  10:23 PM    <DIR>          FirstCslimTest
08/08/2010  10:23 PM    <DIR>          MultiplicationTest
08/08/2010  10:23 PM    <DIR>          PayRollTest
08/08/2010  10:23 PM               284 properties.xml
               2 File(s)            310 bytes
               8 Dir(s)  32,117,567,488 bytes free

Configure The Slim Implementation

!contents -R2 -g -p -f -h

!define TEST_SYSTEM {slim}
!define TEST_RUNNER {c:\src\cslim_vs2010\cslim\fixtures\slim.exe}

!define COMMAND_PATTERN {%m}


!define SLIM_VERSION {0.0}

Hope this helps you get started.


Comments

" Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.