Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Something similar to NUnit TestCaseSource in Visual Studio unit testing

Is there anything similar to NUnit TestCaseSource attribute in Visual Studio unit testing? The closest solution I found was to use a DataSource. But I don't want to store my test case parameters in a data source.

like image 281
Anish Avatar asked Oct 29 '10 16:10

Anish


People also ask

What is the best unit test framework for C#?

Tests Isolation Among the top 3, xUnit is considered the best unit testing framework for C# simply because it has fewer attributes and makes the code clean and easy to maintain, it is also extensible just like NUnit.

Which one is better NUnit or xUnit?

MSTest is concerned, the biggest difference between xUnit and the other two test frameworks (NUnit and MSTest) is that xUnit is much more extensible when compared to NUnit and MSTest.

What are the frameworks used in .net unit testing?

NUnit. NUnit is a unit-testing framework for all . NET languages. Initially, NUnit was ported from JUnit, and the current production release has been rewritten with many new features and support for a wide range of .

What is difference between NUnit and Unittest?

Yes, there are differences. NUnit is an older, more established unit testing framework designed to do exactly one thing - unit testing. MSTest is newer so it does not have the same level of maturity in its API. For example, NUnit offers more Assert methods than MSTest.


1 Answers

Datasource is one option to take the test input. You can save your test data in many file format (xml, xls or in sql db)

But if you don't want to store your test data, then use TestInitialize() attribute in any method that will execute before any of your test cases. Save all your test data run time in xml,xls or in sql db through this method and then using datasource use it in your test cases.

Here is msdn link for VSTS unit test. Hope this will help you.

like image 174
Pritam Karmakar Avatar answered Oct 25 '22 13:10

Pritam Karmakar