Cross platform Xamarin PCL project unit testing - unit-testing

I want to do unit testing my pcl xamarin project for ios,android and windows(not important).How can i do it with proper way.(i heard about Nunit or Xunit)
Project were created with visual studio and xamarin.

NUnit 3 has support for testing Xamarin PCL projects. It is an involved process and StackOverflow questions should be much more targeted, not general how-to's, that is why you are getting down voted.
To get you started, read Testing Xamarin Projects using NUnit 3.

Related

UWP Unit Tests Don't Show Up in Rider

I have a solution with two unit testing projects. One is for .NET and the other is for UWP. The .NET Framework and .NET Core tests show up in Rider but the UWP tests don't show up. They show up in Visual Studio. You can see the project here. It appears that dotCover is supposed to support UWP. I assume that Rider uses the same engine. Also, I opened dotCover and found my app unit testing app among the packages but it doesn't pick up any of the tests either. I'm using MS Test but can switch if need be.
This is what I see in dotCover:
Does Rider support UWP for unit testing? If not, can I do this with dotCover? What am I doing wrong?
Right now, even ReSharper does not support discovering UWP tests in Visual Studio 2019 due to a lack of API. That's why it does not work in Rider as well.
However, we've implemented our own test runner to run UWP tests https://youtrack.jetbrains.com/issue/RSRP-473827, and it will be available in upcoming releases in both ReSharper and Rider.

Unit testing for modern PCL, compatible with .NET Core

I use Class Library (Portable) project template in Visual Studio to produce modern PCL, compatible with .NET Core. Unfortunately, I unable to run unit tests for PCL with neither NUnit nor XUnit:
First of all, I can't create Class Library (Package) or Console Application (Package) for unit testing project. VS 2015 currently does not allow to reference modern PCL from these types of project: https://github.com/aspnet/Home/issues/1099
Therefore, I should use Class Library (Portable) project for unit testing project.
That's why I can not follow articles http://www.alteridem.net/2015/11/04/testing-net-core-using-nunit-3/ (for NUnit) and https://xunit.github.io/docs/getting-started-dnx.html (for xUnit). Both articles use Class Library (Package) and Console Application (Package) projects.
I can't install 'xunit' package to Class Library (Portable) project. It fails with that error: https://github.com/xunit/xunit/issues/587
I can successfully build Class Library (Portable) project with NUnit 3. But currently there are no test runner that can run NUnit 3 tests for .NET Core. Not sure if latest version of Resharper supports that - in any case Resharper is not an option for me.
It looks that I need to wait either for bug fixes in modern PCL support or for .NET Core-compatible NUnit 3 test runner. Could you recommend any workaround?
The NUnit team and I have released full .NET Core support, including running tests within Visual Studio's Test Explorer. See NUnit 3 Tests for .NET Core RC2 and ASP.NET Core RC2 for more info.

Tutorial for Visual Studio Unit Testing Framework?

I would like start to learn Visual Studio Unit Testing Framework on VS 2012 Express for Web.
Mainly for ASP.NET MVC project.
I already buy the hard copy of Art of unit test from amazon.
But it is lack of tutorial aims for VS unit testing framework.
So any resource i can have?
Another question, when i research on this forum,
I found someone said MSTEST is different from VS unit test framework.
Is the VS 2010 Express built-in unit test is subset of VSTS?
Thanks you.
For all practical purposes mstest is the unit testing framework in Visual Studio 2010. It continues to be the primary unit testing framework in 2012 as well. However now we support extensibility and many 3rd party frameworks like xunit/nunit/gtest etc have adapters for our platform.
For ASP.NET the best place to start is to download the MVC3/MVC4 solutions from Microsoft which contain a rich suite of unit tests with them.

Switching from MSTest to another unit test framework in VS 2010

Visual Studio 2010 offers a lot of comfortable tools for unit testing via its built in test runner. Unfortunately we can't use MSTest for our unmanaged c++ codebase. Is it possible to switch from MSTest to e.g. Google.Test and have it integrated with the built in Visual Studio test runner?
Thanks in advance!
I have not seen anyway to integrate another unit testing framework into the VS test runner.
You might look at some VS add-in test runners, testdriven.net and gallio are two.
Kindness,
Dan
It's possible to use gtest (google test) in VS2010 and have it integrated with the IDE thanks to the extension: GoogleTestAddin
You can be interested by this similar thread: Viewing Google Test results within Visual Studio

VSTS Unit test - build system

I have developed a build system on MSBuild (NET 3.0) and cc.net to perform continuous integration builds of a Visual Studio 2008 application, however a developer on the team recently added a VSTS unit test project to the mix. Is there any SDK or add-in provided by microsoft to allow this to be compiled on a non-team system build environment?
You can run the tests from the command-line, but it requires that the Test Edition of Visual Studio be installed on your build server:
http://devlicio.us/blogs/derik_whittaker/archive/2008/09/25/clean-build-server-with-mstest-fail.aspx
http://aspadvice.com/blogs/ssmith/archive/2008/03/18/Continuous-Integration-Setup-with-MSTest.aspx
This person is doing MSTest with CC.NET, so it might be helpful:
http://testearly.findtechblogs.com/default.asp?item=630602
In general, this is a main reason why many people choose something like NUnit, xUnit.NET or MbUnit over MSTest.
If you use MSTEST You will have to put that edition on the build server. To cut a long story short youd be better off changing the testing framework the developer is using from MStest to Nunit.
Its a much lighter solution.