Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Arkatufus committed Oct 20, 2021
2 parents 8037e2f + 8138353 commit 04be23e
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 6 deletions.
36 changes: 34 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#### 1.0.0 October 20 2019 ####
- Fix [result folder clearing, add documentation](https://github.com/akkadotnet/Akka.MultiNodeTestRunner/pull/95)

#### 1.0.0-beta2 October 05 2019 ####
- Fix, [node runner should ignore runs not started by MNTR](https://github.com/akkadotnet/Akka.MultiNodeTestRunner/pull/93)

Expand Down
6 changes: 6 additions & 0 deletions src/Akka.MultiNode.TestAdapter/MultiNodeTestAdapter.cs
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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

0 comments on commit 04be23e

Please sign in to comment.