Upgrade to Atata 4

How to upgrade to Atata 4 considering breaking changes.

If Atata Framework is useful to you or your company, consider supporting the framework development with a donation.
Need help with Atata, .NET test automation, or automation strategy? Hire Atata's creator for consulting or development and get direct expert support.

First steps

The first migration step is to ensure or upgrade your Atata to the latest version 3.x.x. Then fix all Atata warnings telling that some class/member is obsolete, as those items are removed in v4.

It is also recommended to get familiar with Atata Framework 4 Release blog post to find out what’s new and changed in v4.

AtataContextBuilder

In AtataContextBuilder obsolete methods were removed: UseUtcTimeZone, UseTimeZone.

AtataBuildingContext was removed. Its members were extracted to AtataContextBuilder and other builder classes.

In AtataContextBuilder the ArtifactsPathTemplate property and the UseArtifactsPathTemplate method were removed. Introduced IArtifactsPathFactory and its implementations, where TestInfoBasedHierarchicalArtifactsPathFactory is the default one. Added ArtifactsPathFactory and RootNamespace properties to AtataContextGlobalProperties. For custom path template, create custom class implementing IArtifactsPathFactory and register it via AtataContext.GlobalProperties.UseArtifactsPathFactory(...) method.

JSON configuration

Atata.Configuration.Json is deprecated with 4th version of Atata Framework.

JSON configuration can be migrated to the built-in runtime configuration with the help of Microsoft.Extensions.Configuration package, using environment variables, test parameters, or custom configuration files. Please check out the Complex configuration tutorial for more details and examples.

NUnit

All NUnit related functionality was moved from Atata package to the new Atata.NUnit package. Methods that were in AtataContextBuilder became extension methods in Atata.NUnit namespace. Pay attention to obsolete warnings, as some types and members that were moved are now marked as obsolete and will be removed later.

So if you use NUnit with Atata, add Atata.NUnit package reference and Atata.NUnit namespace using. Also please read documentation of Atata.NUnit library, as there is a new configuration approach.

NLog

All NLog related functionality was moved from Atata package to the new Atata.NLog package.

So if you use NLog for Atata logging, add Atata.NLog package reference and Atata.NLog namespace using. Also please read documentation of Atata.NLog library.

Driver setup methods

In Atata 3, the following methods of AtataContextBuilder were used for drivers setup:

In Atata 4, the above methods became obsolete, and the new AtataContextBuilder extension methods were introduced:

Please notice that the new methods return AtataContextBuilder. In contrast to old methods, the new methods do not execute the drivers setup immediately, they add event subscription handler on AtataContextInitStartedEvent and execute during build of AtataContext.

The GlobalFixture.ConfigureGlobalAtataContext method is a recommended place for a driver setup configuration method call.

public sealed class GlobalFixture : AtataGlobalFixture
{
    protected override void ConfigureAtataContextBaseConfiguration(AtataContextBuilder builder)
    {
        //builder.Sessions.AddWebDriver(...);
    }

    protected override void ConfigureGlobalAtataContext(AtataContextBuilder builder)
    {
        builder.SetUpWebDriversForUse();
    }
}

LogConsumersBuilder

LogConsumersAtataContextBuilder was renamed to LogConsumersBuilder. LogConsumersBuilder methods and related extension methods were reworked to return AtataContextBuilder and use configure delegate parameter for consumer configuration.

EventSubscriptionsBuilder<TRootBuilder>

EventSubscriptionsAtataContextBuilder class dropped inheritance of AtataContextBuilder and became a generic EventSubscriptionsBuilder<TRootBuilder> class. EventSubscriptions property is now present in both AtataContextBuilder and AtataSessionBuilder<TSession, TBuilder> classes, which allows to subscribe on context or session events individually. EventSubscriptionsBuilder methods and related extension methods were reworked to return AtataContextBuilder/AtataSessionBuilder.

Attributes builders

AtataContext attributes builders were reworked to return AtataContextBuilder.

AssemblyNamePatternToFindTypes

The following methods of AtataContextBuilder were removed: UseDefaultAssemblyNamePatternToFindTypes, UseAssemblyNamePatternToFindComponentTypes, UseAssemblyNamePatternToFindAttributeTypes, UseAssemblyNamePatternToFindEventTypes, UseAssemblyNamePatternToFindEventHandlerTypes. Instead use a single common AtataContext.GlobalProperties.UseAssemblyNamePatternToFindTypes method in global fixture:

public sealed class GlobalFixture : AtataGlobalFixture
{
    protected override void ConfigureAtataContextGlobalProperties(AtataContextGlobalProperties globalProperties) =>
        globalProperties.UseAssemblyNamePatternToFindTypes("...regex...");
}

The default value of AssemblyNamePatternToFindTypes property of AtataContextGlobalProperties is @"^(?!System($|\..+)|mscorlib$|netstandard$|Microsoft\..+|testhost$|(?i:testcentric\..+)|(?i:nunit)|(?i:xunit))".

Miscellaneous

Renamed types

Renamed types where old are still available as obsolete

Moved/renamed members

AtataContext

AtataContextGlobalProperties

AtataContextBuilder

BrowserLogEntry

LogConsumerBuilder<TLogConsumer>

LogConsumerConfiguration

IObjectVerificationProviderExtensions

IEnumerableExtensions

Feedback

Feel free to use any contact channel if you have problems with migration.


If Atata Framework is useful to you or your company, consider supporting the framework development with a donation.
Need help with Atata, .NET test automation, or automation strategy? Hire Atata's creator for consulting or development and get direct expert support.