Microsoft Unit Test Project Won't Run in C# Application


How to Set Up Microsoft UnitTest in Visual Studio 2019 to Test Asp.Net Core Application

Sometimes when setting up a Unit Test Application to depend on an application you want to Unit Test (Automated Testing) becomes hard to configure. Below are things to consider when setting up a Unit Test Application:

1. Make sure that the Unit Test application depends on the Main application you want to test. You do this by including the reference to the main application by finding a "Reference" tab or section in your Unit Test application and then choose the Application you want to depend on.

- Here are a few things to know about the dependencies on the main application you want to test.

This could be tricky and could result in an error. Basically, when you include the dependency of the main application into your Unit Test application, all the output files generated into a debug folder will be accessed by the Unit Test application.

Sometimes, this does not work, a scenario where your Unit Test application needs to have access to the configuration file in the main application and unfortunately, the Unit Test application could not find the configuration file resulting in an error.

Solution: Find out what the error is, then pick it up from there.

- Another problem is about versioning: Sometimes, the Unit Test version is different from the application version. For Example, when the main application uses dot net 4.6.0 and the Unit Test uses dot net 4.5, the framework differs.

- Another problem is where you don't have the Unit Test Library pulled from Nuget Package Manager. The Unit Test and the Unit Test Framework both has to be downloaded into the Unit Test Project for the Test Functions to work. The absence of the Unity Test Framework would not result in an error but your tests won't run and you might spend days trying to figure out what could be going wrong.

- Make sure that the unit test project has the connection string that the main application has and related configuration files to successfully test the project.


Technology
published
v.0.01





For peering opportunity Autonomouse System Number: AS401345 Custom Software Development at ErnesTech Email Address[email protected]