Author Archives: natyzelaya

Unit Test: @should annotations

Basically what I’ve been doing is introducing the “@should” javadoc annotation. Each api method will get one or more @should annotations that simply state a behavior of that method need testing, in other words, each @should annotations should be phrased. For instance:

  • @should not fail given null parameter
  • @should return empty list if no results

The example above would become unit test named (given the method was findPatient):

  • public void findPatient_shouldNotFailGivenNullParameter()
  • public void findPatient_shouldReturnEmptyListIfNoResults()

These are the step I followed to get started on this task:

  • Import the OpenMRS-core Repository from Eclipse
      • In Eclipse, choose File:Import
      • Choose Git: Projects from Git
      • Select Repository Source: URI
      • Browse the location of the local file on the PC (file: openmrs-core)
      • Select the master branch
      • Choose the directory you want to clone into
      • Select Use the New Project Wizard
      • Choose Java: Java Project
      • Enter a project name (To get all files imported, the given name has to be exactly the same as the local file name. In this case the project name should be: openmrs-core)
  •  Start searching all methods that do not have tests
      • In Git Bash, type command:  $grep –r ‘@should’ openmrs-core  (This command line will recurs into sub-directories to look for all “@should” instances)
      • Command:  $grep –r ‘@should’ openmrs-core > file.txt   (This line will save the output to a file text)
  • Browse ‘@should’ annotations in the packages  
      • The txt.file will output all packages that still have ‘@should’ annotations.
      • In Eclipse, look for such packages and start modifying them, so those methods become unit test names.
      • For example: /api/src/main/java/org/openmrs/somepackage/SomeObject.java:

In Eclipse: /api/src/main/java/org/openmrs/aop/AuthorizationAdvice.java:

From the blog Naty Zelaya » CS@Worcester by natyzelaya and used with permission of the author. All other rights reserved by the author.

Unit Testing

As a group we continue working and trying to find more detailed information about the assigned ticket. Unfortunately, the lack of communication and responses from the developers is limiting the progress of our project.

Last week, we did the JUnit Lab in class, which was very helpful in understanding how unit testing works. I had to install GitHub in my laptop to be able to open git files in Eclipse. To start working on the Lab, I had to fork JUnit-Lab Repository to my account and then I cloned it from Eclipse.

After going through and finish the lab, I tried to follow the same steps with the OpenMRS-core Repository. I ran into problems, but after so many attempts I finally got to clone the repository by importing the project from a local source. 

From the blog Naty Zelaya » CS@Worcester by natyzelaya and used with permission of the author. All other rights reserved by the author.

New Ticket: TRUNK-243

After two attempts to work on the OpenMRS’s project my group has now chosen a new ticket, the TRUNK-243. The description of this ticket explains that the current unit tests have bad names, so this ticket is about cleaning the unit test. I’ve been researching about unit test before to start working on the actual code, so this is what I have learned this week.

What is Unit Test?

Unit testing is a software development process designed to correct individual parts of code by isolating each part of the program. In other words, unit test is a piece of code that invokes a unit of work in the system and then checks a single assumption about the behavior of that unit of work.

Benefits of Unit Testing

  • Reduces the level of bugs in production code
  • Problems can be found early in the development cycle
  • Automated tests can be run as frequently as required
  • Facilitates change
  • Simplifies integration
  • Is a form of documentation
  • Can improves the design of code

From the blog Naty Zelaya » CS@Worcester by natyzelaya and used with permission of the author. All other rights reserved by the author.

OpenMRS Wiki

Up to this point, working with OpenMRS software has become frustrating. A quick recap… In a matter of minutes, our original ticket was claimed by someone else, so my group ended up losing such a great ticket to start off the project. After this misfortune, we chose another ticket, which was not very clear in the description of the problem. However, we had an answer and likewise the approval from one of the OpenMRS developers to start working on the issue.

Unfortunately, on March 11th, I received an email about the recent edits made to the wiki page.  The email states that some of the senior developers have expressed concerns & confusion about the accuracy of the edits.

Before proceeding with our work, we ensure that the outcome was what they were asking. It’s frustrating because all changes made by the group have been reverted back. Working on this project has been a waste of time, and at the end it seems my account has been restricted to access the wiki page.

After two attempts, looking into a new project will be a challenge.

