Roberto Ruiz
Posted on July 5, 2020
An advantage of the unit tests is given additional coverage to own code. First, let's find what we need.
Since my beginnings in .NET, it was very common for me to hear that, to run the tests and see the coverage of the code, it was necessary to have ReSharper and dotCover installed (both created by JetBrains). However, this requires a license that is paid, either on your own or through the organization you belong to.
The ReSharper license can also be obtained at a discount (and even free for other uses). You can learn more here.
Still, two things can happen:
- That for some reason (whether socio-economic or of any other nature) you cannot get the license.
- Your computer is not high performance, so using Visual Studio with ReSharper can be frustrating in terms of performance*.
You can optimize Visual Studio and the ReSharper itself, although its effectiveness depends on the equipment in question.
When and when not?
Although ReSharper provides a series of improvements regarding the stock features of Visual Studio (that depends on your own choice), if we limit it to tests and coverage, it will not always be necessary.
To run only unit tests
- With any variant of _ Visual Studio_ (Community, Professional or Enterprise), we already have a visualization environment of tests and review in case of errors.
By default it supports MSTest, although you can add support for NUnit or xUnit
To analyze code coverage
- If we have Visual Studio Enterprise (since 2015), we have a stock environment to view the coverage percentages.
- Otherwise, if it makes sense to have an alternative tool.
Alternatives for coverage
While there is the option of using ReSharper and dotCover, we just reviewed it because it was not always feasible. The good news is that there are alternatives, a very good and open source to be able to fulfill the purpose. We'll see in another article.
Conclusions
- We should take more advantage of the tools that Visual Studio provides by default.
- The open-source philosophy gives us very good alternatives when licenses are our main impediment.
The effort depends on the knowledge of a team regarding the tools.
Now that we know what tools to use, we have to see how we analyze the coverage itself. Although that will be for another article 😉.
(Versión en español en Medium)
Posted on July 5, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.