Skip to main content

Where do you test your code?

I've been thinking a lot about the "it works on my machine" issue.

We seem to build up and take care of our development environments or virtual machines (VMs). They have a state, mostly a non-deterministic state after being maintained for so long. The idea of spinning up an environment just to test some code would have been infeasible until recently.

I do enjoy using VirtualBox, I've been using it for years. I didn't know that it could be used to automate the deployment of virtual machines. We have developers and devops in the office looking into Docker for this task, but I'm quite comfortable with virtualisation and I thought that I would see if I could use virtualbox (or KVM) for this.

I discovered that Vagrant is a wonderful tool for this automated creation, provisioning and clean up of VMs for development and testing.
I've only used Vagrant for 1 week, but I'm enjoying it so far. My PC at work is fairly old and slow, but even so, I can spin up Ubuntu images in a few minutes, fully provisioned and ready for testing Java code.
I followed the book below to get a head start, it's really good. Using it I created my own CentOS 6 box images.




I would really recommend checking out Vagrant and then Docker for creating your testing environments.


Popular posts from this blog

Overcome Java JNI gdb errors on GNU/Linux

If you happen to try to debug any Java JNI programs using gdb on GNU/Linux you will soon come across error messages. For example : $ gdb --args java MyJavaProgramUsingJNI cannot find user-level thread for LWP nnn: generic error warning: Cannot initialize thread debugging library: versions of libpthread and libthread_db do not match The reason for this is that the java program mucks around with LD_LIBRARY_PATH and that prevents gdb from running correctly. To overcome this, you have to run your Java program and place a pause in the Java code, such as reading a key, and then in another shell, run gdb to attach to the running Java process. You can then set your breakpoint on your JNI code and debug it. Here is an example : Compile your Java program: $ javac JNITest.java Generate the JNI header file: $ javah -jni JNITest.java Create and compile your C code library: $ cat jnilib.c #include "JNITest.h" JNIEXPORT jint JNICALL Java_JNITest_addValues( JNIEnv

App Sightings

jDiskReport is an excellent disk utility. Visual very well designed and works very well also. jGoodies jEdit is an excellent Java text editor. jEdit jEdit - features SQuirreL SQL Client - a universal SQL client SQuirreL SQL client SQuirreL SQL client - screenshots FreeMind - free mind mapping in Java FreeMind FreeMind - screenshots

JavaPosse update

I keep listening to this wonderful podcast : Java News, Interviews and more about the Java programming language. I'm catching up with past episodes and listening to the past Java events that I missed the first time around. I'm up to episode #057 so far, it's wonderful. Very interesting and enlightening. JavaPosse About JavaPosse