Can we auto generate nunit test cases in Visual studio 2013

Sriram

New member
Joined
Sep 15, 2020
Messages
3
Programming Experience
1-3
I have to write nunit test cases for the huge application made of aspx.cs files tat too in Visual studio 2013 professional , can I auto generate the test cases if possible with this version or any other better ideas to write test cases, as it contains more number of dependencies & complexities
 
I recommend hunkering down and actually studying the system that you want to test, and come up with a plan.

I believe that there are tools there that can use reflection and static analysis to mechanically build a parallel set of boiler plate unit test classes. You'll still be stuck in the same position though, after it generates the unit test classes now you are stuck with filling in that boilerplate.

Personally, I think what will be generated will also be low value unit tests. Unit tests are supposed to exercise units of code that can be run independently of each other. In other words the model and the business logic. The *.aspx.cs code is supposed to contain view code. Unit testing view code is more of integration testing, not unit testing. So unless your developers goofed and mixed in their business logic and and model into the *.aspx.cs files, then you'll not be testing the thing that gives you the most bang for your buck.

On the other hand, if you are being paid by the unit test, then go ahead and target the *.aspx.cs files, and find a tool to automate creation of those boilerplate unit tests. It's going to be money for nothing, and your chicks for free...
 
In the back of my mind, I believe that VS2012 and up allowed you to right click on a project or class and select "Generate unit test", but I can't recall whether that was built into Professional or Enterprise or if it was a JetBrains ReSharper feature.
 
Back
Top Bottom