-
Notifications
You must be signed in to change notification settings - Fork 0
Runners
Runs the following command in the Package Manager Console.
PM> Install-Package CarnaConsoleRunner
- Creates the console application.
> dotnet new console
- Adds the Carna.ConsoleRunner package.
> dotnet add package Carna.ConsoleRunner
- Fixes Program.cs as follows.
using Carna.ConsoleRunner;
namespace Lib.Spec
{
static class Program
{
static int Main(string[] args) => CarnaConsoleRunner.Run(args);
}
}
- Adds "carna-runner-settings.json" file.
{
"assemblies": [
"Lib.Spec.dll"
],
"reporters": [
{
"reporter": {
"type": "Carna.ConsoleRunner.Reporters.ConsoleFixtureReporter,Carna.ConsoleRunner",
"options": {
"stepVisible": true
}
}
}
]
}
- Creates a tool manifest file.
> dotnet new tool-manifest
- Installs the carna-runner.
> dotnet tool install carna-runner
- Adds the CopyLocalLockFileAssemblies section in the project file as follows.
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>
- Adds the PrivateAssets and the ExcludeAssets section in the project file as follows.
<ItemGroup>
<PackageReference Include="Carna" Version="1.7.2">
<PrivateAssets>all</PrivateAssets>
<ExcludeAssets>runtime</ExculdeAssets>
</PackageReference>
</ItemGroup>
(.NET Framework 4.6)
> CarnaConsoleRunner.exe [options] [assembly file]
(.NET Core)
> dotnet run [options] [assembly file]
(.NET Tool)
> dotnet carna-runner [options] [assembly file]
If an assembly or settings file is not specified, the console runner uses the settings file the name of which is "carna-runner-settings.json" in the current working directory.
Specifies the carna runner settings file path. (Short form: /s)
Specifies the pattern of the full name of the fixture method or tag with the regular expression. (Short form: /f)
Specifies that no domain is created and the fixtures are run in the primary domain. If not specified, the separate domain is created for each assembly and the fixtures are run in it.
Specifies to wait for a user input before running the fixtures, allowing to attach a debugger. (Short form: /p)
Displays the usage message. (Short form: /h or /?)
For example:
> CarnaConsoleRunner.exe /f:T.+Story Lib.Spec.dll Core.Spec.dll
> CarnaConsoleRunner.exe /s:settings.json
-
Creates the Blank App (Universal Windows).
-
Adds the Carna.UwpRunner package.
PM> Install-Package Carna.UwpRunner
- Fixes App.xaml.cs as follows.
using Windows.ApplicationModel.Activation;
using Windows.UI.Xaml;
using Carna.UwpRunner;
namespace Lib.Spec
{
public partial class App : Application
{
public App()
{
InitializeComponent();
}
protected override void OnLaunched(LaunchActivatedEventArgs e)
{
Window.Current.Activate();
CarnaUwpRunner.Run();
}
}
}
- Adds "carna-runner-settings.json" file as Content and specifies the assembly name.
{
"assemblies": [
"Lib.Spec.exe"
]
}
In addition to the default options, the following options can be specified.
Type: boolean
Specifies the value that indicates whether to exit the application automatically after the running of CarnaUwpRunner is completed. The default value is false.
For example:
{
"autoExit": true
}
Type: Object
Specifies the formatter to format a fixture running result.
Type: String
Specifies the assembly-qualified name of the formatter that implements IFixtureFormatter interface.
Type: Object
Specifies options for the formatter. The options property is applied if the formatter class has a constructor that has a parameter of IDictionary<string, string>.
For example:
{
"formatter": {
"type": "Carna.Runner.Formatters.FixtureFormatter"
}
}
-
Creates the Blank App (WinUI).
-
Adds the Carna.WinUIRunner package.
PM> Install-Package Carna.WinUIRunner
- Fixes App.xaml.cs as follows.
using Windows.UI.Xaml;
using Carna.WinUIRunner;
namespace Lib.Spec
{
public partial class App : Application
{
public App()
{
InitializeComponent();
}
protected override void OnLaunched(LaunchActivatedEventArgs e)
{
CarnaWinUIRunner.Run();
}
}
}
- Adds "carna-runner-settings.json" file as Content and specifies the assembly name.
{
"assemblies": [
"Lib.Spec.exe"
]
}
In addition to the default options, the following options can be specified.
Type: boolean
Specifies the value that indicates whether to exit the application automatically after the running of CarnaWinUIRunner is completed. The default value is false.
For example:
{
"autoExit": true
}
Type: Object
Specifies the formatter to format a fixture running result.
Type: String
Specifies the assembly-qualified name of the formatter that implements IFixtureFormatter interface.
Type: Object
Specifies options for the formatter. The options property is applied if the formatter class has a constructor that has a parameter of IDictionary<string, string>.
For example:
{
"formatter": {
"type": "Carna.Runner.Formatters.FixtureFormatter"
}
}