.NET Testing interview questions: - What is the difference between Unit testing, Assembly testing and Regression testing?
Unit testing is also termed as Component testing. Unit testing ensures that reliable program unit meets their requirements. Unit testing is normally conducted by programmer under the supervision of the project lead or the team Lead. Main objective of this testing is to test each unit in isolation and individually. This is done by knowing what the inputs to the unit are and what the expected outputs for the same. Unit testing is a white box activity. Unit test normally comes in the implementation phase of the project.
For instance in the below figure we are trying to do unit testing on the customer class. So we create the object of Customer class assign “CustomerCode” and “Age” property and check for the response. For instance, in this condition, we tried to pass a non-numeric value to the “Age” property and the class threw an error saying, “Age should be numeric”. So here the basic unit testing entity is your class.
However, unit testing is not limited to a component, object, or function. Therefore, definition of a unit testing will depend on the approach. Below are some examples of unit testing:-
- Checkpoints in UI like tab orders, error messages, look and feel etc.
- Class, object, component level testing as said previously.
In case of functional programming can be a simple method or function.
- Logic testing for algorithms. Some projects can have some critical algorithm for instance some kind of custom sorting, security implementation etc. Therefore, that logic can be tested independently.
However, the general thumb rule of what is Unit in Unit testing is that the module self-contained and by itself.
Assembly testing goes one-step ahead than unit testing. It demonstrates that can the modules interact in a correct, stable, and proper manner as defined by the functional specifications provided by the client. Assembly testing is Black box testing style and also called as Integration testing. For instance in the above unit test of the “Customer” class, testing was done in isolation. But in actually the “Customer” class is not going to be stand alone rather it will be used more in conjunction with the “Product” class and also will have UI to do the same. So in short, the “Customer” class will work with two more entity one is the “UI” and the other is the “Product” class. So normally, assembly testing is done through UI but not necessarily.
The above figure defines a simple scenario for integration testing. The same “Customer” class is now tested with the “UI” and “Product” to see if the interaction between them matches according to functional specifications.
Regression testing ensures that application function properly even if there are changes or enhancements to system. For instance you change the “Product” class still you will run all the test cases for “Product” , “Customer” and “UI” just to make sure that any changes in “Product” class does not affect interaction with other entities. So you will see when testers do a regression testing they run all the scripts to ensure that nothing has been affected.
Also click and see the following .NET Testing interview questions video on VSTS 2010 ordered testing: -