From the blog Naty Zelaya » CS@Worcester by natyzelaya and used with permission of the author. All other rights reserved by the author.

Group Status Report

As a group, we started the week finding out that our original ticket, TRUNK-324, had been claimed by someone else. We had a quick meeting and agreed to work on the TRUNK-3009 instead. TRUNK-3009 is a documentation bug.

For this ticket we are supposed to look for all references in the wiki to Global Preferences, and change them to Settings. According to the description given in OpenMRS the “Global Properties” page was renamed and updated to just a “Settings” page for version 1.9. So if the wiki mentions GPs they need to be updated, as there are still hundreds of references to Global Properties on the wiki.

The description of the bug is somewhat vague, so before we start working on this one of our team member, Connor Kelly, put a comment on the page to make sure that our understanding of the ticket is what they want. The comment was as follows:

“My intention is to go through the whole wiki and replace any instance of “Global Properties” or “global properties” with “Settings (formerly Global properties)”, is my undesrtanding correct on this or am I missing something? I don’t want to mess up the whole wiki.”

On Saturday, March 8, 2014, we got an answer on the comment saying that the update should include that the change only affects version 1.9 and above.

We are now ready to get started on searching and replacing any string “global property” within the wiki page.

The change and what users will find while reading the wiki page is as follows:

Settings (formerly Global Properties 1.8 and below)

Finally, as a group we have agreed to split up the documentation section found in the left panel of the OpenMRS Wiki home page.

From the blog Naty Zelaya » CS@Worcester by natyzelaya and used with permission of the author. All other rights reserved by the author.

OpenMRS Set Up

Setting up the system has been difficult. My laptop is running Windows 8.1, so that’s the first challenge I have.

First, when I tried to check which version of java I had installed, I got this output: “ ‘javac’ is not recognized as an internal or external command, operable program or batch file”. So, I decided to check: Program > Java > About > Version 7 (1.7.0-b147). The Developers Guide instructs to check the version as follow “javac –version” on the command line, but instead I entered “java -version” and it worked!

Then, I got stuck in the installation step. I downloaded and run the OpenMRS SDK installer. The wizard setup was completed without outputting any error. Once again, in order to get the output in the console I had to change “omrs-version” to uppercase, “OMRS-version”, otherwise the result would not have succeeded.

This time, the prompt line gave me an error: “JAVA_HOME not found in your environment. Please set the JAVA_HOME variable in your environment to match the location of your Java installation”

If you are running into the same problem, here is the solution:

  1. Locate the Java Runtime Environment (JRE) Installation Directory
    1.  If you didn’t change the installation path for the Java Runtime Environment during installation, it will be in a directory under C:\Program Files\Java. Using Explorer, open the directory C:\Program Files\Java.
    2.  Inside that path will be one or more subdirectories such as C:\Program          Files\Java\jre7
  2. Set the JAVA_HOME Variable
    1. Right-click the My Computer icon on your desktop and select Properties.
    2. Click the Advanced tab.
    3. Click the Environment Variables button.
      1. Under System Variables, click New.
      2. Enter the variable name as JAVA_HOME.
      3. Enter the variable value as the installation path for the Java Development Kit. (e.g.C:\Program Files\Java\jre7)
    4. Click OK.
    5. Click Apply Changes.

Close any command window which was open before you made these changes, and open a new command window. If the changes do not take effect even after reopening the command window, restart Windows.

After fixing the JAVA_HOME, I checked if the SDK is working properly. The console output looks similar as the one on the Developers Guide.

Now the last step, running OpenMRS locally, it starts to create the directory, but nothing happens. It never launches the web server to be tested. If I click the link, the web page loads blank. I’m still trying to figure out what I missed!

From the blog Naty Zelaya » CS@Worcester by natyzelaya and used with permission of the author. All other rights reserved by the author.

Wiki & Git are FUN!

The third week of the semester has been very busy. Let’s start with the wiki editing that was started in class. This is the first time I have to edit a wiki. It was fun and easy to learn how to add and modify content. What I like about the wiki application is its simplicity, which allows any user to contribute text without being a web designer.

My wiki profile has information about the Issue Tracker Activity. This activity was useful in a way that I can get familiar with the OpenMRS Issue Tracker system, which is a system that allows browsing and filtering bugs. In this activity not only learned to browse and filter issues, but I also learned to find reports based on a specific project.

