NUnit basics for new bees

In smaller to bigger project, here are some basics about how to automate Unit testing with NUnit framework on .Net Platform.

Where NUnit spot on SDLC?
In other words, we can ask when to start unit automation on project? It depends on various parameters say for example Complexity of Method(s) / API(s) or Classes in production cycle - How Method(s) API(s) / Classes are called by other Method(s) / API(s) / Classes in production cycle.


We can start NUnit automation after completion of any independent Method / API / its Class created at production and making automation continued towards parallel of development cycle of more dependent Method(s) / API(s) / Classe(s).

Say for example we have small class library project in C#.









Now lets start NUnit Automation in 7 simple steps :

  1. Create New Test C# Project (Here Named TestProject) and add production class (.dll) reference.
  2. Add reference NUnit.Frameworkto the TestProject.
  3. Add attribute "TestFixture" to mark as Test Class and so NUnit GUI can recognize.
  4. To create Test Category / Test-Cases group, add attribute “Category” passing with CategoryName as a param say for here [Category(“TestCategory1”)].
  5. Add attribute “Test”to the test-cases which will teardown inside test-class.
  6. To implement test-case , create Object of the AUT Class and call Assert with its various methods as required.
  7. Save the project and Open this on NUnit GUI and last run the test.

Njoy, Nimesh - (Get more NUnit stuff on http://www.nunit.org )

Comments

Post a Comment

Popular posts from this blog

Testing Shifts with agile automation #RPA #ML

Bots and What Not !!

Need > Want

Automate your everyday tedious tasks and free up time for higher-value work (with Microsoft free RPA solution)

Respect is not earned, It is given ⚘ 🙏

Popular posts from this blog

Typical Project flow with QA Loop in Jira (Atlassian)

Increase ROI in your organization with Automation Testing

Tip to create workflow in JIRA quickly

Headless Automation Testing

QuickTest Pro and Traceability Matrix

AFT (Automation Framework Team) should not take developers' false catches

Testing Priciples & Vocabulary

QA Project Checklist

How to automate test-scenarios which have Java Objects built on JMesa , JQuery, JSON and AJAX technology.