Cannot run test suite on M1 machine

83 views Asked by At

I have a test automation project, written in C#, which uses Appium and NUnit, as frameworks of choice. Project also uses BrowserStack for cloud testing. We recently moved from legacy integration of BrowserStack to using their SDK. I am also using Mac M1, as we are testing native iOS and Android apps. Using VS Code.

After we migrated from legacy integration of BrowserStack to the SDK one, I cannot run our tests anymore. This is the error I am getting:

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
Failed to load extensions from file '/Users/darko/Developer/project_app_tests/IOS/bin/Debug/net6.0/ZZStack.TestAdapter.dll'. Please use /diag for more information.
Setup failed for test fixture IOS.Tests.DownloadTest
System.TypeInitializationException : The type initializer for '<Module>' threw an exception.
  ----> HarmonyLib.HarmonyException : Patching exception in method System.Void OpenQA.Selenium.Remote.HttpCommandExecutor::.ctor(System.Uri addressOfRemoteServer, System.TimeSpan timeout, System.Boolean enableKeepAlive)
  ----> System.NotImplementedException : The method or operation is not implemented.
StackTrace:    at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.ConstructorInfo.Invoke(Object[] parameters)
   at NUnit.Framework.Internal.Reflect.Construct(Type type, Object[] arguments)
   at NUnit.Framework.Internal.TypeWrapper.Construct(Object[] args)
   at NUnit.Framework.Internal.Commands.ConstructFixtureCommand.<.ctor>b__0_0(TestExecutionContext context)
   at NUnit.Framework.Internal.Commands.BeforeTestCommand.Execute(TestExecutionContext context)
   at NUnit.Framework.Internal.Execution.CompositeWorkItem.PerformOneTimeSetUp()
--HarmonyException
   at HarmonyLib.PatchClassProcessor.ReportException(Exception exception, MethodBase original)
   at HarmonyLib.PatchClassProcessor.Patch()
   at HarmonyLib.Harmony.<PatchAll>b__10_0(Type type)
   at HarmonyLib.CollectionExtensions.Do[T](IEnumerable`1 sequence, Action`1 action)
   at HarmonyLib.Harmony.PatchAll(Assembly assembly)
   at BrowserstackPatcher.DoPatching() in /Users/darko/Developer/project_app_tests/IOS/obj/Debug/net6.0/BrowserStackPatch.cs:line 114
   at Initializer.Run() in /Users/darko/Developer/project_app_tests/IOS/obj/Debug/net6.0/BrowserStackPatch.cs:line 91
   at .cctor()
--NotImplementedException
   at HarmonyLib.PatchFunctions.UpdateWrapper(MethodBase original, PatchInfo patchInfo)
   at HarmonyLib.PatchClassProcessor.ProcessPatchJob(Job job)

We did a lot of troubleshooting, and it all led to some kind of a mismatch between .NET versions.

  • We tried installing different .NET versions - 6, 7 and 8
  • Removing all .NET versions from the machine and setting up the environment again (cannot confirm if I properly deleted all .NET files)
  • I have also read through BrowserStack documentation, where it states that I need to install .NET version for Arm64, which I did, but the same error persist
  • In the documentation above it states that I need to create a x64 alias and then run dotnet64 test command, which does not work for me. Could be that I'm not setting the alias properly
  • We tried running the same project on a machine with Intel chip, and it works without any issues
0

There are 0 answers