You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The aggregate (multiple) assertion functionality should be implemented to be able to invoke several Should.* assertions, collect the failed results and produce a single exception containing a set of failed assertions.
Implement 2 strategies of aggregate assertion:
Atata default/native.
Using NUnit's Assert.Multiple and other related methods.
Every failed assertion in the scope of aggregate one is written to log.
Implement AggregateAssertionException that represents one or more errors that occur during an aggregate assertion. This is the default aggregate assertion exception type that can be replaced with custom one thru AtataContextBuilder.
Should have a constructor with IEnumerable<AssertionResult> results argument to build the aggregate message based on the list of results.
Additions to AtataContextBuilder
Add methods for configuring aggregate assertion functionality:
When using NUnit, it is recommended to invoke UseNUnitAggregateAssertionStrategy() during AtataContext configuration in order to enable NUnit's built-in multiple assert functionality. For other testing frameworks (xUnit, MSTest) the native Atata assertion functionality will work well by default.
Additions to PageObject<TOwner>
Below 2 methods provide aggregate assertion directly to the page object with support of fluent interface:
public TOwner AggregateAssert(Action<TOwner>action);public TOwner AggregateAssert<TComponent>(Func<TOwner,TComponent>componentSelector,Action<TComponent>action);
Under the hood, the methods use AtataContext.AggregateAssert method.
AtataContext.Current.AggregateAssert(()=>{ Go.To<SomeUserPage>(). ContactDetails.FirstName.Should.Equal("John"). ContactDetails.LastName.Should.Equal("Smith");// Do other assertions...});
The text was updated successfully, but these errors were encountered:
Implementation
The aggregate (multiple) assertion functionality should be implemented to be able to invoke several
Should.*
assertions, collect the failed results and produce a single exception containing a set of failed assertions.Implement 2 strategies of aggregate assertion:
Assert.Multiple
and other related methods.Every failed assertion in the scope of aggregate one is written to log.
Additions to
AtataContext
The actual main aggregate assertion method:
AggregateAssertionException
Implement
AggregateAssertionException
that represents one or more errors that occur during an aggregate assertion. This is the default aggregate assertion exception type that can be replaced with custom one thruAtataContextBuilder
.Should have a constructor with
IEnumerable<AssertionResult> results
argument to build the aggregate message based on the list of results.Additions to
AtataContextBuilder
Add methods for configuring aggregate assertion functionality:
When using NUnit, it is recommended to invoke
UseNUnitAggregateAssertionStrategy()
duringAtataContext
configuration in order to enable NUnit's built-in multiple assert functionality. For other testing frameworks (xUnit, MSTest) the native Atata assertion functionality will work well by default.Additions to
PageObject<TOwner>
Below 2 methods provide aggregate assertion directly to the page object with support of fluent interface:
Under the hood, the methods use
AtataContext.AggregateAssert
method.Usage
Aggregate assert page object
Or:
Aggregate assert component
Aggregate assert section
The text was updated successfully, but these errors were encountered: