Have you implemented OpenMRS? Please participate in the Implementation Site Survey. If you already have, thank you!
Venue: Breakaway 1
A unit test is one small unit of work. Functional tests to test a range of actions.
2 use cases when tests
Takes 2 mins to run through entire suite.
Ant task - provides html output from tests.
Continuous integration server.
All of the implementations should have the same "@shoulds" as their interfaces, so the @shoulds should be on the interface.
In-memory database in the test framework.
In example, line 186 - form definition - form 1
In unit test:
To add more fields to test, you may add another xml file w/ the fields
Copy and paste existing xml file and change the rows
Adding a new method:
Add @should's as you are writing code.
Open FormServiceImpl, use overwrite/implement method
Return to FormService
Use plugin to generate tests from @shoulds
Shows field answers and form table contents
5 sec startup time to create database and the FormService object via Spring
To add something to field answer table and dump to an xml file:
This uses the DB defined in runtime.properties
In TestUtil.createIntitialDataset class
modify this class.- change the initialDataset.addTable.to point to the table
Run like a normal unit test
creates a new output.xml file describing the rows
need to remove @ignore from CreateInitialDataset - a junit annotation
To run this dataset before I run the unit test.
This test extends BaseContextSensitiveTest, which provides useful method - executeDataset
takes package hierarchy of the file.
Error message - the in-memory db does not know column - define in hibernate mapping.
Every time test runs, it will roll back changes to the database. Resets db.
@Verifies - created by eclipse plugin to figure out which unit test has already been created