Automated unit testing is an essential component to a highly productive software development organization. It holds great value for developers developing demanding applications, as with increasing size of the projects manual testing takes hours or weeks to complete and is prone to errors. While most of the companies have been adopting automated testing, few companies are reluctant to adopt mainly due to the huge amount of development time involved in building the test cases, requirement of skilled resources, and increasing need for more sophisticated tools.
We have recently contributed a demo project to automatically prepare unit test cases. These test cases were developed for Web-API methods.
The two modules of the project are:
This module includes GET, POST, DELETE, and PUT methods. It uses dependency injection design pattern and implements a three-tier architecture init. Using this module, developers can learn how to implement Web-API in their application.
- Test cases
To demonstrate Unit Testing of each and every method created in Web-API, we have created Unit Test Case project using Mocking Library (Moq.Dll).
How to Set-up/Run the Module?
To successfully set-up/run this module, follow the following basic instructions:
- Run “*.sql” script and change web.config/app.config accordingly
2. Run Web-API methods using “WebApiCalls.saz” runnable using fiddler tool or using any other tool. Pass the token— lW_LActKsl9_VSB1LbDYPg—in the request header.
3. You can use Visual Studio 2013 to run this module and configure it according to your needs by doing some modifications.
Note: The unit test cases are independent of any architecture and can be configured in any project.