5

Now, here the confusion starts. I was creating some test cases using Selenium WebDriver with C# and thought of using a testing framework.

My task is to create functional test cases which can later be used for Regression testing of the application; only for the +ve flows, like if a new build come, I will execute that test suite and will see major functionalities like 'creating a user with valid values' is working or not?. So, this is the main purpose of automated test cases to capture +ve flows which can be re-run N number of times.

I started using NUnit + Selenium WebDriver for the same and created few test cases for my first presentation/demo. In the meantime, I contacted a developer who told me he is creating his unit test cases in NUnit. So, I went back to NUnit site whose very first line states that

What Is NUnit?

NUnit is a unit-testing framework for all .Net languages.

Then, I got this blog link over some web search and it confused me totally, as may be asked some questions in presentation. I know it may depend upon how we use this framework but still have queries to clear.

Questions:

  1. Is NUnit only a Unit testing framework? If Yes, then it means I am creating unit test cases which a developer is already doing. So, my work is not adding any value.
  2. Can NUnit be used for Functional/Regression testing? If Yes, then
    • How it can be used? and
    • Why NUnit says it is a unit testing framework?

I may be asked these questions, so need to prepare for the same.

3 Answers 3

2

Is NUnit only a Unit testing framework?

NUint is a .Net port (commonly used with Visual Studio) of JUnit (which is commonly used with Eclipse). So it's different than the standard 'unit tests' in a VS project. Generally those unit test are testing each function of the application. xUnit tests do test through the UI level. I think your hangup is on the term 'unit test', which simply means testing a single function.

Can NUnit be used for Functional/Regression testing?

You can chain xUnit tests to do a full UI regression without using Microsoft Test Manager or Visual Studio Pro. NUnit runs tests in alphabetical order so I got into the habit of using a number convention so it's easier to slip in new tests, like '010 - Login' then '020 - Update Profile'.

3
  • yes, I got confused with the terminology and definition provided by NUnit ;-). Does your answer mean that NUnit can be used for Regression testing but I need to take care of the alphabetical order, Right?
    – Dhiman
    Oct 29, 2015 at 19:56
  • The alphabetical order thing might have changed (it's been a couple years since I last used it). My blog has an example setup and a link to the project on GitHub if that helps, timothycope.com/setup-selenium-nunit-visual-studio In that you can see the naming convention of TestName##
    – kirbycope
    Oct 29, 2015 at 20:09
  • I think it's unhelpful to rely on the order that tests run in. Each test is supposed to be independent. The results and run time options from the testing frame work won't make sense if they aren't. It would be easy to combine 010 and 020 into a single test that calls a login method and then calls an updateProfile method.
    – bdsl
    Jun 1, 2017 at 8:40
5

Yes, you can use NUnit for functional testing. But still it is a unit-testing framework. No, you are not creating unit-tests by using a unit-testing framework to write functional tests. A unit-test is testing just a single methods input and output, by writing end-2-end tests it by definition cannot be a unit-test. :)

Unit testing frameworks are often combined with other testing frameworks like Selenium or Specflow to write functional tests. NUnit is in that case used as test-runner and assert framework. I think using the same tooling base for all your tests simplifies installation and knowledge needed to build and run tests.

NUnit is designed for unit-testing, that you can combine it with other software is nice, but not the development teams focus. Thus they call it a unit-testing framework.

0

We're using NUnit as test runner for Specflow for our functional and regression tests.

2
  • This is more a comment than a real answer. Oct 30, 2015 at 9:05
  • You're right, should have added it as a comment. Oct 30, 2015 at 12:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.