nunit / nunit.xamarin

NUnit test runners for Xamarin and mobile devices - No longer maintained
http://nunit.org
MIT License
50 stars 47 forks source link

Document framework version dependency of runner #74

Closed Nickolas- closed 7 years ago

Nickolas- commented 7 years ago

Hi , create a xamarin android demo project with Droid Runner and xamarin pcl project with NUnit tests Add NUnit package 3.0.1 to platform droid project android NUnit.Xamarin like in documentation. After completed deployment application on genymotion it give me execution failed with excpetion.

ERROR: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidCastException: Specified cast is not valid.
  at NUnit.Framework.Api.FrameworkController+LoadTestsAction..ctor (NUnit.Framework.Api.FrameworkController controller, System.Object handler) [0x00006] in <c2111f49a7934243ac63900f9c81fe39>:0 
  at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&)
  at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00002] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/corlib/System.Reflection/MonoMethod.cs:661 
   --- End of inner exception stack trace ---
  at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00013] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/corlib/System.Reflection/MonoMethod.cs:667 
  at System.Reflection.MonoCMethod.DoInvoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00089] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/corlib/System.Reflection/MonoMethod.cs:652 
  at System.Reflection.MonoCMethod.Invoke (System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/corlib/System.Reflection/MonoMethod.cs:680 
  at System.RuntimeType.CreateInstanceImpl (System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes, System.Threading.StackCrawlMark& stackMark) [0x00243] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/rttype.cs:5394 
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidCastException: Specified cast is not valid.
  at NUnit.Framework.Api.FrameworkController+LoadTestsAction..ctor (NUnit.Framework.Api.FrameworkController controller, System.Object handler) [0x00006] in <c2111f49a7934243ac63900f9c81fe39>:0 
  at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&)
  at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00002] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/corlib/System.Reflection/MonoMethod.cs:661 
   --- End of inner exception stack trace ---
  at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00013] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/corlib/System.Reflection/MonoMethod.cs:667 
  at System.Reflection.MonoCMethod.DoInvoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00089] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/corlib/System.Reflection/MonoMethod.cs:652 
  at System.Reflection.MonoCMethod.Invoke (System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/corlib/System.Reflection/MonoMethod.cs:680 
  at System.RuntimeType.CreateInstanceImpl (System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes, System.Threading.StackCrawlMark& stackMark) [0x00243] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/rttype.cs:5394

Xamarin Studio version Version 6.1.2 (build 44)

Xamarin.Android Version: 7.0.2.37 (Xamarin Business)

PCL Test project profile 111.

ChrisMaddock commented 7 years ago

@Nickolas- Can you upload a project which reproduces this?

I'm guessing something odd is going on with your references, you could try using the NUnit VS templates extension instead to create your droid runner project? That should make sure all the references are straight.

Your PCL test project, is that also referencing NUnit v3.0.1?

Nickolas- commented 7 years ago

Thank a lot @ChrisMaddock , you was damn right! Xamarin Droid project cant update from 3.0.1 to the latest 3.5.0 version , but PCL was on 3.5.0.

Unable to resolve dependencies. 'NUnit 3.5.0' is not compatible with 'nunit.xamarin 3.0.1 constraint: NUnit (= 3.0.1)'.

Maybe someone will step on the same mistakes.

rprouse commented 7 years ago

@Nickolas, as you have found, the Xamarin project is currently like NUnitLite in that it references a specific version of NUnit. We plan to change that in the near future, but are waiting on some of our .NET Core/Standard changes.

Nickolas- commented 7 years ago

@rprouse it was very good if you would write somewhere this information in documentation. Because it confused me at the morning.

ChrisMaddock commented 7 years ago

Yes, we should document this!

@rprouse - How do you feel about keeping version numbers in sync with the framework version, until we break the dependency? Fingers cross that will only be another couple of versions. Otherwise, I can imagine we'll need a table of nunit.xamarin -> framework versions, or else just direct people to look at the nuget package dependencies?

rprouse commented 7 years ago

@ChrisMaddock I agree about the version number. I've updated the milestone accordingly. I would like to get a release out soon that supports NUnit 3.5. I am going to do a pass through the open issues to see what needs to be included. Can you do the same?

ChrisMaddock commented 7 years ago

@rprouse - to my mind, the milestone as it was at lunchtime today is pretty up-to-date. :-) (Afraid I'm travelling, and can't see the milestone through my app!) The logo's a nicety, but the multiple assemblies thing I think would be good to fix before the next release. I've been planning to do it for a while, but that's looking unlikely before Christmas now - please go for it if you'll have time before!

Is 3.6 still planned for end-of-the-year/Jan? I was considering getting both this and vs-templates ready for then, so we could just update to 3.6 and then do a release. In the long-term, I think it would be good if we can keep both projects in sync with the latest framework. I've been working on a cake thing to semi-automate that.

rprouse commented 7 years ago

I guess early January, right after the 3.6 release might be a good time. Waiting a few weeks over the holidays seems reasonable. I had wanted to get this off the radar, but waiting makes more sense. I will switch the milestone to 3.6.

ChrisMaddock commented 7 years ago

I added a note to both getting started guides in the docs. Hopefully that will be enough - thanks for flagging the issue @Nickolas-. 😄

https://github.com/nunit/docs/wiki/Getting-Started-in-Visual-Studio https://github.com/nunit/docs/wiki/Getting-Started-in-Visual-Studio-for-Mac