Unicorn.Taf.Core
4.0.0
dotnet add package Unicorn.Taf.Core --version 4.0.0
NuGet\Install-Package Unicorn.Taf.Core -Version 4.0.0
<PackageReference Include="Unicorn.Taf.Core" Version="4.0.0" />
paket add Unicorn.Taf.Core --version 4.0.0
#r "nuget: Unicorn.Taf.Core, 4.0.0"
// Install Unicorn.Taf.Core as a Cake Addin #addin nuget:?package=Unicorn.Taf.Core&version=4.0.0 // Install Unicorn.Taf.Core as a Cake Tool #tool nuget:?package=Unicorn.Taf.Core&version=4.0.0
Unicorn.Taf.Core
Core of Unicorn test automation framework.
- Unit test framework implementation
- Base tests runners
- Logger abstractions
- Base utilities
- Asserts and base matchers
Migration notes
Test suite example
// Test suite example. The class should be marked as [Suite].
// It's possible to specify any number of suite tags and metadata.
// Suite tags allow to use parameterized targeted runs: suites are selected based on specific tags presence.
[Suite("Hello World web app")]
[Tag(Platforms.Web), Tag(Apps.HelloWorld)]
[Metadata("Description", "Example of test suite with parameterized test.")]
[Metadata("Site link", "https://unicorn-taf.github.io/test-ui-apps.html")]
public class HelloWorldWebSuite : BaseWebSuite
{
private HelloWorldPage HelloWorld => website.GetPage<HelloWorldPage>();
// Data for parameterized test. The method should return a list of DataSet.
// First parameter of DataSet is data set name and it is not a part of test data.
// For test parameterization the method could be static or non-static.
// For whole suite parameterization the method should be marked as [SuiteData] and be static.
public List<DataSet> TestParameters() =>
new List<DataSet>
{
new DataSet("Only title",
UsersFactory.GetUser(Users.NoGivenName), "Name is empty",
UI.Control.HasAttributeContains("class", "error")),
new DataSet("Title and name",
UsersFactory.GetUser(Users.JDoe), "Mr John said: 'Hello World!'",
Is.Not(UI.Control.HasAttributeContains("class", "error"))),
};
// Example of parameterized test. The method should be marked as [Test]
// and have the same number of parameters as DataSets in test data (ignoring data set name).
[Author(Authors.JDoe)]
[Category(Categories.Smoke)]
[Test("'Say' button functionality")]
[TestData(nameof(TestParameters))]
public void TestSaying(User user, string expectedText,
TypeSafeMatcher<IControl> dialogMatcher) // It's possible to parameterize even matchers
{
if (!string.IsNullOrEmpty(user.Title))
{
Do.Website.HelloWorld.SelectTitle(user.Title);
}
Do.Website.HelloWorld.InputName(user.GivenName);
Do.Website.HelloWorld.ClickSay();
// There is a built-in assertion mechanism which works together with matchers
// (rich collection of self-describable checks)
Assert.That(HelloWorld.Modal, dialogMatcher);
Assert.That(HelloWorld.Modal.TextContent, UI.Control.HasText(expectedText));
}
// Example of simple test with specified category.
// It's possible to specify tests execution order within a test suite using [Order].
// Tests with higher order will be executed later.
[Author(Authors.JDoe)]
[Category(Categories.Smoke)]
[Test("Hello World page default layout")]
public void TestHelloWorldDefaultLayout() =>
Do.Assertion.StartAssertionsChain()
.VerifyThat(HelloWorld.MainTitle, UI.Control.HasText("\"Hello World\" app"))
.VerifyThat(HelloWorld.TitleDropdown, UI.Dropdown.HasSelectedValue("Nothing selected"))
.VerifyThat(HelloWorld.NameInput, UI.TextInput.HasValue(string.Empty))
.AssertChain();
// Actions executed after each test.
// It's possible to specify:
// - whether it needs to be run in case of test fail or not
// - whether need to skip all next tests if AfterTest is failed or not
[AfterTest]
public void RefreshPage() =>
Do.Website.RefreshPage();
}
Test assembly setup and tear down
// Actions performed before and/or after all tests execution.
[TestAssembly]
public class TestsAssembly
{
// Actions before all tests execution.
// The method should be static.
[RunInitialize]
public static void InitRun()
{
// Use of custom logger instead of default Console logger.
ULog.SetLogger(new CustomLogger());
// Set trace logging level.
ULog.SetLevel(LogLevel.Trace);
// It's possible to customize TAF configuration in assembly init.
// Current setting controls behavior of dependent tests in case
// when referenced test is failed (tests could be failed, skipped or not run)
Unicorn.Taf.Core.Config.DependentTests = Unicorn.Taf.Core.TestsDependency.Skip;
}
// Actions after all tests execution.
// The method should be static.
[RunFinalize]
public static void FinalizeRun()
{
// .. some cleanup actions
}
}
Unicorn config
Config properties
Any of properties are optional, in case of property absence default value is used. Most of the properties could be overriden by code (for example in [RunInitialize]
)
testsDependency: specifies how to deal with dependent tests in case when main test was failed. Available options
- Skip
- DoNotRun
- Run (default)
testsOrder: specifies in which order to run tests within a suite. Available options
- Alphabetical
- Random
parallel: specifies how to parallel tests execution. Available options
- Suite
- None (default)
threads: specifies how many threads are used to run tests in parallel. Default: 1
testTimeout: specifies timeout for test and suite method execution in minutes. Default: 15
suiteTimeout: specifies timeout for test suite execution in minutes. Default: 40
tags: list of suites tags to be run. Default: empty (don't filter out suites by tags)
categories: list of test categories to be run. Default: empty (don't filter out tests by categories)
tests: list of tests masks to be run. Default: empty (run all)
userDefined: parent for user defined properties any number of custom properties as key-value pair could be specified. In code the property could be retrieved by calling
Config.GetUserDefinedSetting("setting_name")
.
Config file example
{
"testsDependency": "Skip",
"testsOrder": "Random",
"parallel": "Suite",
"threads": 2,
"testTimeout": 15,
"suiteTimeout": 60,
"tags": [ "Tag1", "Tag2" ],
"categories": [ "Smoke" ],
"tests": [ ],
"userDefined": {
"customProperty1": "value1",
"customProperty2": "value2"
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Unicorn.Taf.Api (>= 1.2.0)
NuGet packages (7)
Showing the top 5 NuGet packages that depend on Unicorn.Taf.Core:
Package | Downloads |
---|---|
Unicorn.UI.Core
Unicorn.UI.Core is extension of Unicorn test automation framework which allows to use in tests implementations of specific UI extensions or develop custom ones. Unicorn UI Core features: Common controls interfaces, UI matchers for common controls, synchronization methods (waits), core for different UI implementations. This package includes UI core of unicorn automation framework. |
|
Unicorn.ReportPortalAgent
Unicorn.ReportPortalAgent is Unicorn test automation framework extension which allows to report your tests execution into EPAM ReportPortal. This package includes ready for use implementation of EPAM ReportPortal extension which is referenced by your tests. You will need to deploy EPAM ReportPortal within your infrastructure to report your tests there. |
|
Unicorn.Backend
Unicorn.Backend is test automation framework extension which provides ready for use implementation of interaction with backend. Unicorn Backend features: Ready for use implementation of interaction with backend, corresponding matchers. |
|
Unicorn.AllureAgent
Unicorn.AllureAgent is Unicorn test automation framework extension which allows to report your tests execution into Allure report. This package includes ready for use implementation of Allure extension which is referenced by your tests. |
|
Unicorn.Reporting.TestIT
Unicorn.Reporting.TestIT is Unicorn test automation framework extension which allows to report your tests execution into TestIT TMS. This package includes ready for use implementation of TestIT extension which is referenced by your tests. |
GitHub repositories
This package is not used by any popular GitHub repositories.