My experiences while choosing test frame work for automation lead to have below comparison chart.
If we need test code to be portable between NUnit and the Visual Studio test systems, giving us the best of both worlds, here is an interesting reference - https://msdn.microsoft.com/en-us/magazine/cc163643.aspx#S4.
Conclusion cannot be done by giving best framework title to either, as the choice of implementation depends on your requirement.
MSTest | NUnit |
---|---|
Has fairly good APIs, but not as many provided by Nunit (Refer here ) | NUnit has a richer assert API compared to MS Test |
MSTest has a provision to execute your test cases parallel way if test is not dependent on other test (Please refer here for details) | Parallel execution is not supported |
Slow in exeuction, because it creates folder for test run every time | Faster compared to MS Test |
MSTest took the file based approach with DataSource to provide test data, which is nice but you will always have to need to add csv, excel or xml data file. It doesn't support parametrized testing | NUnit does not have a build in support for filebased datasources. It provides ability to write parametrized test cases |
Visual studio will give you Code Coverage in MSTest | For code coverage, we have to use external tools like DotCover / Ncover |
MSTest has no x64 support. Tests always run as x86 | NUnit can run tests in x86 and x64 |
It has ability to determine the order of tests (ordered tests) | No ability to determine the order of tests. The order does not follow the lexical order of the attributes and will often vary between different compilers or different versions of the CLR |
"AssemblyInitialize, AssemblyCleanup are two special attributes that can be used to bootstrap or teardown your test assembly. Execution flow is TestClass with ClassInitialize –> TestInitialize –> TestMethod –> TestCleanup –> ClassCleanup" | "Execution flow is TestFixture with TestFixtureSetup –> Setup –> Test –> TearDown –> TestFixtureTearDown" |
MS Test is shipped with Visual studio | This is an opensource, Can be integrated with Visual Studio (as plugin), and any other 3rd party tools |
Updates only with newer version of Visual studio | lots of updates, as it is an opensource |
It provides test agent to run the tests without need to have VS dev studio | It has an independent test runner |
If we need test code to be portable between NUnit and the Visual Studio test systems, giving us the best of both worlds, here is an interesting reference - https://msdn.microsoft.com/en-us/magazine/cc163643.aspx#S4.
Conclusion cannot be done by giving best framework title to either, as the choice of implementation depends on your requirement.
No comments:
Post a Comment