[ImageJ-devel] IJ1 unit tests

Rasband, Wayne (NIH/NIMH) [E] rasbandw at mail.nih.gov
Sat Oct 8 14:28:24 CDT 2011


Hi Curtis,

I am willing to try to figure out why the tests are failing. I thought I would start with the virtual stack tests so I converted VirtualStackTest.java to an ImageJ plugin (attached), but I can't get it to run because I can't find the files "gray8-2x3-sub1.tif" and "gray8-2x3-sub2.tif" on the imagejdev website and I don't know how to generate them.

-wayne



import ij.*;
import ij.process.*;
import ij.plugin.*;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
 
public class Unit_Tests implements PlugIn {

	public void run(String arg) {
		testGetProcessor();
	}

   public void testGetProcessor() {
	String DATA_DIR = "src/test/resources/data/";
       // setup vstack
        VirtualStack vs =new VirtualStack(2,3,null,DATA_DIR);
        vs.addSlice("gray8-2x3-sub1.tif");
        vs.addSlice("gray8-2x3-sub2.tif");
        // test that it works
        ImageProcessor proc;
        // try valid entries and test returned data
        proc =vs.getProcessor(1);
        assertEquals(2,proc.getWidth());
        assertEquals(3,proc.getHeight());
        assertArrayEquals(new byte[]{0,40,0,40,120,-96},(byte[])proc.getPixels());
        proc =vs.getProcessor(2);
        assertEquals(2,proc.getWidth());
        assertEquals(3,proc.getHeight());
        assertArrayEquals(new byte[]{0,40,0,40,120,-96},(byte[])proc.getPixels());
    }

}






On Oct 7, 2011, at 3:05 PM, Curtis Rueden wrote:

> Hi Wayne et. al,
> 
> For quite some time now, we have had unit tests (written by Barry) for testing the behavior of IJ1. Unfortunately, they were originally written to compile against a patched version of IJ1 and we neglected to update them to work with IJ1 "out of the box."
> 
> I have had a ticket about this situation (http://dev.imagejdev.org/trac/imagej/ticket/598) for the past few months, but have only just now finally fixed the tests to work against various versions of IJ1 from 1.44 onwards.
> 
> I ran them against all development versions of 1.45 (a through q) and saved the result as a blog post:
>   http://imagejdev.org/2011/10/07/unit-tests-imagej-1x
> 
> It looks like from 1.45a through 1.45q, a total of 7 code changes were introduced that result in test failures. These could be the result of bugfixes, or they could be new regressions. I wanted to let you know in case you were interested in pursuing these bugs, since I know how much you value backwards compatibility.
> 
> Instructions on running the tests yourself can be found here:
>   http://imagejdev.org/source-code#Running_ImageJ_1.x_unit_tests
> 
> My plan is to hook up the tests to Hudson (http://dev.imagejdev.org:8080/) and have it send an email whenever a new version of IJ1 is released with failing tests.
> 
> What do you think?
> 
> Regards,
> Curtis
> 





More information about the ImageJ-devel mailing list