Showing posts with label junit. Show all posts
Showing posts with label junit. Show all posts

Friday, May 8, 2009

Update: OpenMRS Test-a-Thon (May 16 - 17)

What the heck is the OpenMRS Test-a-Thon?
The OpenMRS Test-a-Thon is a code-a-thon event that allows people to collaboratively increase and improve our testing process in order to make the OpenMRS platform a more stable and robust piece of software (click here for more details).

When is it going down?
We'll be starting at noon (EDT) on Saturday, May 16 and ending at noon (EDT) on Sunday, May 17. You can come and go as you wish. I'll be hanging out in our IRC Channel all day Saturday and will be taking in a feature film on Saturday night (9 - 11pm CDT). So no pressure. Come inside, submit yourself a junit test, and then go back out and finish your Saturday chores.

Where is the event going to take place?
The test-a-thon will take place online. You can join us on the OpenMRS IRC Channel. Contact me via Skype (jmiranda) or on the IRC channel to discuss how you might be able to help out.


Who can participate?
Anyone. Developers, implementers, supporters, documenters ... people who are bored.

Who should participate?
Everyone.

Why should you participate?
Because ...
  • You love OpenMRS.
  • You want to learn about test driven develement (TDD).
  • You want to learn about behavior driven development (BDD).
  • You want to learn about cool unit testing frameworks (i.e. JUnit).
  • You want to learn about cool web testing frameworks (Selenium).
  • You want to learn about continuous integration.
  • You want to write documentation for OpenMRS.
  • You want to meet the team.
  • You want to make Ben Wolfe happy.
  • You want to win a prize.
  • You have nothing better to do on a Saturday.
How can I participate in this once in a lifetime (more like bi-annual) event?
You can head over to the OpenMRS wiki for more details.

Thank you,

The OpenMRS Team

Tuesday, July 15, 2008

On OutOfMemoryErrors In JUnit Tests

I ran into an OutOfMemoryError while running a JUnit test in Eclipse. OutOfMemoryErrors are usually really simple to fix ... just increase the amount of memory to the JVM. This issue was a little try

So first of all, I figured JUnit would be running inside the Eclipse JVM, so I increased the memory settings in eclipse.ini to 1 Gig (from 512m).

-vmargs
-Xms1024m
-Xmx1024m
-XX:PermSize=256m
-XX:MaxPermSize=256m

I restarted Eclipse and reran the JUnit test. Same result.

I then decided to try to execute the same code in our webapp (running in Tomcat 5.5 configured with 512m of heap) and it completed successfully. This made me realize that the JUnit tests must be running in a separate JVM (either spawned or forked). The critical piece is that the JUnit JVM was not using the Eclipse memory settings from eclipse.ini. Instead, it must be using the default JVM memory settings (i.e. 64m). I searched a bit for how one might allocate more memory to a JUnit test in Eclipse and didn't find anything conclusive, so I went in and played around with the JUnit settings myself.

I started by opening up the Eclipse page that allows a user to manage JUnit configuration settings (right click a JUnit class file and select Run As > Open Run Dialog). From this dialog, click on the "Arguments" tab and paste the following settings into the "VM arguments" field:

-Xms512m
-Xmx512m

Apply the settings and Close the dialog. Rerun your test and reconfigure these settings if necessary.