2

This is a known issue(at least in .Net Core I guess).

I'm attempting to make use of the SpecFlow+ targets functionality as described here.

Once implemented in .srprofile, I can see a single test is split into two different copies in VisualStudio based on targets(In my case: Chrome, IE). Targets are picked perfectly when I run the tests on Single thread. But when I run on more that one thread, the targets are of the same type.

For example, if I run tests on two threads, the picked-up targets are:

   1) Chrome, Chrome as opposed to Chrome, IE. 

                   (or)

   2) IE, IE as opposed to Chrome, IE.

My default.srprofile is:

<?xml version="1.0" encoding="utf-8"?>
<TestProfile xmlns="http://www.specflow.org/schemas/plus/TestProfile/1.5">
    <Settings projectName="UIAutomation" />
    <Execution  testThreadCount="1" retryCount="2"  />

    <Environment testThreadIsolation="Process"/>

    <Report>
        <Template name="ReportTemplate.cshtml" outputName="UIReport{now:yyyy-MM-ddThhmmss}.html"/>
    </Report>

    <Targets>
        <Target name="Chrome">
            <Filter>@Chrome</Filter>
            <DeploymentTransformationSteps>
                <EnvironmentVariable variable="deviceType" value="Chrome" />
            </DeploymentTransformationSteps>
        </Target>

        <Target name="IE">
            <Filter>@IE</Filter>
            <DeploymentTransformationSteps>
                <EnvironmentVariable variable="deviceType" value="IE" />
            </DeploymentTransformationSteps>
        </Target>
    </Targets>

    <TestThreads>
        <TestThread id="0">
            <TestAffinity>@Chrome</TestAffinity>
        </TestThread>
        <TestThread id="1">
            <TestAffinity>@IE</TestAffinity>
        </TestThread>
    </TestThreads>

    <TestAssemblyPaths>
        <TestAssemblyPath>UIAutomation.dll</TestAssemblyPath>
    </TestAssemblyPaths>

</TestProfile>

So I have tried the following:

1) TestthreadIsolation Environment variable values as both Process and SharedAppDomain.

2) Using Filters to run the tests on correct targets.

3) I tried to run the official SpecFlow sample project as well. I was able to reproduce the same issue.

4) Also, I tried to make use of the [BeforeTestRun] and [AfterTestRun] hooks as suggested here.

I read the following links as well:

Specflow+ Community1

Specflow+ Community2

Stackoverflow

There seems to be at least 4 or 5 threads based on this issue on the SpecRun Google+ community, but those solutions do not work for me. Or should I move to .NET Framework instead of .NET Core Any help would be much appreciated!

Mir Rahed Uddin
  • 1,208
  • 2
  • 12
  • 25
Easwar AB
  • 71
  • 1
  • 5

0 Answers0