> dotnet new tool-manifest
> dotnet tool install carna-runner
<PropertyGroup> <TargetFramework>net8.0</TargetFramework> <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> </PropertyGroup>
<ItemGroup> <PackageReference Include="Carna" Version="3.0.0"> <IncludeAssets>compile</IncludeAssets> </PackageReference> </ItemGroup>
{ "assemblies": [ "Lib.Spec.dll" ], "reporters": [ { "reporter": { "type": "Carna.ConsoleRunner.Reporters.ConsoleFixtureReporter,carna-runner", "options": { "stepVisible": true } } } ] }
> dotnet new console
> dotnet add package Carna.ConsoleRunner
using Carna.ConsoleRunner; namespace Lib.Spec; internal static class Program { private static int Main(string[] args) => CarnaConsoleRunner.Run(args); }
{ "assemblies": [ "Lib.Spec.dll" ], "reporters": [ { "reporter": { "type": "Carna.ConsoleRunner.Reporters.ConsoleFixtureReporter,Carna.ConsoleRunner", "options": { "stepVisible": true } } } ] }
(.NET Tool)
> dotnet carna-runner [options] [assembly file]
(.NET Core)
> dotnet run [options] [assembly file]
If an assembly or settings file is not specified, the console runner uses the settings file whose name is "carna-runner-settings.json" in the current working directory.
Specifies the path of the carna runner settings file. (Short form: -s)
Specifies the pattern of the full name of the fixture method or the tag of the fixture with the regular expression. (Short form: -f)
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:
> dotnet carna-runner -f:T.+Story Lib.Spec.dll Core.Spec.dll
> dotnet carna-runner -s:settings.json
PM> Install-Package Carna.WinUIRunner
using Microsoft.UI.Xaml; using Carna.WinUIRunner; namespace Lib.Spec; public partial class App : Application { public App() { InitializeComponent(); } protected override void OnLaunched(LaunchActivatedEventArgs e) { CarnaWinUIRunner.Run(); } }
{ "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 the 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 the IDictionary<string, string>.
For example:
{ "formatter": { "type": "Carna.Runner.Formatters.FixtureFormatter" } }