The second part of the assignment was the Git Videos and the tutorial, which gave me an insight of what Git is and how it works. Git is a Version Control System (VCS) with capability to keep track the history of every file, and changes made by a team member who is working or collaborating on a single project. VCS allows to revert files back to a previous state, revert the entire project, review changes made over time, see who last modified something that might be causing a problem, who introduced an issue and when, etc.

In summary, some features that Git provides are:

  • Configuration: Free download and installation; fast and easy setup.
  • Fast: Nearly all operations are performed locally (on local disk).
  • Distributed Version Control: if any server dies, any of the client repositories can be copied back up to the server to restore it.
  • Team Centric: Allows group of contributor working simultaneously within the same project.
  • Integrity: Contributor can’t lose information in transit or get file corruption without Git being able to detect it.
  • Merging Capability: Git is flexible when more than one user’s work needs to be brought together.
  • Opt in: You decide on which projects to participate.
  • Open Software: Let people offer contributions.
  • Backup: Every user has a full backup of all data. 

Finally, this week I went through the selection of 3 tickets within the issue tracker. I am very excited to work on projects related to database.

From the blog Naty Zelaya » CS@Worcester by natyzelaya and used with permission of the author. All other rights reserved by the author.

Ways to contribute to Open Source

An interesting aspect about open-source software is that it allows you to use your skills where you feel comfortable working with. Open-source helps people to discover that you don’t have to master all levels of computer science to contribute a piece of knowledge.

Personally, the readings have opened my eyes, and I’m glad that writing code is not the only way to contribute to large projects. Having 14 or more different ways to contribute to major projects make newbies want to add something to it.

IRC Activity

IRC activity in-class was enjoyable. It’s been a long time since the last time I chatted for over an hour. IRC is a great way to communicate in real time while working on large projects, especially since most people are looking for answers right away.

IRC is a great tool because it can be easily installed on user’s computers who have access to internet, regardless of the operating system running on the computer. IRC has different features such as chat and data transfer, file sharing, and also allows one to one communication using the private message.

From the blog Naty Zelaya » CS@Worcester by natyzelaya and used with permission of the author. All other rights reserved by the author.

The Initial Blog

As I thought about my expectations of this course, Software Development Process, undoubtedly hope to have the opportunity to learn the techniques to solve development problems in an effective and efficient manner. Also, I am excited to work on a real and large project. I think it will give me the experience I need within the Computer Science field.

Writing blogs will be challenging because this is something that I did not expect at all. I’m not a blogger, actually this will be my first time writing blogs.

This course could not have had a better start than by reading “Free vs. Open”, along with other readings and the in-class activities.

Free vs. Open

When thinking about Free Software, most people might think about software free of charge. However, the idea is more complex since it promotes user’s respect and freedom, even if one has to pay for such software. Personally, I think that free software it a good way to express our intellectual and to contribute in the improvement or development of new  software.

For software to be considered as “free” must meet four conditions: 1. Users have the freedom to run the program, 2. freedom to study and change the program, 3. freedom to redistribute copies, 4. freedom to distribute  copies of the modified version.

On the other hand, open source licenses are too restrictive; cannot be use it as it is our means, and do not allow the user to install modified versions of executables.

OpenMRS: Health IT

An electronic medical record (EMR) is not only a need of replacing paper with digital technology, but it also provides the opportunity to improve the workflow. Persuading physicians to use information technology (IT) in their practices may result in increased efficiency and reduced costs. OpenMRS is one among many of the different EMR softwares and here are the key points:

  • Accuracy (e.g. can reduce medical errors.)
  • Efficiency (e.g. improve data exchange between health it applications.)
  • Better patient care (e.g. can support decision making by health care professionals)
  • Understanding data about public health (e.g. data captured can be used to monitor public health standards.)
  • Serving as a record of patient care (e.g. historical record of patient care that can be easily transferrable to different locations.)

The information provided in the OpenMRS Guide is a good start for a better understanding of this project.

Git Activity

The Git program is something new for me, but the activity in class gave me a brief idea of the software. Since we are going to work in teams during this semester, this free-open software seems to be easy to learn and appropriate.

From the blog Naty Zelaya » CS@Worcester by natyzelaya and used with permission of the author. All other rights reserved by the author.