Skip to content

Building and running tests

João Reis edited this page Mar 20, 2019 · 19 revisions

DataStax C# drivers support .NET 4.5+ and .NET Core 1.0+.

Prerequisites

Building

dotnet restore src
dotnet build src/Cassandra.sln

On Windows, the command dotnet build src/Cassandra.sln should succeed while on macOS / Linux it may fail due to the lack of support for .NET Framework builds on non-Windows platforms.

You can build specific projects against specific target frameworks on any platform:

dotnet build src/Cassandra/Cassandra.csproj -f netstandard1.5
dotnet build src/Cassandra.Tests/Cassandra.Tests.csproj -f netcoreapp2.0
dotnet build src/Cassandra.IntegrationTests/Cassandra.IntegrationTests.csproj -f netcoreapp2.0

Running Unit Tests

dotnet test src/Cassandra.Tests/Cassandra.Tests.csproj -f netcoreapp2.0

The target frameworks supported by the test projects are netcoreapp2.0 and net452.

There are more than 580 unit tests, running them should take no more than 3 minutes (usually less).

Running Integration Tests

To run the integration tests you need ccm on your machine and make a ccm command accessible from command line path. You should be able to run > cmd.exe /c ccm help using command line on Windows or $ /usr/local/bin/ccm help on Linux / macOS.

You also need simulacron:

  1. Download the latest jar file here.
  2. Set SIMULACRON_PATH environment variable to the path of the jar file you downloaded in the previous step.

Finally, to run the tests:

dotnet test src/Cassandra.IntegrationTests/Cassandra.IntegrationTests.csproj -f netcoreapp2.0 --filter "(TestCategory!=long)&(TestCategory!=memory)"

IDE Support

You can build and run tests on Visual Studio 2017+ and JetBrains Rider (cross-platform) by opening the solution file Cassandra.sln with any of those applications.