Skip to main content

Posts

Showing posts from September, 2010

Junit parameterization - the next step

Background I have just been fooling around with Junit's parameterization support. Here is what I learned so far JUnit 4 has support for parameterization. In short, write test points, and run them for different parameters. for eg. The Test point could be test() { launch browser for (browsername); } and it needs to be run for multiple browsers. The Parameter here is the 'browsername'. JUnit allows you to define a @Parameters decorated method (with any name) which you use to define what the list of browser names are. Of course, you can even have multiple parameters (which is why the weird List of array syntax appears) Thus, if you want to run launchbrowser() with 'ie', 'firefox', 'chrome', you write (Note: you need to add @RunWith(Parameterized.class). See Junit4 doc for details. @RunWith(Parameterized.class) public class myTest { @Parameters public static Collection mybrowsers() { // Return a collection of string[]'s here // Weird that JUnit re

Cool web charting with Flot

Flot has become one of my favorite charting tools because of its simplicity, and the fact that it works! I have tried several charting tools, and they don't always work as expected. For example, this tool was the first that worked for me without having to worry about even-ing out my x-axis across all series! It is a forward looking tool, as it uses the HTML5 canvas. For the time being, you have to use an extra js file to make it work with IE. It also has great support for time series data plotting, which is often a pain for most people I used it successfully with a Rails application, and got my chart working in about a week or less. Adding Javascript interaction to turn series on and off was also trivial. Here is roughly how it looked for me I will post an example when I get a chance, but in the meantime, here is the project page http://code.google.com/p/flot/ Enjoy Flot!