InSummaFrontEndAutomatedTesting 1.0.2
dotnet add package InSummaFrontEndAutomatedTesting --version 1.0.2
NuGet\Install-Package InSummaFrontEndAutomatedTesting -Version 1.0.2
<PackageReference Include="InSummaFrontEndAutomatedTesting" Version="1.0.2" />
<PackageVersion Include="InSummaFrontEndAutomatedTesting" Version="1.0.2" />
<PackageReference Include="InSummaFrontEndAutomatedTesting" />
paket add InSummaFrontEndAutomatedTesting --version 1.0.2
#r "nuget: InSummaFrontEndAutomatedTesting, 1.0.2"
#:package InSummaFrontEndAutomatedTesting@1.0.2
#addin nuget:?package=InSummaFrontEndAutomatedTesting&version=1.0.2
#tool nuget:?package=InSummaFrontEndAutomatedTesting&version=1.0.2
Automated-UI-Testing
Library for easily running automated UI tests in Visual Studio projects through writing test scenario's in JSON.
Table of Contents
Directories
Test case files have to be placed to the directory /TestCases below the root folder where the .csproj project file is located.
Blueprints can be added in a subdirectory of this test case using this folder structure; /TestCases/BluePrints
Directory names are case sensitive.
The input file
To use the library, a valid input file in JSON format is required with the following properties:
testNameis the name of the test. It is required to ensure that tests can be distinguished of other tests.osTypeis an enumeration that describes on which platform your testscenario will run. This is metadata that can be used in your test framework. Current supported values are:WindowsMacOSLinux
webBrowserTypeis an enumeration which describes on which web browser your tests will run. Currently supported values are:ChromeEdgeFireFoxSafari
driverPathis an optional value that describes the URI of the web driver. If the web driver is contained in the path variable, this field can be ignored. Example:C:\\Users\\frankmolengraaf\\ChromeDriver\\chromedriver_win32This web driver has to be the same version as your browser.urlcontains the system under test url.actionsis an array that contains the actions that have to be executed in procedural order. There are multiple types of actions that can be used.- Blueprints: Blueprints are used to be able to reuse a set of actions. The blueprint json files consist of:
bluePrintNameand an array ofactions. - Click: This action simulates a mouse click. Required fields:
actionTypeis an enumeration. Required value for Click actions isClick.locatorTypeis an enumeration used to describe which locator has to be targeted. Possible values:ClassNameIdXPath
targetElementcontains the 'name' of the target element. Example when using thelocatorTypeIdtargetElement : "username"delayInSecondsinteger value that results in a delay (in seconds) of the specified action.
- SendKeys: This action simulates keyboard input in input fields. Required fields:
SendKeysactionTypeis an enumeration. Required value for Click actions isSendKeys.locatorTypeis an enumeration used to describe which locator has to be targeted. Possible values:ClassNameIdXPath
targetElementcontains the 'name' of the target element. Example when using thelocatorTypeIdtargetElement : "email"datacontains the value that has to be filled into the form.delayInSecondsinteger value that results in a delay (in seconds) of the specified action.
- Blueprints: Blueprints are used to be able to reuse a set of actions. The blueprint json files consist of:
finalConditioncontains the expected final condition.locatorTypeis an enumeration used to describe which locator has to be targeted. Possible values: -Url-ClassName-Id-XPathtargetElementcontains the 'name' of the expected final target element that should be visible. Used whenlocatorTypeisClassName,IdorXPathurlcontains the expected final url. Only used whenlocatorTypeisurl
Example Template
{
"testName": "Log_In_And_Open_Report",
"osType": "Windows",
"webBrowserType": "Chrome",
"url": "https://app.webdashboard.com",
"actions": [
{
"bluePrintName": "LogIn"
},
{
"actionType": "Click",
"locatorType": "ClassName",
"targetElement": "report-item",
"delayInSeconds": "15"
}
],
"finalCondition": {
"locatorType": "Url",
"targetElement": "",
"url": "https://app.webdashboard.com/en/report"
}
}
BluePrint Template Example
{
"bluePrintName": "LogIn",
"actions": [
{
"actionType": "Click",
"locatorType": "ClassName",
"targetElement": "login-button"
},
{
"actionType": "SendKeys",
"locatorType": "Id",
"targetElement": "Email",
"data": "hello@insumma.nl"
},
{
"actionType": "Click",
"locatorType": "Id",
"targetElement": "nextbutton"
},
{
"actionType": "Click",
"locatorType": "Id",
"targetElement": "loginbutton",
"delayInSeconds": "5"
}
]
}
Using library in unit test project
To use the library in the unit test project, follow these steps:
- Create new unit test (project).
- Import Automated UI Test library.
- Call the
StartUp.Runmethod:
var testResult = StartUp.Run(new Uri(templatePath));
- Optional: Use
TestExtensions.GetTestCases()to get TestCaseData.
Example
using InSummaFrontEndAutomatedTesting.Main;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
namespace InSummaWebdashboard.UITests
{
public class Tests
{
[SetUp]
public void Setup()
{
}
[TestCaseSource(nameof(GetTestCases))]
public static void Test(string templatePath)
{
var testResult = StartUp.Run(new Uri(templatePath));
Assert.AreNotEqual(testResult.ActionResults.Count(), 0);
Assert.AreEqual(testResult.TestCompletedSuccessfully, true);
}
private static IEnumerable<TestCaseData> GetTestCases()
{
var testCases = TestExtensions.GetTestCases();
foreach(var testCase in testCases)
{
yield return new TestCaseData(testCase.Path).SetArgDisplayNames(testCase.Name);
}
}
}
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
- Microsoft.Extensions.DependencyInjection (>= 6.0.0)
- Microsoft.Extensions.Logging (>= 6.0.0)
- Microsoft.Extensions.Logging.Console (>= 6.0.0)
- Microsoft.Extensions.Logging.Debug (>= 6.0.0)
- Selenium.WebDriver (>= 4.1.0)
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.2 | 411 | 3/29/2022 |
Summary of changes made in this release of the package.