Skip to content

This is a Java project serving as a brief demonstration for Unit Testing and Continuous Integration services

License

Notifications You must be signed in to change notification settings

AntonisGkortzis/UnitTestingDemoProject

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unit Testing demonstration project

Build Status codecov Coverage Status License: MIT

Overview

This is a Java project serving as a brief demonstration for Unit Testing for the needs of the lab tutorials of the Software Engineering in Practice course.

Requirements

This project requires:

Build project

In order to build the project execute the following Maven command:

mvn clean install

This command will also generate a report of the code coverage produced by JaCoCo. The report will be located in the following path:

target/site/jacoco

Test project

To simply run the unit tests of the project, execute the following Maven command:

mvn test

Important: Note that only classes with a Test suffix located in the src/test will be executed and reported as Tests.

Continuous Integration

This projects utilizes TravisCI services in other to test and build the application upon each git-push in the remote repository. There are multiple build environments in which the application will be tested and build. You can check these options under the jdk tag in the .travis.yml file.

After each build, the badge is updated with the corresponding build status, green for passes and red for failures.

Here is a TravisCI quick guide. It's free for public repositories!

Code coverage

The repository is connected to two different code coverage analysis tools, CodeCov and Coveralls. Both code coverage services provide badges with the coverage percentages.

CodeCov

Code coverage reports provided by CodeCov is available on the repository page in the CodeCov website. The analysis is executed after each successfully TravisCI build.

The command for triggering the code coverage analysis should be placed in the .travis.yml as illustrated below

after_success:
  - bash <(curl -s https://codecov.io/bash)

Here is a short example for using CodeCov with TravisCI in a Java project.

Coveralls

Coveralls is a stand alone code coverage analysis tool. However, it can be used as an analyser for the JaCoCo report produced during the package Maven command. In this repository we utilize Coveralls with its later functionality.

For parsing the JaCoCo output and creating a code coverage report, the jacoco:report coveralls:report arguments should be added in the Maven command in the .travis.yml file.

mvn clean package jacoco:report coveralls:report

Also, the Coveralls plug-in along with the repository Token (produced automatically by the Coveralls website) should be added in the pom.xml file like the following:

<plugin>
    <groupId>org.eluder.coveralls</groupId>
    <artifactId>coveralls-maven-plugin</artifactId>
    <version>4.3.0</version>
    <configuration>
        <repoToken>yourRepositotyToken</repoToken>
    </configuration>
</plugin>

Contributing

You are more than welcome to contribute in this project. Just have in mind that the repository aims at providing an overview of unit testing functionality and Continuous Integration plug-ins related to testing.

  • If you have any suggestions please open an issue.
  • If you want to actively contribute, please fork this repository and create a pull request after completing your addition/modification.

License

License: MIT

About

This is a Java project serving as a brief demonstration for Unit Testing and Continuous Integration services

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published