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" />
paket add InSummaFrontEndAutomatedTesting --version 1.0.2
#r "nuget: InSummaFrontEndAutomatedTesting, 1.0.2"
// Install InSummaFrontEndAutomatedTesting as a Cake Addin
#addin nuget:?package=InSummaFrontEndAutomatedTesting&version=1.0.2
// Install InSummaFrontEndAutomatedTesting as a Cake Tool
#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:
testName
is the name of the test. It is required to ensure that tests can be distinguished of other tests.osType
is 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:Windows
MacOS
Linux
webBrowserType
is an enumeration which describes on which web browser your tests will run. Currently supported values are:Chrome
Edge
FireFox
Safari
driverPath
is 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_win32
This web driver has to be the same version as your browser.url
contains the system under test url.actions
is 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:
bluePrintName
and an array ofactions
. - Click: This action simulates a mouse click. Required fields:
actionType
is an enumeration. Required value for Click actions isClick
.locatorType
is an enumeration used to describe which locator has to be targeted. Possible values:ClassName
Id
XPath
targetElement
contains the 'name' of the target element. Example when using thelocatorType
Id
targetElement : "username"
delayInSeconds
integer value that results in a delay (in seconds) of the specified action.
- SendKeys: This action simulates keyboard input in input fields. Required fields:
SendKeys
actionType
is an enumeration. Required value for Click actions isSendKeys
.locatorType
is an enumeration used to describe which locator has to be targeted. Possible values:ClassName
Id
XPath
targetElement
contains the 'name' of the target element. Example when using thelocatorType
Id
targetElement : "email"
data
contains the value that has to be filled into the form.delayInSeconds
integer 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:
finalCondition
contains the expected final condition.locatorType
is an enumeration used to describe which locator has to be targeted. Possible values: -Url
-ClassName
-Id
-XPath
targetElement
contains the 'name' of the expected final target element that should be visible. Used whenlocatorType
isClassName
,Id
orXPath
url
contains the expected final url. Only used whenlocatorType
isurl
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.Run
method:
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. |
-
- 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 | 239 | 3/29/2022 |
Summary of changes made in this release of the package.