1

I have a .NET Core v2.2 application. I am trying to start Selenium UI tests, built on top of unit testing project (tried using NUnit, xUnit).

The tests can be started locally from VS(using TestExplorer), or from started locally .NET Core 2.2 app.

The goal is to be able to start test, once the app is deployed in IIS, using button in a view.

I've tried both starting the test using reflection, and instantiating the class, or starting it as process (by running nunit3-console.exe, dotnet test or vstest.console.exe) in command line.

When using

dotnet test {PathToTestDll} --filter "Name ~{testName}" --logger trx --results-directory {resultDir}

command, I can start the test from cmd, but when trying to open the published site, I get error for missing dll

Could not load file or assembly 'Microsoft.VisualStudio.Coverage.CoreLib.Net, Version=16.9.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types.), which is part of VS Enterprise, I am currently using VS Professional 2019 Version 16.9.1.

If I try and use

nunit3-console.exe --test={testFullyQualifiedName} {PathToTestDll}

I get another error for missing nunit.framework package:

NUnit.Engine.NUnitEngineException : An exception occurred in the driver while loading tests.
System.IO.FileNotFoundException : Could not load file or assembly 'nunit.framework, Version=3.12.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb' or one of its dependencies. The system cannot find the file specified.
--NUnitEngineException
An exception occurred in the driver while loading tests.) regardless if I execute it in the dir, where the nunit.framework file is located (C:\Users{user}.nuget\packages\nunit{version}), or the published project's dir (somewhere in C:\inetpub\wwwroot{projectName}).

Now when using reflection, after the app is published, the test fail, with the same error (javascript error: Failed to execute 'elementsFromPoint' on 'Document': The provided double value is non-finite. (Session info: chrome=88.0.4324.190)), which is a Selenium error, for using not unique way to locate element, if I am not mistaken. For each test. I've checked them and can assure you, it is not the case.

By this time, I have accepted that I am doing something, or everything wrong, but cannot pin-point what.

I have to say, that I currently use NUnit3, chromedriver v88.0.4324.96, Selenium.WebDriver 3.141.0

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
kvadrat4o
  • 11
  • 1

0 Answers0