Skip to main content

Acceptance tests skipped using 'dotnet test' in Azure Pipeline

Comments

9 comments

  • Andreas Willich

    There should be the log file attached to the test run. In it should be more information, why the tests are skipped.

    0
  • Westhoff, Daniel

    Hi Andreas, hi all,

    thanks for your response. I found a log file in the "Test Plans > Runs" page for my run. I hope this is the log file you are referring to.

    Below you can see an excerpt of this file with an error that states the file or assembly 'Microsoft.AspNetCore.Mvc.Abstractions, Version=5.0.0.0' could not be found. Unfortunately, I have no idea why this happens and how i can solve it.

    Further help or hints how this can be solved would be nice!

    Regards, Daniel

    2021-02-09T16:23:52.5552826+00:00:2021-02-09T16:23:52.5549417+00:00:[AssemblyCache] Trying to resolve 'Microsoft.AspNetCore.Mvc.Abstractions' to '/home/vsts/work/1/s/experimental.MyUntappd.Specs/bin/Debug/net5.0/SpecFlowPlusRunner/netcoreapp5.0/Microsoft.AspNetCore.Mvc.Abstractions.exe'
    2021-02-09T16:23:52.5558892+00:00:2021-02-09T16:23:52.5556496+00:00:[AssemblyCache] Could not resolve 'Microsoft.AspNetCore.Mvc.Abstractions' in folder '/home/vsts/work/1/s/experimental.MyUntappd.Specs/bin/Debug/net5.0/SpecFlowPlusRunner/netcoreapp5.0'
    2021-02-09T16:23:52.6145047+00:00:2021-02-09T16:23:52.5640817+00:00:Assembly resolving Microsoft.AspNetCore.Mvc.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
    2021-02-09T16:23:52.6672200+00:00:2021-02-09T16:23:52.6203262+00:00:Thread#0:T:-> error: Unable to load one or more of the requested types.
    2021-02-09T16:23:52.7109935+00:00:2021-02-09T16:23:52.7103255+00:00:Thread#0:T:Could not load file or assembly 'Microsoft.AspNetCore.Mvc.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
    2021-02-09T16:23:52.7130537+00:00:2021-02-09T16:23:52.7117909+00:00:Thread#0:T:Could not load file or assembly 'Microsoft.AspNetCore.Mvc.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
    2021-02-09T16:23:52.7145709+00:00:2021-02-09T16:23:52.7134160+00:00:Thread#0:T: (0.0s)
    2021-02-09T16:23:52.7156480+00:00:2021-02-09T16:23:52.7153037+00:00:Thread#0:T:-> error: Type Loader exceptions: (0.0s)
    2021-02-09T16:23:52.7188943+00:00:2021-02-09T16:23:52.7171503+00:00:Thread#0:T:-> error: LoaderException: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.AspNetCore.Mvc.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
    2021-02-09T16:23:52.7194684+00:00:2021-02-09T16:23:52.7192277+00:00:Thread#0:T:File name: 'Microsoft.AspNetCore.Mvc.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' (0.0s)
    2021-02-09T16:23:52.7363450+00:00:2021-02-09T16:23:52.7356792+00:00:OutOfProcessTestAssemblyExecutor: RunTest error: System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types.
    Could not load file or assembly 'Microsoft.AspNetCore.Mvc.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.

    Could not load file or assembly 'Microsoft.AspNetCore.Mvc.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.

    at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
    at System.Reflection.RuntimeModule.GetTypes()
    at System.Reflection.Assembly.GetTypes()
    at TechTalk.SpecFlow.Bindings.Discovery.RuntimeBindingRegistryBuilder.BuildBindingsFromAssembly(Assembly assembly) in D:\a\1\s\TechTalk.SpecFlow\Bindings\Discovery\RuntimeBindingRegistryBuilder.cs:line 23
    at TechTalk.SpecFlow.TestRunnerManager.BuildBindingRegistry(IEnumerable`1 bindingAssemblies) in D:\a\1\s\TechTalk.SpecFlow\TestRunnerManager.cs:line 94
    at TechTalk.SpecFlow.TestRunnerManager.InitializeBindingRegistry(ITestRunner testRunner) in D:\a\1\s\TechTalk.SpecFlow\TestRunnerManager.cs:line 73
    at TechTalk.SpecFlow.TestRunnerManager.CreateTestRunner(Int32 threadId) in D:\a\1\s\TechTalk.SpecFlow\TestRunnerManager.cs:line 62
    at TechTalk.SpecFlow.TestRunnerManager.GetTestRunnerWithoutExceptionHandling(Int32 threadId) in D:\a\1\s\TechTalk.SpecFlow\TestRunnerManager.cs:line 155
    at TechTalk.SpecFlow.TestRunnerManager.GetTestRunner(Int32 threadId) in D:\a\1\s\TechTalk.SpecFlow\TestRunnerManager.cs:line 136
    at TechTalk.SpecFlow.TestRunnerManager.OnTestRunStart(Assembly testAssembly, IContainerBuilder containerBuilder) in D:\a\1\s\TechTalk.SpecFlow\TestRunnerManager.cs:line 232
    at experimental_MyUntappd_Specs_SpecFlowPlusRunnerAssemblyHooks.AssemblyInitialize() in /home/vsts/work/1/s/experimental.MyUntappd.Specs/obj/Debug/net5.0/SpecFlow.Plus.Runner.AssemblyHooks.cs:line 12
    at TechTalk.SpecRun.Framework.TaskExecutors.StaticOrInstanceMethodExecutor.ExecuteInternal(ITestThreadExecutionContext testThreadExecutionContext)
    at TechTalk.SpecRun.Framework.TaskExecutors.StaticOrInstanceMethodExecutor.Execute(ITestThreadExecutionContext testThreadExecutionContext)
    at TechTalk.SpecRun.Framework.TestAssemblyExecutor.RunAssemblyInitializeExecutors(ITestAssemblyExecutorsProvider testAssemblyExecutorsProvider, ITestThreadExecutionContext testThreadExecutionContext)
    at TechTalk.SpecRun.Framework.TestAssemblyExecutor.RunTests(ITestAssemblyExecutorState executorState, ITestAssemblyExecutorsProvider testAssemblyExecutorsProvider, ITestThreadExecutionContext testThreadExecutionContext)
    at TechTalk.SpecRun.Framework.TestAssemblyExecutor.RunTests(TestThreadState testThreadState)
    at TechTalk.SpecRun.Framework.Execution.InProcess.InProcAppDomainTestAssemblyExecutor.RunTests(TestThreadState testThreadState)
    at TechTalk.SpecRun.Framework.Execution.OutOfProcess.OutOfProcessTestAssemblyExecutor.RunTests(TestThreadState testThreadState)
    System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.AspNetCore.Mvc.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.

    File name: 'Microsoft.AspNetCore.Mvc.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'
    System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.AspNetCore.Mvc.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.

    File name: 'Microsoft.AspNetCore.Mvc.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'
    2021-02-09T16:23:52.7786047+00:00:2021-02-09T16:23:52.7370190+00:00:OutOfProcessTestAssemblyExecutorReceiver - Error at RunTests - System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types.
    Could not load file or assembly 'Microsoft.AspNetCore.Mvc.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.

    Could not load file or assembly 'Microsoft.AspNetCore.Mvc.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.

    at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
    at System.Reflection.RuntimeModule.GetTypes()
    at System.Reflection.Assembly.GetTypes()
    at TechTalk.SpecFlow.Bindings.Discovery.RuntimeBindingRegistryBuilder.BuildBindingsFromAssembly(Assembly assembly) in D:\a\1\s\TechTalk.SpecFlow\Bindings\Discovery\RuntimeBindingRegistryBuilder.cs:line 23
    at TechTalk.SpecFlow.TestRunnerManager.BuildBindingRegistry(IEnumerable`1 bindingAssemblies) in D:\a\1\s\TechTalk.SpecFlow\TestRunnerManager.cs:line 94
    at TechTalk.SpecFlow.TestRunnerManager.InitializeBindingRegistry(ITestRunner testRunner) in D:\a\1\s\TechTalk.SpecFlow\TestRunnerManager.cs:line 73
    at TechTalk.SpecFlow.TestRunnerManager.CreateTestRunner(Int32 threadId) in D:\a\1\s\TechTalk.SpecFlow\TestRunnerManager.cs:line 62
    at TechTalk.SpecFlow.TestRunnerManager.GetTestRunnerWithoutExceptionHandling(Int32 threadId) in D:\a\1\s\TechTalk.SpecFlow\TestRunnerManager.cs:line 155
    at TechTalk.SpecFlow.TestRunnerManager.GetTestRunner(Int32 threadId) in D:\a\1\s\TechTalk.SpecFlow\TestRunnerManager.cs:line 136
    at TechTalk.SpecFlow.TestRunnerManager.OnTestRunStart(Assembly testAssembly, IContainerBuilder containerBuilder) in D:\a\1\s\TechTalk.SpecFlow\TestRunnerManager.cs:line 232
    at experimental_MyUntappd_Specs_SpecFlowPlusRunnerAssemblyHooks.AssemblyInitialize() in /home/vsts/work/1/s/experimental.MyUntappd.Specs/obj/Debug/net5.0/SpecFlow.Plus.Runner.AssemblyHooks.cs:line 12
    at TechTalk.SpecRun.Framework.TaskExecutors.StaticOrInstanceMethodExecutor.ExecuteInternal(ITestThreadExecutionContext testThreadExecutionContext)
    at TechTalk.SpecRun.Framework.TaskExecutors.StaticOrInstanceMethodExecutor.Execute(ITestThreadExecutionContext testThreadExecutionContext)
    at TechTalk.SpecRun.Framework.TestAssemblyExecutor.RunAssemblyInitializeExecutors(ITestAssemblyExecutorsProvider testAssemblyExecutorsProvider, ITestThreadExecutionContext testThreadExecutionContext)
    at TechTalk.SpecRun.Framework.TestAssemblyExecutor.RunTests(ITestAssemblyExecutorState executorState, ITestAssemblyExecutorsProvider testAssemblyExecutorsProvider, ITestThreadExecutionContext testThreadExecutionContext)
    at TechTalk.SpecRun.Framework.TestAssemblyExecutor.RunTests(TestThreadState testThreadState)
    at TechTalk.SpecRun.Framework.Execution.InProcess.InProcAppDomainTestAssemblyExecutor.RunTests(TestThreadState testThreadState)
    at TechTalk.SpecRun.Framework.Execution.OutOfProcess.OutOfProcessTestAssemblyExecutor.RunTests(TestThreadState testThreadState)
    at TechTalk.SpecRun.Framework.Execution.OutOfProcess.OutOfProcessTestAssemblyExecutorReceiver.RunTests(TestThreadState testThreadState)
    System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.AspNetCore.Mvc.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.

    File name: 'Microsoft.AspNetCore.Mvc.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'
    System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.AspNetCore.Mvc.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.

    File name: 'Microsoft.AspNetCore.Mvc.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'
    2021-02-09T16:23:52.8024448+00:00:test thread #0 error: StreamJsonRpc.RemoteInvocationException: Unable to load one or more of the requested types.
    Could not load file or assembly 'Microsoft.AspNetCore.Mvc.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.

    Could not load file or assembly 'Microsoft.AspNetCore.Mvc.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.

    at StreamJsonRpc.JsonRpc.InvokeCoreAsync[TResult](Nullable`1 id, String targetName, IReadOnlyList`1 arguments, CancellationToken cancellationToken, Boolean isParameterObject)
    at TechTalk.SpecFlow.Plus.RPC.TcpRpcClient.Invoke[T](String methodName, Object[] parameters)
    at TechTalk.SpecFlow.Plus.RPC.AsyncHelper.RunSync[TResult](Func`1 func)
    at TechTalk.SpecRun.Framework.Execution.OutOfProc.StreamJsonRPC.OutOfProcessTestAssemblyExecutorClient.RunTests(TestThreadState testThreadState)
    at TechTalk.SpecRun.Framework.Execution.OutOfProc.StreamJsonRPC.RemoteExecutor.RunTests(TestThreadState testThreadState)
    at TechTalk.SpecRun.Framework.Execution.OutOfProc.StreamJsonRPC.OutOfProcessTestAssemblyExecutorHost.RunTests(TestThreadState testThreadState)
    at TechTalk.SpecRun.Framework.TestThread.RunNonEmptyTestSuite(CancellationToken cancellationToken, TestThreadState testThreadState)
    at TechTalk.SpecRun.Framework.TestThread.Run(ITestExecutionManager executionManagerForRun, CancellationToken cancellationToken)
    at TechTalk.SpecRun.Framework.AsyncTestThreadRunner.RunSync(TestExecutionManager executionManager, CancellationToken cancellationToken)
    2021-02-09T16:23:52.8034361+00:00:test thread error: TechTalk.SpecRun.Framework.SpecRunException: At least one test thread aborted.
    ---> StreamJsonRpc.RemoteInvocationException: Unable to load one or more of the requested types.
    Could not load file or assembly 'Microsoft.AspNetCore.Mvc.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.

    Could not load file or assembly 'Microsoft.AspNetCore.Mvc.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.

    at StreamJsonRpc.JsonRpc.InvokeCoreAsync[TResult](Nullable`1 id, String targetName, IReadOnlyList`1 arguments, CancellationToken cancellationToken, Boolean isParameterObject)
    at TechTalk.SpecFlow.Plus.RPC.TcpRpcClient.Invoke[T](String methodName, Object[] parameters)
    at TechTalk.SpecFlow.Plus.RPC.AsyncHelper.RunSync[TResult](Func`1 func)
    at TechTalk.SpecRun.Framework.Execution.OutOfProc.StreamJsonRPC.OutOfProcessTestAssemblyExecutorClient.RunTests(TestThreadState testThreadState)
    at TechTalk.SpecRun.Framework.Execution.OutOfProc.StreamJsonRPC.RemoteExecutor.RunTests(TestThreadState testThreadState)
    at TechTalk.SpecRun.Framework.Execution.OutOfProc.StreamJsonRPC.OutOfProcessTestAssemblyExecutorHost.RunTests(TestThreadState testThreadState)
    at TechTalk.SpecRun.Framework.TestThread.RunNonEmptyTestSuite(CancellationToken cancellationToken, TestThreadState testThreadState)
    at TechTalk.SpecRun.Framework.TestThread.Run(ITestExecutionManager executionManagerForRun, CancellationToken cancellationToken)
    at TechTalk.SpecRun.Framework.AsyncTestThreadRunner.RunSync(TestExecutionManager executionManager, CancellationToken cancellationToken)
    --- End of inner exception stack trace ---
    2021-02-09T16:23:52.8095073+00:00:Thread#-1: Test #4/0 is started on thread #-1
    2021-02-09T16:23:52.8107770+00:00:Thread#-1: Test #4/0 is finished on thread #-1 as Skipped within 0.0005746 seconds

     
    0
  • Andreas Willich

    Yeah, that is an assembly loading issue in the SpecFlow+ Runner. :-/

    As a workaround, you could switch from `Process` test thread isolation to `SharedAppDomain` (https://docs.specflow.org/projects/specflow-runner/en/latest/Profile/Environment.html#testthreadisolation). 

    Depending on your automation code, you can do this or not.

    More information about the different test thread isolation modes can be found here: https://docs.specflow.org/projects/specflow-runner/en/latest/Usage/Parallel-Execution-Features.html

     

    What would us help to fix this issue, is that you create a small repro project and open a support ticket.

    0
  • Westhoff, Daniel

    Thanks for the quick response. I will have a look on the links and try to use the info to setup a workaround.

    One thing I noticed in the first log I posted was this line:

    2021-02-09T16:23:52.9392682Z Starting external program: "mono" "/home/vsts/work/1/s/experimental.MyUntappd.Specs/bin/Debug/net5.0/SpecFlowPlusRunner/net461/SpecFlow.Plus.Runner.Reporting.exe" "/tmp/tmpmeQZ3w.tmp" in /home/vsts/work/1/s/experimental.MyUntappd.Specs/bin/Debug/net5.0

    I do not get this line at all when I run 'dotnet test' on my development PC. Is it possible that there is something wrong with the frameworks that are used during the Azure pipeline run?   

    0
  • Andreas Willich

    No, that is fine. The report generation happens in a separate process, which is still implemented only in .NET Framework. If you are on a Linux agent, we are using mono to execute this process.

    0
  • Westhoff, Daniel

    The hint about Linux made my clone my project on a macOS machine. On the Mac I could reproduce the problem seen on Azure DevOps when running tests executing 'dotnet test' on the command line.

    I then created a simple default.srprofile file in the Specs project of my solution: 

    <?xml version="1.0" encoding="utf-8"?>
    <TestProfile xmlns="http://www.specflow.org/schemas/plus/TestProfile/1.5">
    <Settings projectName="experimental.MyUntappd"/>
    <Execution retryFor="None" stopAfterFailures="0"/>
    <Environment testThreadIsolation="SharedAppDomain"/>
    </TestProfile>

    After that the acceptance tests were execute during 'dotnet test' on the Mac.

    Unfortunately, they are still skipped on Azure DevOps. It looks like the .srprofile file is not taken into account because e.g. the project name is not used in the report file names. There, the reports still start with 'Unnamed project_...'.

    In the documentation I saw that the .srprofile file is sometimes written as 'Default.srprofile' and sometimes 'default.srprofile'. I used lowercase. Might this be a case-sensitivity issue on Linux images? 

    0
  • Westhoff, Daniel

    Ok, it was an issue with case-sensitivity. The filename needs to be Default.srprofile.

    On macOS the default is that the file system is case-insensitive. Thus, it works with default as well as Default as filename.

    On Azure DevOps using a linux image for the pipline run the filesystem is case-sensitive.

    Therefore, my solution is to add a minimal profile file 'Default.srprofile' to the Specs project of my solution:

    <?xml version="1.0" encoding="utf-8"?>
    <TestProfile xmlns="http://www.specflow.org/schemas/plus/TestProfile/1.5">
    <Settings projectName="<my_project_name>"/>
    <Environment testThreadIsolation="SharedAppDomain"/>
    </TestProfile>
    0
  • Ali Mollahosseini

    Hi Daniel,

    Apologies if the documentation was misleading here. I have now updated it so it correctly states Default.srprofile, to avoid issues on Linux machines.

    Cheers

    0
  • Miguel Acosta

    Andreas Willich, after switching to

    <Environment testThreadIsolation="SharedAppDomain"/>

    test execution in azure pipelines doesn't output an html report

    Scenario: Test Modifiers page Values Are Saved, IL in Quote_Modifiers -> Succeeded on thread #*** 
    Passed Test Modifiers page Values Are Saved, IL [*** s]


    ##[error]The active test run was aborted. Reason: Test host process crashed : [16243***816***.197][WARNING]: This version of ChromeDriver has not been tested with Chrome version 91.

    ##[error][16243***8163.***73][WARNING]: This version of ChromeDriver has not been tested with Chrome version 91.

    ##[error]Stack overflow.

    Results File: D:\a\_temp\TestResults\VssAdministrator_fv-az***9-3***3_***21-***6-21_***_42_59.trx

    ##[error]Test Run Aborted.

    Total tests: Unknown

    Passed: 62

    Failed: 2

    Skipped: 3

    Total time: 34.***412 Minutes

    Vstest.console.exe exited with code 1.
    0

Please sign in to leave a comment.

Powered by Zendesk