Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: add description of how to generate coverage reports

...

Excerpt

To be the robust and reliable information system that health care systems demand, we need to be overly vigilant about testing the OpenMRS code. This section contains all testing information including unit tests, continuous integration testing, release testing, and user testing.


Developers: Please Contribute

...

Tests

We are always looking for people that want to add to our unit test testing arsenal.

To find out where you can help have a look at Getting Started as a Developer.

If you are new to OpenMRS please read Getting Started as a Developer first to get your accounts and development environment set up before writing any code.

You can look through the existing issues that have a status of READY FOR WORK and filter for title containing "test" or a label like "test", "testing" as shown here

Jira
serverOpenMRS Issues
columnskey,summary,type,created,updated,due,assignee,reporter,priority,status,resolution
maximumIssues20
jqlQueryproject = TRUNK AND status = "Ready for Work" AND labels in (test, testing, tests, test-fails) AND text ~ "test" ORDER BY updated DESC, priority DESC
serverId45c5771b-fa4b-3e43-b34a-c19dc45ccc95

If you cannot find an issue related to testing, don't worry, there is a lot to do (smile)

In that case either go to coveralls.io/github/openmrs/openmrs-core and look for classes that have either no test at all (0% coverage) or classes that have low coverage (coverage percentages are a topic of debate, how much is enough, but I would say below 80% isnt good).

Code Block
mvn clean package
mvn jacoco:report

The coverage reports are now in

  • openmrs-core/api/target/site/jacoco/index.html
  • openmrs-core/web/target/site/jacoco/index.html

How To Write Unit Tests

...

We have a Bamboo server set up to run our unit tests after every commit to key branches. On our GitHub repository of OpenMRS core we also use Travis CI which runs your changes to the code and tests on every pull request anyone makes. We also generate test coverage and use coveralls.io to check pull requests to make sure the changes anyone adds are well tested. These checks also run on module repositories within the OpenMRS GitHub organization but it might be that not every module makes use of all the checks.

...