ipjohnson / SeleniumFixture

Selenium testing fixture for C#
Microsoft Public License
14 stars 6 forks source link

ASP.NET DNX Support #4

Closed CL0SeY closed 8 years ago

CL0SeY commented 8 years ago

I've been trying to use this package with a DNX 4.51 based project (clr, not coreclr), and the tests I am creating are not being picked up by the test runner.

I've had to create a .NET 4.5 DLL so I can run tests inside Docker. Would be great to have compatibility for this.

ipjohnson commented 8 years ago

Hi CL0SeY,

Could you zip up a small sample project and send it along I've not played with dnx very much. This sounds like a similar problem I've run into before where the runner was a different version than the one referenced by the test library.

Sorry for the inconvenience -Ian

CL0SeY commented 8 years ago

Hey thanks for getting back to me. I've attached an example project SeleniumFixtureDnxExample.zip

Run it like so:

dnvm install latest
dnu restore
dnx test

The regular XUnit tests run but not the ones from SeleniumFixture.

xUnit.net DNX Runner (32-bit DNX 4.5.1)
  Discovering: SeleniumFixtureDnxExample
  Discovered:  SeleniumFixtureDnxExample
  Starting:    SeleniumFixtureDnxExample
  Finished:    SeleniumFixtureDnxExample
=== TEST EXECUTION SUMMARY ===
   SeleniumFixtureDnxExample  Total: 2, Errors: 0, Failed: 0, Skipped: 0, Time: 0.122s

(There should be three tests executed.)

ipjohnson commented 8 years ago

Ok looking at it quickly the tests aren't being discovered because SeleniumFixture.xUnit depends on an assembly called

xunit.execution.desktop, Version=2.1.0.3179

I'll do some more research and try and figure out if there is anything I can do to change it as I do depend on XunitTheoryTestCase which is in the desktop dll

CL0SeY commented 8 years ago

Looks like it's available in xunit.execution.dotnet as well:

Assembly xunit.execution.dotnet, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c \packages\xunit.extensibility.execution\2.1.0\lib\dnx451\xunit.execution.dotnet.dll

namespace Xunit.Sdk / class XunitTheoryTestCase

ipjohnson commented 8 years ago

I think I understand what's going on.

xunit.execution.desktop is the assembly that you get when it's a .net 4.5 project xunit.execution.dotnet is the assembly that you get when it's a dnx451 nuget target.

essentially it's that part of xUnit that is platform specific.

After looking at it a bit I think what I can probably do is just implement the required interfaces and drop the dependency on the execution libraries.

I'll see about replacing the code on sunday and I'll let you know how it goes.

ipjohnson commented 8 years ago

I've made the required code changes but I'm thinking of releasing the dnx library as a different pre-release package called SeleniumFixture.xUnit.dnx (it's much easier to release as a second package)

Does that work for you?

CL0SeY commented 8 years ago

Sounds good, great work! On 16 May 2016 6:42 AM, "Ian Johnson" notifications@github.com wrote:

I've made the required code changes but I'm thinking of releasing the dnx library as a different pre-release package called SeleniumFixture.xUnit.dnx (it's much easier to release as a second package)

Does that work for you?

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/ipjohnson/SeleniumFixture/issues/4#issuecomment-219309329

ipjohnson commented 8 years ago

Ok I've pushed out a new version 1.4.0 as well as a new package called SeleniumFixture.xUnit.dnx 1.0.0-rc1

Let me know how it works out for you.

CL0SeY commented 8 years ago

Tops, it is working fine, many thanks for doing that.

One thing I've noticed is missing is the fixture.TakeScreenshot method. Is it hiding somewhere else or is it being deprecated?

All this though... just in time for DNX to become deprecated with .NET Core 1.0 RC2! I will give it a go with the new "dotnet cli" and other bits sometime soon to see how it goes. Actual .NET Core compatibility would be great one day but I understand that would be a bit of an undertaking.

None of this is a show-stopper for my project at the moment.

Thanks for your help. I'm actually starting to use the SimpleFixture project in other parts of my solution now. :+1:

ipjohnson commented 8 years ago

Oh sorry should have mentioned this previously, I had a little trouble getting the NuGet package to come out right, long story short it's referencing the 1.0.0 version of SeleniumFixture. Try updating to the latest versions and it should be there.

Hopefully it works with no changes for dotnet cli but we will see. The big problem with .Net core compatibility is Selenium being a .Net library. If/When selenium goes .Net core I'll switch this over to be a portable class library as there isn't anything outside of selenium reference that would be a problem.

Glad you're liking SimpleFixture, it was definitely a lot of fun to write.

ipjohnson commented 8 years ago

Hi CL0Sey,

Im going to close this issue as completed, if something doesn't work for you feel free to open a new issue.

Thanks -Ian