Closed KyleKofoed closed 6 years ago
Hi @KyleKofoed,
it should support testing non-forms projects. The runner only uses forms to display its own UI.
Normally, the logic that you'd be testing would be in a referenced library, not in the main application.
So you'd have
Devices.xUnit project (with or without tests in them) Test library (referenced by devices.xunit and added to the test assemblies list) ios/android Library with stuff used by the tests
Thank you for your response @onovotny!
What you have described is essentially what I did. And after some pain-points which were not xUnit runner related but Xamarin related. After some refactoring to make my algorithm more testable. I was able to test iOS/Android specific geolocation search algorithm logic on each platform of Xamarin!
I could potentially list some of the pain points here if it will be of some use, unless you have a better forum for that.
I was also curious if it would be wise to take this a bit further. For example, I could create activity’s and fragments (Android specific) in the background and actually perform some basic UI-less automated UI unit tests. (Sounds kind of strange when I read that out loud haha)
Do you know anyone who has tried this or is this something that is not recommended for the tool provided. Does automate UI tests live outside the realm of Unit testing? I think that could enable some pretty powerful testing if it’s plausible.
Glad you were able to make it work! Always happy to hear about pain points and your workarounds -- or a blog post about them :)
For Automated UI testing, I would suggest taking a look at Xamarin's CodedUI test tools because those can be easily run with Test Cloud. Not sure xUnit is the right fit for that.
Alright, I'll try to get a list together soon!
As far as CodedUI tests are concerned it looks like it uses nUnit. Does that mean I should move my tests from xUnit to nUnit? Perhaps that is a loaded question, However, I don’t think it would make sense to have two different testing paradigms in the same project.
I do have a preference for xUnit but going back and forth may be troublesome. Any thoughts on that?
Thank you so much for you input!
Hey there, @onovotny,
I was wondering if using this nuget package to test Xamarin Native projects (not forms). I was curious if anyone has done this yet. Or if everyone is pretty much using Xamarin Forms with xUnit. I've had some struggles with getting the build to behave consistently. I think a big part of my issue is that I'm referencing the original native projects to my test projects. Is this the correct way of going about it?
I have several follow up questions if I'm on the right track. But if I'm going about his wrong, I'd like to know before going further down the wrong path.
Thank you for your time, Kyle