Wiki Spaces
Documentation
Projects
Resources
Get Help from Others
Q&A: Ask OpenMRS
Discussion: OpenMRS Talk
Real-Time: IRC Chat | Slack
The information on this page, as of Feb 2016, is outdated and links are incomplete. This page reflects work that may not have been maintained.
Some day we will have a full team to run various tests (integration, load testing, application compatibility, etc.). Until that day, the simple recipes below will guide a user to make sure that different parts of the application work properly before a release.
If you are looking for documentation on how to test a release candidate against your own database, see the Release Testing Helper Module page.
It is assumed that unit tests have been written against any new API code since the last release. All unit tests are run after every commit by our Continuous Integration server. You can see how well the tests are covering the api by looking at the unit test coverage output.
The "release-test" mavenmodule in trunk contains selenium-over-jbehave unit tests.
There is a continuous integration project that runs these tests weekly. TODO: create project and/or add link
See the currently defined stories in code.
Read about Selenium and JBehave. TODO: add appropriate links
If you would like to add a story to our suite, open a new ticket with the text of the story. It should look something like this:
GivenStories: org/openmrs/stories/go_to_admin_page.story Given I am on Admin page When I choose to manage encounter types And I choose to add a new encounter type And I mention name YOUTHINITIAL and description Outpatient Youth initial visit When I save the encounter type Then the new encounter type should be saved
This story goes into the release-test/src/main/resources/org/openmrs/stories folder.
JBehave looks for a java class with the same name as the .story class. So from our example above we would need a class named CreateEncounterType.java in the org.openmrs.stories package.
public class CreateEncounterType extends Story { @Override public List<Steps> includeSteps() { return asList(new LoginSteps(driver), new AdminSteps(), new CreateEncounterTypeSteps(driver)); } }
The LoginSteps and AdminSteps are required for the parts of the story covered in our required go_to_admin_page.story.
Our CreateEncounterTypeSteps code and annotations should match our story:
@Given("I am on Admin page") @When("I choose to manage encounter types") @When("I choose to add a new encounter type") @When("I mention name $name and description $description") @When("I save the encounter type") @Then("the new encounter type should be saved")
The text must match up exactly or the story will not be able to run.
See CreateEncounterTypeSteps.java for full code.
Tests are run from the main openmrs root directory. This is because maven must launch a jetty server using the webapp project code.
Since openmrs is running in memory, you need to increase the amount of memory given to maven:
export MAVEN_OPTS="-Xmx512m -Xms256m -XX:MaxPermSize=256m"
Execute this script at a command line with:
sh release_test/release-test.sh -b -v -wMyOpenmrsPassword -tGoToAdminPage
This runs the test in the background (-b) so no browser pops up (requires xvfb to be installed), gives verbose output (-v) uses "MyOpenmrsPassword" and "admin" as the credentials in openmrs, and only runs the GoToAdminPage story/steps.
This requires an openmrs database to be installed into a running mysql that can be found using the openmrs runtime properites.
If you want ALL tests run against an empty in-memory (requires that the initialization step be run, which takes 10 mins), use the -i flag.
mvn clean integration-test -DskipTests -P integration-test
or
mvn clean integration-test -DskipTests -P smoke
You must skip tests because jbehave runs these as classes, not as Junit tests.
"integration-test" means run ALL tests against an empty in-memory db (which means the intialization step must be run, which takes 10 mins).
"smoke" means run against a pre-defined mysql database that already contains openmrs code. A runtime properties file must point at that.
TODO: this list needs to be compared with the currently stories. Some of these might be completed already.
Its possible in
*Logic
These modules are used widely and could benefit from having stories written for them.