WebNativeDEV.SINUS.Core 1.0.4

There is a newer version of this package available.
See the version list below for details.
dotnet add package WebNativeDEV.SINUS.Core --version 1.0.4                
NuGet\Install-Package WebNativeDEV.SINUS.Core -Version 1.0.4                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="WebNativeDEV.SINUS.Core" Version="1.0.4" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add WebNativeDEV.SINUS.Core --version 1.0.4                
#r "nuget: WebNativeDEV.SINUS.Core, 1.0.4"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install WebNativeDEV.SINUS.Core as a Cake Addin
#addin nuget:?package=WebNativeDEV.SINUS.Core&version=1.0.4

// Install WebNativeDEV.SINUS.Core as a Cake Tool
#tool nuget:?package=WebNativeDEV.SINUS.Core&version=1.0.4                

SINUS (Selenium In .Net Ui Solutions)

Main CodeQL Nuget Nuget Maintainability Rating Reliability Rating Security Rating Vulnerabilities Bugs Code Smells

Main idea of this package is to provide a readable and easy way to perform web UI tests. Hereby the package is opinionated and makes some decisions that need to be accepted for its usage. It defines a way (one of hundreds) how tests should be written and defines also the technology to use. Additionally a lot of checks are added to guarantee consistency and preventing memory leaks.

Dependencies:

  • MS Test
  • Microsoft.AspNetCore.Mvc.Testing
  • Microsoft.Extensions.Logging...
  • FluentAssertions
  • NSubstitute
  • Selenium

Example Screenshot

There are hard dependencies in SINUS to C#, newest .NET-Versions, MS-Test and Selenium (including partly Chrome) using BaseClasses and pre-defined patterns. SINUS focuses on a Given-When-Then approach of writing tests (BDT - Behaviour Driven Testing) to provide human readable descriptions with few effort.

Example:

    [TestMethod]
    public void Given_ATestSystem_When_StoringTheTitle_Then_ItShouldBeTheRightValue()
        => this.Test(r => r
            .GivenASystemAndABrowserAtRandomEndpoint<Program>("SimpleView", "/simpleView")
            .When((browser, data) => data.StoreActual(browser.Title))
            .Then((browser, data) => data.Should().ActualBe("SINUS TestSystem"))
            .DebugPrint());

Calling the test:

dotnet test --filter "FullyQualifiedName=WebNativeDEV.SINUS.Tests.SimpleBrowserTests.Given_ATestSystem_When_StoringTheTitle_Then_ItShouldBeTheRightValue"

Debug standard output:

    ...

    +-----------------------------
    | Start: (TaskId:  <null>, ThreadId: 16)
    |      Args: 
    |          * --urls=https://localhost:10012
    |          * --isKestrelHost=yes
    |          * --ExecutionMode=Mock
    |          * --environment=Development
    |          * --contentRoot=C:\Users\kienb\source\repos\webnativedev\SINUS\source\WebNativeDEV.SINUS.SystemUnderTest
    |          * --applicationName=WebNativeDEV.SINUS.SystemUnderTest
    |      Mocking: activated
    |      Start Failing: deactivated
    |      ExternalArgs: 
    +-----------------------------

    ...

Given: A Test System (TaskId: 1, ThreadId: 4)
    Create Browser requested for https://localhost:10012/simpleView
    Create driver instance for chrome with options 'Headless: True, IgnoreSslErrors: True'
    write chromedriverservice-logs to: ...\chromedriverservices_2023-09-30__11-29-11-1992760.log
info: WebNativeDEV.SINUS.SystemUnderTest.Controllers.ViewController[0]
      View Accessed Get() (TaskId:  <null>, ThreadId: 10)
    Broswer object created OpenQA.Selenium.Chrome.ChromeDriver - logger: Microsoft.Extensions.Logging.Logger - content: ...\In\[HOSTNAME]
= 4382 ms (TaskId: 1, ThreadId: 4)

When: Storing The Title (TaskId: 1, ThreadId: 4)
    Title requested SINUS TestSystem
= 18 ms (TaskId: 1, ThreadId: 4)

Then: It Should Be The Right Value (TaskId: 1, ThreadId: 4)
= 23 ms (TaskId: 1, ThreadId: 4)

Debug: Debug (TaskId: 1, ThreadId: 4)
    Content dump:
       +----------------------------
       | Count: 1
       +----------------------------
       | actual: SINUS TestSystem (Type: System.String)
       +----------------------------
= 24 ms (TaskId: 1, ThreadId: 4)

Close: Close (TaskId: 1, ThreadId: 4)
    Driver quitted
    
    ...
    
    +-----------------------------
    | Shutdown: (TaskId:  <null>, ThreadId: 14)
    |      Args: 
    |          * --urls=https://localhost:10012
    |          * --ExecutionMode=Mock
    |          * --environment=Development
    |          * --contentRoot=C:\Users\kienb\source\repos\webnativedev\SINUS\source\WebNativeDEV.SINUS.SystemUnderTest
    |          * --applicationName=WebNativeDEV.SINUS.SystemUnderTest
    |      Mocking: activated
    +-----------------------------
= 514 ms (TaskId: 1, ThreadId: 4)

The test result is evaluated as successful for test 'Given_ATestSystem_When_StoringTheTitle_Then_ItShouldBeTheRightValue'. (Checked Exceptions: 0, TaskId: 1, ThreadId: 4)

By reducing the complexity you are not able to use all of the features Selenium has. Nevertheless, the most common features are supported and covered by SINUS in a nicely shaped API that guides you through the test case and will add logging so that errors can be found simpler without any effort on the test-developer side.

Getting Started | Strategy | Considerations

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.5 84 5/3/2024
1.0.4 235 11/5/2023
1.0.3 170 7/20/2023
1.0.2 168 7/1/2023
1.0.1 163 7/1/2023
1.0.0 153 6/25/2023