Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Basic Unit Test vs. Unit Test

I am working on an MVC project and was wondering whether to use Basic Unit Test or Unit Test, I read articles / explanations about both but can't see much difference between the two. What are the main differences and which one is preferable for a large scale app with DB backend?

like image 468
03Usr Avatar asked Jun 30 '12 08:06

03Usr


People also ask

What is basic unit testing?

A typical unit test contains 3 phases: First, it initializes a small piece of an application it wants to test (also known as the system under test, or SUT), then it applies some stimulus to the system under test (usually by calling a method on it), and finally, it observes the resulting behavior.

What are the two types of unit testing?

There are 2 types of Unit Testing: Manual, and Automated.

Is JUnit and unit testing same?

JUnit is a unit testing open-source framework for the Java programming language. Java Developers use this framework to write and execute automated tests. In Java, there are test cases that have to be re-executed every time a new code is added.

What is the difference between unit testing?

Unit Testing is a kind of white box testing, whereas Integration Testing is a kind of black-box testing. For Unit Testing, accessibility of code is required, as it tests the written code, while for Integration Testing, access to code is not required, since it tests the interactions and interfaces between modules.


1 Answers

The difference between Visual Studio's Basic Unit Test item template and Unit Test item template is that the latter includes support for ClassInitialize, ClassCleanup, TestInitialize and TestCleanup routines allowing you to execute some code before/after the test fixture and some code before/after each unit test. If you don't need such functionality in your unit test you could go wit the basic template which generates the following file:

[TestClass]
public class UnitTest2
{
    [TestMethod]
    public void TestMethod1()
    {
    }
}

Of course you could always add the corresponding routines to a basic unit test if you want to support later this functionality.

like image 197
Darin Dimitrov Avatar answered Oct 20 '22 17:10

Darin Dimitrov