Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion BoostTestAdapter/Boost/Runner/BoostTestRunnerCommandLineArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,17 @@ public BoostTestRunnerCommandLineArgs()
this.ListContent = null;
this.Help = false;

this.Environment = new Dictionary<string, string>();
/* The environment variable "BUTA" is set whenever a test is executed. The purpose
* is to provide a means for boost unit tests to detect that they are being executed
* using the boost unit test adapter. One might use this so as for the tests to
* increase the verbosity level whenever boost unit tests are executed using the
* boost unit test adapter.
*/

this.Environment = new Dictionary<string, string>()
{
{ "BUTA", "1" }
};
}

#endregion Constructors
Expand Down
32 changes: 32 additions & 0 deletions BoostTestAdapterNunit/BoostTestExecutorTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,7 @@ public void RunTestSelection()
);

AssertDefaultTestResultProperties(this.FrameworkHandle.Results);

}

/// <summary>
Expand Down Expand Up @@ -606,6 +607,37 @@ public void DebugTestSelection()
AssertDefaultTestResultProperties(this.FrameworkHandle.Results);
}

/// <summary>
/// "BUTA" environment variable should be set within an execution context.
///
/// Test aims:
/// - Ensure that the text execution runner provides the environment variable "BUTA" in the execution
/// context
/// </summary>
[Test]
public void BUTAEnvironmentVariableProvided()
{
this.RunContext.IsBeingDebugged = true;

this.Executor.RunTests(
GetDefaultTests(),
this.RunContext,
this.FrameworkHandle
);

MockBoostTestRunner runner = this.RunnerFactory.LastTestRunner as MockBoostTestRunner;

Assert.That(runner, Is.Not.Null);

var oExpectedEnvironmentVariables = new Dictionary<string, string>()
{
{ "BUTA", "1" }
};

CollectionAssert.AreEqual(oExpectedEnvironmentVariables, runner.ExecutionArgs.First().Arguments.Environment);

}

/// <summary>
/// Given a valid .runsettings, test execution should respect the configuration.
///
Expand Down
21 changes: 21 additions & 0 deletions BoostTestAdapterNunit/BoostTestRunnerCommandLineArgsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

using BoostTestAdapter.Boost.Runner;
using NUnit.Framework;
using System.Collections.Generic;
using System.IO;

namespace BoostTestAdapterNunit
Expand Down Expand Up @@ -71,6 +72,25 @@ public void DefaultCommandLineArgs()
Assert.That(args.ToString(), Is.Empty);
}

/// <summary>
/// "BUTA" environment variable present by default in the environment variable collection
///
/// Test aims:
/// - Ensure that the "BUTA" environment is present by default in the enviorment variable collection.
/// </summary>
[Test]
public void BUTAEnviormentVariablePresent()
{
BoostTestRunnerCommandLineArgs args = new BoostTestRunnerCommandLineArgs();

var oExpectedEnviormentVariables = new Dictionary<string, string>()
{
{ "BUTA", "1" }
};

CollectionAssert.AreEqual(oExpectedEnviormentVariables, args.Environment);
}

/// <summary>
/// Non-default configuration of a command-line arguments structure.
///
Expand Down Expand Up @@ -144,6 +164,7 @@ public void CloneCommandLineArgs()
Assert.That(args.ListContent, Is.EqualTo(clone.ListContent));

Assert.That(args.ToString(), Is.EqualTo(clone.ToString()));
Assert.That(args.Environment, Is.EqualTo(clone.Environment));
}

/// <summary>
Expand Down