WebNativeDEV.SINUS.Core
1.0.5
dotnet add package WebNativeDEV.SINUS.Core --version 1.0.5
NuGet\Install-Package WebNativeDEV.SINUS.Core -Version 1.0.5
<PackageReference Include="WebNativeDEV.SINUS.Core" Version="1.0.5" />
paket add WebNativeDEV.SINUS.Core --version 1.0.5
#r "nuget: WebNativeDEV.SINUS.Core, 1.0.5"
// Install WebNativeDEV.SINUS.Core as a Cake Addin #addin nuget:?package=WebNativeDEV.SINUS.Core&version=1.0.5 // Install WebNativeDEV.SINUS.Core as a Cake Tool #tool nuget:?package=WebNativeDEV.SINUS.Core&version=1.0.5
SINUS (Selenium In .Net Ui Solutions)
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
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.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. 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. |
-
net8.0
- FluentAssertions (>= 6.12.0)
- Microsoft.AspNetCore.Mvc.Testing (>= 8.0.4)
- Microsoft.Extensions.Logging.Console (>= 8.0.0)
- Microsoft.NET.Test.Sdk (>= 17.9.0)
- MSTest.TestAdapter (>= 3.3.1)
- MSTest.TestFramework (>= 3.3.1)
- NSubstitute (>= 5.1.0)
- Selenium.WebDriver (>= 4.19.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.