Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Elm unit testing and Code Coverage [closed]

Tags:

elm

Is there a way to calculate code coverage for unit tests for Elm language?

I understand that Elm is compiled into JavaScript and I do can read it for "hello world" type of examples, but code coverage measured for generated JS code is not what I want to see - I want to see code coverage for the original source code lines.

like image 939
itur Avatar asked Oct 19 '15 00:10

itur


People also ask

Is code coverage should happen after unit testing?

Code coverage is calculated for a file based on the unit tests that SUCCESSFULLY passed. After all the unit tests are run you are able to see either in your browser the exact lines in your code that are being executed or right in your terminal.

Is code coverage same as unit testing?

Unit tests help to ensure functionality and provide a means of verification for refactoring efforts. Code coverage is a measurement of the amount of code that is run by unit tests - either lines, branches, or methods.

How do you test code coverage in unit testing?

To calculate the code coverage percentage, simply use the following formula: Code Coverage Percentage = (Number of lines of code executed by a testing algorithm/Total number of lines of code in a system component) * 100.

How do I open code coverage results?

Code coverage option is available under the Test menu when you run test methods using Test Explorer. The results table shows the percentage of the code executed in each assembly, class, and procedure. The source editor highlights the tested code.


2 Answers

Currently code coverage of Elm source code is not supported. I'm pretty sure that code coverage is one of those non-trivial things that you can't just hack in there quickly.

So I think the best course of action is starting a discussion on the mailing list. The idea will get more attention there, and perhaps someone will be interested in taking it up as a project.

like image 76
Apanatshka Avatar answered Oct 28 '22 04:10

Apanatshka


There is a tool that does code coverage for Elm code. It's at https://github.com/zwilias/elm-coverage.

like image 1
Luke Woodward Avatar answered Oct 28 '22 04:10

Luke Woodward