mercredi 27 janvier 2016

How can I unit test code coverage?

My team is creating an ASP.NET MVC application. We're using scaffolding to help us in creating our entities. The scaffolder will create the Model, the Repository, the Controller and some other classes that we have. It also scaffolds a basic test suite for the entity. All of the scaffolded code is currently being tested.

What I would like, is to have a unit test that fails if the code coverage for a certain class is below a certain value. For example, the Controller and the Repository need coverage as close to 100% as possible. These classes will also be developed further, and I want a check in place to make sure that the code that is added to them is being tested.

I'm using Xunit and Moq for my testing and mocking respectively.

How can I implement a test for code coverage?

Aucun commentaire:

Enregistrer un commentaire