Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation #95

Merged
merged 2 commits into from Oct 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
36 changes: 34 additions & 2 deletions README.md
@@ -1,6 +1,38 @@
# Akka.MultiNodeTestRunner
# Akka.MultiNode.TestAdapter

Visual Studio 2019 Test Explorer and .NET CLI Test runner for the Akka.NET MultiNode tests

## Documentation
`Akka.MultiNode.TestAdapter` is a standalone .NET CLI and VSTest adapter for Akka.NET multi node testkit;
It allows you to run multinode tests directly inside Visual Studio Text Explorer window and run them
using the `dotnet test` .NET CLI command.

To use the VSTest test adapter in your multinode spec projects, You will need to add these nuget packages:
- [Akka.MultiNode.TestAdapter](https://www.nuget.org/packages/Akka.MultiNode.TestAdapter)
- [Microsoft.NET.Test.Sdk](https://www.nuget.org/packages/Microsoft.NET.Test.Sdk/)

Documentation regarding the multinode specs themselves can be read in the Akka.NET documentation pages:
- [Using the MultiNode TestKit](https://getakka.net/articles/networking/multi-node-test-kit.html)
- [Multi-Node Testing Distributed Akka.NET Applications](https://getakka.net/articles/testing/multi-node-testing.html)

### VSTest .runsettings
This is the .runsettings XML sub-section `Akka.MultiNode.TestAdapter` can use:
```xml
<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
<MultiNodeTestRunnerOptions>
<ListenAddress>127.0.0.1</ListenAddress>
<ListenPort>0</ListenPort>
<ClearOutputDirectory>false</ClearOutputDirectory>
<UseTeamCityFormatting>false</UseTeamCityFormatting>
</MultiNodeTestRunnerOptions>
</RunSettings>
```

Update this readme file with your details.
- **ListenAddress**: Determines the address that this multi-node test runner will use to listen for log messages from individual spec.
- **ListenPort**: Determines the port number that this multi-node test runner will use to listen for log messages from individual spec.
- **ClearOutputDirectory**: Clear the output directory before running the test session. If set to false, all test logs are appended to the out file.
- **UseTeamCityFormatting**: Use TeamCity formatting on the log outputs.

## Building this solution
To run the build script associated with this solution, execute the following:
Expand Down
6 changes: 6 additions & 0 deletions src/Akka.MultiNode.TestAdapter/MultiNodeTestAdapter.cs
Expand Up @@ -76,6 +76,9 @@ public void RunTests(IEnumerable<TestCase> rawTestCases, IRunContext runContext,
var testCases = rawTestCases.ToList();
var testResults = new ConcurrentDictionary<string, TestResult>();
var options = BuildOptions(runContext, frameworkHandle);
// Perform output cleanup before anything is logged
if (options.ClearOutputDirectory && Directory.Exists(options.OutputDirectory))
Directory.Delete(options.OutputDirectory, true);

foreach (var group in testCases.GroupBy(t => Path.GetFullPath(t.Source)))
{
Expand Down Expand Up @@ -114,6 +117,9 @@ public void RunTests(IEnumerable<TestCase> rawTestCases, IRunContext runContext,
public void RunTests(IEnumerable<string> sources, IRunContext runContext, IFrameworkHandle frameworkHandle)
{
var options = BuildOptions(runContext, frameworkHandle);
// Perform output cleanup before anything is logged
if (options.ClearOutputDirectory && Directory.Exists(options.OutputDirectory))
Directory.Delete(options.OutputDirectory, true);
var testResults = new ConcurrentDictionary<string, TestResult>();

var testAssemblyPaths = sources.ToList();
Expand Down
4 changes: 0 additions & 4 deletions src/Akka.MultiNode.TestAdapter/MultiNodeTestRunner.cs
Expand Up @@ -81,10 +81,6 @@ private void Initialize(string assemblyPath, MultiNodeTestRunnerOptions options)
Console.WriteLine($"Platform name: {_platformName}");

_currentAssembly = fileName;
// Perform output cleanup before anything is logged
if (options.ClearOutputDirectory && Directory.Exists(options.OutputDirectory))
Directory.Delete(options.OutputDirectory, true);

TestRunSystem = ActorSystem.Create("TestRunnerLogging");

var suiteName = Path.GetFileNameWithoutExtension(Path.GetFullPath(assemblyPath));
Expand Down