Skip to content

Building and running tests

Kishan Karunaratne edited this page Oct 9, 2015 · 19 revisions

Prerequisites

To run the unit and integration tests you need to have NUnit 2.6 installed.

To run the integration tests you need a working ccm on your machine and make a ccm command accessible from command line path.

This way you should be able to run > cmd.exe /c ccm help using command line on Windows or $ /usr/local/bin/ccm help on Linux / OS X.

Windows

.NET 4.0+

Using Visual Studio

You can use Visual Studio 2012+ to build the solution and run the tests.

Using MSBuild

You can build the solution with msbuild using the build/build.proj file.

Example: > MSBuild.exe build\build.proj /v:m /t:test

Check out the MSBuild Command-Line Reference.

Build targets

compile

Clean previous builds and compiles the solution.

> MSBuild.exe build/build.proj /v:m /t:compile

unit-test

Execute compile target and runs the test located in the Cassandra.Tests project.

> MSBuild.exe build/build.proj /v:m /t:unit-test

To run the unit test, you will need to have the NUNIT_PATH environment variable pointing to the bin folder of the Nunit installation path, for example: C:\Program Files (x86)\NUnit 2.6.3\bin.

As an alternative, you can set NUNIT_PATH as a project-level property, using the switch /p:

> MSBuild.exe build\build.proj /v:m /t:unit-test "/p:NUNIT_PATH=C:\Program Files (x86)\NUnit 2.6.3\bin"

test

Runs unit-test target plus the tests located in the Cassandra.IntegrationTests project, of category short.

It also requires NUNIT_PATH environment variable.

You should set the Cassandra version you want to run the test against, using CASSANDRA_VERSION environment variable.

> set CASSANDRA_VERSION=2.2.2
> MSBuild.exe build\build.proj /v:m /t:test

ci

Until all integration tests run stable on all environment, you can select which tests to run using the ci target and specifying the test to include using the INCLUDE_TEST property.

> MSBuild.exe build/build.proj /v:n /t:ci /p:INCLUDE_TEST=Cassandra.IntegrationTests.Core.CollectionsTests,Cassandra.IntegrationTests.Core.ControlConnectionTests

Linux / OS X

Mono 3.12+

Using bash

You can build the solution with xbuild and run the test using nunit-console under Mono.

You should set the Cassandra version you want to run the test against, using CASSANDRA_VERSION environment variable.

$ export CASSANDRA_VERSION=2.2.2
$ nuget restore src/Cassandra.sln
$ nuget install NUnit.Runners -Version 2.6.4 -OutputDirectory testrunner
$ xbuild /p:Configuration=Release /v:m /p:restorepackages=false src/Cassandra.sln
$ mono ./testrunner/NUnit.Runners.2.6.4/tools/nunit-console.exe src/Cassandra.Tests/bin/Release/Cassandra.Tests.dll src/Cassandra.IntegrationTests/bin/Release/Cassandra.IntegrationTests.dll -labels -exclude=long,duration
Clone this wiki locally