Skip to content

Commit

Permalink
deploy: 86da932
Browse files Browse the repository at this point in the history
  • Loading branch information
redcatbear committed Jun 29, 2024
1 parent 0e07695 commit a449e86
Show file tree
Hide file tree
Showing 17 changed files with 118 additions and 73 deletions.
4 changes: 3 additions & 1 deletion 2017/01/24/test-coverage-pitfalls/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@
<a href=https://github.com/itsallcode/openfasttrace title>OpenFastTrace</a>
<a href=https://github.com/itsallcode/white-rabbit title>White Rabbit</a>
<a href=http://blog.itsallcode.org/tags/ title>Tags</a></nav></header><main id=main tabindex=-1><article class="post h-entry"><div class=post-header><header><h1 class="p-name post-title">Test Coverage Pitfalls</h1></header><div class="post-info noselect"><div class="post-date dt-published"><time datetime=2017-01-24>2017-01-24</time></div><a class="post-hidden-url u-url" href=/2017/01/24/test-coverage-pitfalls/>/2017/01/24/test-coverage-pitfalls/</a>
<a href=http://blog.itsallcode.org/ class="p-name p-author post-hidden-author h-card" rel=me>Sebastian</a><div class=post-taxonomies></div></div></div><script>var toc=document.querySelector(".toc");toc&&toc.addEventListener("click",function(){event.target.tagName!=="A"&&(event.preventDefault(),this.open?(this.open=!1,this.classList.remove("expanded")):(this.open=!0,this.classList.add("expanded")))})</script><div class="content e-content"><p>When did I test enough?</p><p>While code coverage is a good indicator, you still have to know how code coverage works. Today I was hunting a bug in a Markdown importer I wrote for OpenFastTrace. The class where the bug sits had a whooping 93.1% code coverage and part of that missing coverage was owed to the fact that the JaCoCo coverage tracer can’t mark code that throws exceptions as covered – even though there is a test case for it.</p><p>So I wrote a new issue ticket, created a fix branch and wrote a three line test case that reproduced the problem. While the test now failed as expected, the code coverage didn’t go up.</p><p>I used the <a href=http://mockito.org/>Mockito</a> mocking framework to verify that an interaction with a mocked observer happened or in my case due to the bug didn’t.</p><p>The error was hiding in a regular expression which read</p><p>&ldquo;Needs:\s*(\w+(?:,\s*\w+)+)&rdquo;</p><p>instead of</p><p>&ldquo;Needs:\s*(\w+(?:,\s*\w+)*)&rdquo;</p><p>Notice the asterisk in the end.</p><p>So while there are a lot test cases waiting to be written for this regular expression, code coverage won’t tell you.</p><p>You get what you measure, so be sure you understand what it is you are measuring.</p></div></article><div class="pagination post-pagination"><div class="left pagination-item"><a href=/2017/05/07/intrusive-sharing/>Intrusive Sharing</a></div><div class="right pagination-item disabled"></div></div></main><footer class="common-footer noselect"><div class=common-footer-bottom><div style=display:flex;align-items:center;gap:8px>© 2024</div><div style=display:flex;align-items:center></div><div>Powered by <a target=_blank rel="noopener noreferrer" href=https://gohugo.io/>Hugo</a>, theme <a target=_blank rel="noopener noreferrer" href=https://github.com/Junyi-99/hugo-theme-anubis2>Anubis2</a>.<br></div></div><p class="h-card vcard"><a href=http://blog.itsallcode.org/ class="p-name u-url url fn" rel=me></a></p></footer></div></body></html>
<a href=http://blog.itsallcode.org/ class="p-name p-author post-hidden-author h-card" rel=me>Sebastian</a><div class=post-taxonomies></div></div></div><script>var toc=document.querySelector(".toc");toc&&toc.addEventListener("click",function(){event.target.tagName!=="A"&&(event.preventDefault(),this.open?(this.open=!1,this.classList.remove("expanded")):(this.open=!0,this.classList.add("expanded")))})</script><div class="content e-content"><p>When did I test enough?</p><p>While code coverage is a good indicator, you still have to know how code coverage works. Today I was hunting a bug in a Markdown importer I wrote for OpenFastTrace. The class where the bug sits had a whooping 93.1% code coverage and part of that missing coverage was owed to the fact that the JaCoCo coverage tracer can’t mark code that throws exceptions as covered – even though there is a test case for it.</p><p>So I wrote a new issue ticket, created a fix branch and wrote a three line test case that reproduced the problem. While the test now failed as expected, the code coverage didn’t go up.</p><p>I used the <a href=http://mockito.org/>Mockito</a> mocking framework to verify that an interaction with a mocked observer happened or in my case due to the bug didn’t.</p><p>The error was hiding in a regular expression which read</p><pre><code>&quot;Needs:\\s*(\\w+(?:,\\s*\\w+)+)&quot;
</code></pre><p>instead of</p><pre><code>&quot;Needs:\\s*(\\w+(?:,\\s*\\w+)*)&quot;
</code></pre><p>Notice the asterisk in the end.</p><p>So while there are a lot test cases waiting to be written for this regular expression, code coverage won’t tell you.</p><p>You get what you measure, so be sure you understand what it is you are measuring.</p></div></article><div class="pagination post-pagination"><div class="left pagination-item"><a href=/2017/05/07/intrusive-sharing/>Intrusive Sharing</a></div><div class="right pagination-item disabled"></div></div></main><footer class="common-footer noselect"><div class=common-footer-bottom><div style=display:flex;align-items:center;gap:8px>© 2024</div><div style=display:flex;align-items:center></div><div>Powered by <a target=_blank rel="noopener noreferrer" href=https://gohugo.io/>Hugo</a>, theme <a target=_blank rel="noopener noreferrer" href=https://github.com/Junyi-99/hugo-theme-anubis2>Anubis2</a>.<br></div></div><p class="h-card vcard"><a href=http://blog.itsallcode.org/ class="p-name u-url url fn" rel=me></a></p></footer></div></body></html>
6 changes: 4 additions & 2 deletions 2017/index.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@
&lt;p>So I wrote a new issue ticket, created a fix branch and wrote a three line test case that reproduced the problem. While the test now failed as expected, the code coverage didn’t go up.&lt;/p>
&lt;p>I used the &lt;a href="http://mockito.org/">Mockito&lt;/a> mocking framework to verify that an interaction with a mocked observer happened or in my case due to the bug didn’t.&lt;/p>
&lt;p>The error was hiding in a regular expression which read&lt;/p>
&lt;p>&amp;ldquo;Needs:\s*(\w+(?:,\s*\w+)+)&amp;rdquo;&lt;/p>
&lt;pre>&lt;code>&amp;quot;Needs:\\s*(\\w+(?:,\\s*\\w+)+)&amp;quot;
&lt;/code>&lt;/pre>
&lt;p>instead of&lt;/p>
&lt;p>&amp;ldquo;Needs:\s*(\w+(?:,\s*\w+)*)&amp;rdquo;&lt;/p>
&lt;pre>&lt;code>&amp;quot;Needs:\\s*(\\w+(?:,\\s*\\w+)*)&amp;quot;
&lt;/code>&lt;/pre>
&lt;p>Notice the asterisk in the end.&lt;/p>
&lt;p>So while there are a lot test cases waiting to be written for this regular expression, code coverage won’t tell you.&lt;/p>
&lt;p>You get what you measure, so be sure you understand what it is you are measuring.&lt;/p></description></item></channel></rss>
2 changes: 1 addition & 1 deletion 2018/10/13/openfasttrace-2-0-0-released/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
<a href=https://github.com/itsallcode/openfasttrace title>OpenFastTrace</a>
<a href=https://github.com/itsallcode/white-rabbit title>White Rabbit</a>
<a href=http://blog.itsallcode.org/tags/ title>Tags</a></nav></header><main id=main tabindex=-1><article class="post h-entry"><div class=post-header><header><h1 class="p-name post-title">OpenFastTrace 2.0.0 Released</h1></header><div class="post-info noselect"><div class="post-date dt-published"><time datetime=2018-10-13>2018-10-13</time></div><a class="post-hidden-url u-url" href=/2018/10/13/openfasttrace-2-0-0-released/>/2018/10/13/openfasttrace-2-0-0-released/</a>
<a href=http://blog.itsallcode.org/ class="p-name p-author post-hidden-author h-card" rel=me>Sebastian</a><div class=post-taxonomies></div></div></div><script>var toc=document.querySelector(".toc");toc&&toc.addEventListener("click",function(){event.target.tagName!=="A"&&(event.preventDefault(),this.open?(this.open=!1,this.classList.remove("expanded")):(this.open=!0,this.classList.add("expanded")))})</script><div class="content e-content"><p>This release is a big step forward. One new feature, a few small fixes and a lot of code improvements that gives us a much cleaner and more uniform API, better test coverage and lower overall complexity.</p><p>But a new API also means we had to break backward compatibility to achieve something that the existing API would not allow since it had a separation of report and export mode: you can now reuse an import that already ran to create both reports and exports from it without redoing the import. This is a considerable speed-up (and we call the project Open<strong>Fast</strong>Trace for a reason. Runtime efficiency was and will always be one of our main design principles.</p><p>You can find examples of <a href=https://github.com/itsallcode/openfasttrace/blob/master/doc/user_guide.md#oft-api>how to use the API in the user guide</a> and in OFTs own code of course.</p><p>Thanks to Christoph for his patience during his review of the giant change set that the API rework caused!</p><p>Enjoy the new and improved API.</p><p>Happy tracing.</p></div></article><div class="pagination post-pagination"><div class="left pagination-item"><a href=/2018/10/30/on-refactoring-an-hidden-technical-dept/>On Refactoring an Hidden Technical Dept</a></div><div class="right pagination-item"><a href=/2018/08/13/openfasttrace-grade-plugin-0-4-0-released/>OpenFastTrace Gradle plugin 0.4.0 released</a></div></div></main><footer class="common-footer noselect"><div class=common-footer-bottom><div style=display:flex;align-items:center;gap:8px>© 2024</div><div style=display:flex;align-items:center></div><div>Powered by <a target=_blank rel="noopener noreferrer" href=https://gohugo.io/>Hugo</a>, theme <a target=_blank rel="noopener noreferrer" href=https://github.com/Junyi-99/hugo-theme-anubis2>Anubis2</a>.<br></div></div><p class="h-card vcard"><a href=http://blog.itsallcode.org/ class="p-name u-url url fn" rel=me></a></p></footer></div></body></html>
<a href=http://blog.itsallcode.org/ class="p-name p-author post-hidden-author h-card" rel=me>Sebastian</a><div class=post-taxonomies></div></div></div><script>var toc=document.querySelector(".toc");toc&&toc.addEventListener("click",function(){event.target.tagName!=="A"&&(event.preventDefault(),this.open?(this.open=!1,this.classList.remove("expanded")):(this.open=!0,this.classList.add("expanded")))})</script><div class="content e-content"><p>This release is a big step forward. One new feature, a few small fixes and a lot of code improvements that gives us a much cleaner and more uniform API, better test coverage and lower overall complexity.</p><p>But a new API also means we had to break backward compatibility to achieve something that the existing API would not allow since it had a separation of report and export mode: you can now reuse an import that already ran to create both reports and exports from it without redoing the import. This is a considerable speed-up (and we call the project Open<strong>Fast</strong>Trace for a reason). Runtime efficiency was and will always be one of our main design principles.</p><p>You can find examples of <a href=https://github.com/itsallcode/openfasttrace/blob/master/doc/user_guide.md#oft-api>how to use the API in the user guide</a> and in OFTs own code of course.</p><p>Thanks to Christoph for his patience during his review of the giant change set that the API rework caused!</p><p>Enjoy the new and improved API.</p><p>Happy tracing.</p></div></article><div class="pagination post-pagination"><div class="left pagination-item"><a href=/2018/10/30/on-refactoring-an-hidden-technical-dept/>On Refactoring an Hidden Technical Dept</a></div><div class="right pagination-item"><a href=/2018/08/13/openfasttrace-grade-plugin-0-4-0-released/>OpenFastTrace Gradle plugin 0.4.0 released</a></div></div></main><footer class="common-footer noselect"><div class=common-footer-bottom><div style=display:flex;align-items:center;gap:8px>© 2024</div><div style=display:flex;align-items:center></div><div>Powered by <a target=_blank rel="noopener noreferrer" href=https://gohugo.io/>Hugo</a>, theme <a target=_blank rel="noopener noreferrer" href=https://github.com/Junyi-99/hugo-theme-anubis2>Anubis2</a>.<br></div></div><p class="h-card vcard"><a href=http://blog.itsallcode.org/ class="p-name u-url url fn" rel=me></a></p></footer></div></body></html>
Loading

0 comments on commit a449e86

Please sign in to comment.