Saturday, April 16, 2011

Testcoverage in general and with GWT MVP

I have always been criticized about my view on minimal test coverage of code.

I always advocated that any test coverage below 100% may lead to the following:
Only the easy to cover parts of the software get tested. The hard parts will be left out. (I already have a sufficient part tested, why spend more time?). The really tricky edge cases will be left out sometimes entirely.

To make myself clear: I am not taking about 100% input coverage. Every line of code that will run in production should behave as expected (or intended by the developer). To make sure you should run through this code at least one time to state your intention. This will not in any way prove that your product doesn't have any bugs. It will just reduce the number of bugs.

Sometimes I heard the argument that this is fine for backend code where it's easy to mock out dependencies, but does not translate to UI programming. That's just not true: if you take a look at GWT MVP you get a very good idea how to isolate your presentation logic from the UI fields and you can test most of your code in a simple JUnit Test Case.

Me personally I like EMMA a lot. It's an open-source toolkit for measuring and reporting Java code coverage, which has a nice integration in eclipse and maven as well. Basically in eclipse it marks a line in your code green, yellow or red. Red meaning that this part of the code was never executed during your tests. Green meaning this part of the code was executed. Yellow meaning that only part of your code was executed. It also sums up test coverage for packages.

Using EMMA you can quickly discover the dirty spots in your project and improve their test coverage. I even trigger built failures if the test coverage drops from a previous built, so that you can only check in tested code.

But if you think about a normal GWT MVP project you will end up with a few untested places like your Entrypoint with all the initialization, and those view implementations. It's not possible to test them in simple JUnit Test and so it's not possible to test them very quickly at all. Quick feedback to your commits is very important, so what can we do about those. First we exclude them from EMMA so that we only measure the testable code. Second thing is that most of the code is simple UI plumbing stuff. So we can get a decent coverage (which is sufficient) in our UI Test with selenium for instance.


  1. Ordering my medication was simple and once a really short watch for approval deutschemedz, it was announced to American state and that I received it among several days. Proud of the full factor, Thank you

  2. Verzekeraar zorg
    verzekeraar is volgens Mevrouw Merkel voegde eraan toe dat de ​schoenenbank video-publisher YouTube een 95% toename had gezien in de vraag naar nieuws uit "gezaghebbende" bronnen.

    Vorige week kondigde Facebook aan dat gebruikers die valse Covid-19- informatie hadden gelezen. afweersysteem laag had of gedeeld, een pop-up waarschuwing zouden ontvangen waarin ze werden aangespoord de website van de WHO te bezoeken. Vanaf een bartafel met krukken of vanaf een keuken trolley .

    borstkanker is nog steeds de grootste boosdoener, volgens ​nico mul ​van orthokennis.


  3. Bestel 3-MMC

    U kunt bij ons 3-MMC bestellen met een zuiverheid van 98%. In onze webshop is het geen probleem om Research Chemicals te kopen. Het product is alleen bedoeld voor onderzoeksdoeleinden en wordt niet verkocht voor consumptiedoeleinden. Door 3-MMC te kopen, gaat u automatisch akkoord met onze algemene voorwaarden waarin staat dat u het product alleen koopt voor onderzoeksdoeleinden en dat het product niet wordt gebruikt voor consumptiedoeleinden. Het is daarom alleen bedoeld om te onderzoeken of de analyse-ontleding overeenkomt met die van 4-MMC. We kunnen hier geen uitspraak over doen, maar de stof van 3-MMC is gevoeliger voor de neus, dus let tijdens het onderzoek op, draag bijvoorbeeld een masker dat ook over je neus te plaatsen is;).

    U kunt bij ons 3mmc kopen 3-MMC is verkrijgbaar in poeder-, vloeistof-, capsule- en pelletvorm. Wij zorgen ervoor dat u uw onderzoek perfect kunt uitvoeren want onze 3-Methylmethcathinone is van de hoogste kwaliteit! Wanneer we nieuwe producten ontvangen, laten we dit eerst testen door ons lab voordat ze in de webshop terecht komen.

  4. The mixing principle patented by m-tec can optionally be ordered for the Estrichpumpen. The water is not sprayed onto the material as usual, but the material is sprinkled into a water bath and mixed

  5. Real money cellular casinos provide bonus money to new players and have other ongoing promos for loyal clients. They all have a good status 1xbet and an extensive assortment of games. Spin the reels on-the-go half in} cellular slots for actual money. Enjoy different themes and progressive jackpots from your phone or pill system. You don’t find actual money on line casino apps end result of|as a result of} all apps online don’t provide actual money prizes or money winnings {due to|because of|as a result of} Apple & Google insurance policies.