OpenMRS resources: Difference between revisions

subsection
imported>Chrishay7
imported>Hypotext
(subsection)
Line 103:
We'll be walking you through fixing [https://issues.openmrs.org/browse/TRUNK-3780 this bug], testing changes in the webapp, writing tests, and submitting a pull request!
 
== Your First OpenMRS Ticket = =
In this workshop, you will work through the full development process involved in contributing to OpenMRS. To contribute to the project, one first needs to pick a sub-project to work on. In the open source community, this means claiming a ticket to work on. A ticket provides an overview of an issue that needs to be fixed or a new feature to be added, and is how work is divided up among contributors. In this workshop, you will pick a ticket to work on and hopefully fix the issue or create the new feature. Below is a list of starter tickets that will allow you to make a real contribution to the project. If you'd like to ease your way into this process, we also have a sample ticket that you can work on. The sample ticket is a real ticket, but is one that has already been completed. This allows you to work through a ticket similar to the starter tickets provided, but with a guide and provided solution there to assist you when needed.
 
Line 121:
Or, you can choose to work on the sample ticket here: https://issues.openmrs.org/browse/TRUNK-3780
 
== Analyzing a Ticket = =
After clicking on one of the links above, you'll come to a page that lists the details for an issue/feature that needs work. Ideally, it'll provide descriptions of the current behavior, the desired behavior, and areas of interest that might help fix the issue. Make sure to read through the comments section to get feel for the progress that's already been made.
 
Line 129:
The issues at hand: patient search doesn't do prefix search for 2 character searches but does work for 3+ character searches. So it seems that somewhere it must be manually defined to only do prefix search with 3+ characters. How could this be used to create the desired behavior and fix the bug?
 
== Replicate the Issue = =
After familiarizing yourself with the ticket, you then need to replicate the error. This will help provide additional context/error logs about the issue and will also ensure that you will be able to test whatever changes you make. To do this, you'll likely need to start the webapp. Help in doing that can be found [https://github.com/hypotext/OpenMRS-dev-setup/wiki/Running-the-OpenMRS-webapp-and-viewing-changes-in-code here].
 
Sample ticket: Start the server and go to the webapp. Login using admin/Admin123 (try admin/test if that doesn't work). Navigate to the patient search and try searching for the name's described in the ticket.
 
== Looking Through the Code Base = =
Once you can replicate the error, try to find and open the files related to the areas of interest (if provided). One way you can do this is by opening up the OpenMRS project's folder in Sublime and clicking on Find->Find in Files. Then simply search for whatever might seem relevant to the issue.
 
Sample ticket: Search for PatientSearchCriteria, PatientServiceImpl, HibernatePatientDAO, and DWRPatientService. Ctrl-f through these to try to find something that might specify a minimum search requirement. Afterwards, look for similar variables via the Find in Files method. In this case, the same change was needed to be done in 2 files (since the java backend and javascript front end are separate).
 
== Testing Your Changes = =
After making your changes, test them by trying to replicate the original issue once more. IfYou yourcan compilationdo failsthat becauseby of failed tests, check to see if those tests are still necessary. Iffollowing the desired behavior ''should'' cause theminstructions to fail, comment them out temporarily or make them work forget the newwebapp codeup and tryrunning to(making compilesure again.to IfRE-COMPILE youand nowDELETE get the desiredOLD behaviorDATA), then you'retesting almostsearching done!for Now you just need to add more unitusers' testsnames.
 
If your compilation fails because of failed tests, check to see if those tests are still necessary. If the desired behavior ''should'' cause them to fail, comment them out temporarily or make them work for the new code and try to compile again. If you now get the desired behavior, then you're almost done! Now you just need to add more unit tests.
 
Sample Project: Follow the above and if you get stuck and would like additional help finding the changes that need to be made, take a look at the commit summary for the accepted solution: https://github.com/openmrs/openmrs-core/pull/865/files
 
== Making Unit Tests = =
Once you've fixed the bug or added the new feature, you want to make sure that others don't break it. To do this, find existing tests in the code base that relate to your ticket. Modify existing tests so that they properly test for the new behavior. Then add any additional tests you find necessary to ensure that your changes are kept when future contributors start messing with the code. Once this is done, re-compile and re-test your changes to make sure everything works.
 
You can run tests by doing `mvn clean install` in the top-level openmrs-core directory. Check the output to see which tests fail and pass.
= Submitting the Pull Request =
 
== Submitting the Pull Request = =
Ask Chris or Katherine to help you submit your changes.
 
Submit your pull request here: https://github.com/hypotext/openmrs-core
 
= New beginner tasks =
Anonymous user