background preloader

Unit Testing

Facebook Twitter

SonarQube. Code Coverage Tools (JaCoCo, Cobertura, Emma) Comparison in Sonar « Only Software matters. For those that are not familiar with Sonar, ( I hope this post will make you at least try it or see it in action at ) you can take a look at an earlier post I’ve written some time ago.

Code Coverage Tools (JaCoCo, Cobertura, Emma) Comparison in Sonar « Only Software matters

In one sentence Sonar is an open source platform that allows you to track and improve the quality of your source code. One of the key aspects when talking about software quality is the test coverage or code coverage which is how much of your source code is tested by Unit tests. Sonar integrates with the most popular open source code coverage tools ( JaCoCo, Cobetura, Emma ) and the well-known commercial Clover by Attlassian.

By default it uses the JaCoCo (Java Code Coverage) engine and you’ll shortly find out why :) Before we move on, I’d like to give many kudos to Evgeny Mandrikov. Now let’s go to the meat. The results of the analysis are displayed next. Now take a look at a graph that illustrates in a more readable way which tool is the fastest. Patroklos PAPAPETROU Like this: Like Loading... Computers: Programming: Software Testing: Products and Tools. Code coverage. Code coverage was among the first methods invented for systematic software testing.

Code coverage

The first published reference was by Miller and Maloney in Communications of the ACM in 1963.[1] Coverage criteria[edit] To measure what percentage of code has been exercised by a test suite, one or more coverage criteria are used. Coverage criteria is usually defined as a rule or requirement, which test suite needs to satisfy.[2] Basic coverage criteria[edit] There are a number of coverage criteria, the main ones being:[3] For example, consider the following C++ function: int foo (int x, int y){ int z = 0; if ((x>0) && (y>0)) { z = x; } return z;} Assume this function is a part of some bigger program and this program was run with some test suite. Condition coverage does not necessarily imply branch coverage. Condition coverage can be satisfied by two tests: a=true, b=falsea=false, b=true However, this set of tests does not satisfy decision coverage since neither case will meet the if condition. In practice[edit] JUnit 4 Vs TestNG – Comparison.

JUnit 4 and TestNG are both very popular unit test framework in Java.

JUnit 4 Vs TestNG – Comparison

Both frameworks look very similar in functionality. Which one is better? Which unit test framework should I use in Java project? Here I did a feature comparison between JUnit 4 and TestNG. 1. The annotation supports are implemented in both JUnit 4 and TestNG look similar. The main annotation differences between JUnit4 and TestNG are 1. 2. 3 additional setUp/tearDown level: suite and group (@Before/AfterSuite, @Before/AfterTest, @Before/AfterGroup). JUnit 4 @BeforeClass public static void oneTimeSetUp() { System.out.println("@BeforeClass - oneTimeSetUp"); } TestNG @BeforeClass public void oneTimeSetUp() { System.out.println("@BeforeClass - oneTimeSetUp");} In JUnit 4, the annotation naming convention is a bit confusing, e.g “Before”, “After” and “Expected”, we do not really understand what is “Before” and “After” do, and what we “Expected” from test method?

List of unit testing frameworks. This page is a list of tables of code-driven unit testing frameworks for various programming languages.

List of unit testing frameworks

Some but not all of these are based on xUnit. Columns (Classification)[edit] Name: This column contains the name of the framework and will usually link to it.xUnit: This column indicates whether a framework should be considered of xUnit type.TAP: This column indicates whether a framework can emit TAP output for TAP-compliant testing harnesses.Generators: Indicates whether a framework supports data generators. Data generators generate input data for a test and the test is run for each input data that the generator produces.Fixtures: Indicates whether a framework supports test-local fixtures.

Test-local fixtures ensure a specified environment for a single test.Group fixtures: Indicates whether a framework supports group fixtures. Languages[edit] ABAP[edit] ActionScript / Adobe Flex[edit]