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
We are using MSTest and are having issues with Atata when running UI tests in parallel.
The Current Context seems to only refer to the most recently created Atata context. This seems reasonable as it is CurrentContext. Many of our tests use AtataContext.Current.TakeScreenshot() at the very least this causes confusion in the logs. Many of the contexts created in parallel tests have a different base URL because they are used for different web sites in different domains.
The ArtifactsRootPathTemplate is set at AtataContext.GlobalProperties.UseArtifactsRootPathTemplate(). We keep track of this path on a per-test basis (set to $"TestContext.DeploymentDirectory\art{DateTime.Now:yyyyMMdd.HHmmssfff}". As global Atata property, this only works for the last context created. This isn't a huge issue as we use an event handler for ArtifactAddedEvent and the events contain the path to the artifact.
We are also having issues setting a handler for the ArtifactAddedEvent to handle screenshots. The handler is set in the GlobalConfiguration.EventSubscriptions. If we set one handler for each Atata instance, there will be multiple handlers and most of them will fail (because the event was handled by one of the other handlers). Setting a single handler for all instances also runs into issues because our logger is a different instance for each test and is written-to in the handler. In this case, the handler doesn't fail, but all of the screenshots are handled by one test logger, and many of the screenshots are logged to the wrong test.
How can we manage multiple Atata contexts, event handlers, and screenshot requests when tests are running in parallel so that everything stays separate on a per-test basis?
The text was updated successfully, but these errors were encountered:
There might be some misconfiguration. Have you checked MSTest sample project? I've just reviewed and verified it works well with parallel tests. By the way, I added a fix to UITestFixture. Nevertheless, mainly UITestFixture.SetUp method should be similar to:
We are using MSTest and are having issues with Atata when running UI tests in parallel.
The Current Context seems to only refer to the most recently created Atata context. This seems reasonable as it is
CurrentContext
. Many of our tests useAtataContext.Current.TakeScreenshot()
at the very least this causes confusion in the logs. Many of the contexts created in parallel tests have a different base URL because they are used for different web sites in different domains.The ArtifactsRootPathTemplate is set at
AtataContext.GlobalProperties.UseArtifactsRootPathTemplate()
. We keep track of this path on a per-test basis (set to$"TestContext.DeploymentDirectory\art{DateTime.Now:yyyyMMdd.HHmmssfff}"
. As global Atata property, this only works for the last context created. This isn't a huge issue as we use an event handler forArtifactAddedEvent
and the events contain the path to the artifact.We are also having issues setting a handler for the
ArtifactAddedEvent
to handle screenshots. The handler is set in theGlobalConfiguration.EventSubscriptions
. If we set one handler for each Atata instance, there will be multiple handlers and most of them will fail (because the event was handled by one of the other handlers). Setting a single handler for all instances also runs into issues because our logger is a different instance for each test and is written-to in the handler. In this case, the handler doesn't fail, but all of the screenshots are handled by one test logger, and many of the screenshots are logged to the wrong test.How can we manage multiple Atata contexts, event handlers, and screenshot requests when tests are running in parallel so that everything stays separate on a per-test basis?
The text was updated successfully, but these errors were encountered: