Run specific scenarios

Updated: 04 February 2023

SpecFlow converts tags in feature files to test case categories.

For xUnit

dotnet test --filter Category=done
dotnet test --filter "Category=us123 & Category=done"
dotnet test --filter "Category=done | Category=automated"
@US123
Feature: Breakfast

@done @important
Scenario: Eating cucumbers
  Given there are 12 cucumbers
  When I eat 5 cucumbers
  Then I should have 7 cucumbers

@automated
Scenario: Use all the sugar
  Given there is some sugar in the cup
  When I put all the sugar to my coffee
  Then the cup is empty

https://docs.specflow.org/projects/specflow/en/latest/Execution/Executing-Specific-Scenarios.html

.NET

Updated: 29 January 2023

.NET is an open source developer platform (i.e. the Languages & Libraries) for building different types of apps. The supported languages are C#, Visual Basic and F#.

Target platforms are:

  • .NET Core which runs on Windows, Linux and macOS.
  • .NET Framework for websites, services and apps on Windows only.
  • Xamarin / Mono, a .NET for mobile e.g. iOS devices, Apple Watch/TV Android.

https://docs.microsoft.com/dotnet
https://aka.ms/dotnethelloworld

 

The Host

A container which offers built-in services:

  • Dependency injection – a technique for achieving Inversion of Control between classes and their dependencies.
  • Configuration
  • Logging
  • Options pattern
  • Host Services

.NET 6 offers Generic DefaultHost which can be configured for the application use cases.

Hosted Service

A service which performs work in the background. Any reference type object which implements IHostedService is a background / hosted / worker service.

DI Service Container

Class dependencies can be registered in a service container.

.NET provides a built-in service container, IServiceProvider. Services are typically registered at the app’s start-up and appended to an IServiceCollection. Once all services are added BuildServiceProvider is used to create the service container.

Dependency Injection injects the service into the constructor of the class where it’s needed. The framework takes on the responsibility of creating an instance of the dependency and disposing of it when it’s no longer needed.

.NET console commands

Updated: 21 June 2023

Build a project and its dependencies using Release configuration

dotnet build --configuration Release

Build and test the Release version of a console application

dotnet run --configuration Release

Run the tests in the project in the current directory

dotnet test

Publishes the application and its dependencies to a folder for deployment to a hosting system.

dotnet publish

Build the project and its dependencies into a set of binaries. The binaries include the project’s code in Intermediate Language (IL) files with a .dll extension.

dotnet build

Clean up the output of the previous build. Both intermediate (obj) and final output (bin) folders are cleaned.

dotnet clean

Restores the dependencies and tools for a project i.e. external libraries in NuGet packages. All dependencies become available in a local cache and can be used by the .NET CLI to build and run the application.

dotnet restore