I've spent quite a lot of time on Pivot related unit tests recently, and
have a few questions.

1) Is there an 'official' minimum version of JUnit expected for Pivot's
build?
The build.xml file just refers to a generic 'JUnit 4', but it would be good
to document at least a x.y version, if not a x.y.z

2a) Has there ever been a discussion on unit testing Pivot GUIs, using real
Components and a real Display?

2b) If so, did the idea of a UnitTestApplicationContext come up, or is it
worth considering?    I imagine a UnitTestApplicationContext would primarily
supply Display objects, but could potentially do more.  Things like,
providing an alternative to ApplicationContext.queueCallback(Runnable,
boolean) that doesn't swallow Exceptions, and methods for simulating
keyboard events.  It might go even further and provide a Display that is
never actually visualised to support headless environments, although I have
no idea if this is feasible or even possible.

I hacked together a quick 'unit test Display provider' by instantiating a
custom Application with DesktopApplicationContext and waiting until a static
Display field was set.  I'm sure there is probably a much cleaner way of
doing it, but couldn't think how to get notification that the
Application#startup() had completed.

Perhaps DesktopApplicationContext should return the Application that it
instantiates either directly, via an event?
(DesktopApplicationContext is currently final as is
BrowserApplicationContext)

3) Are unit tests that require a Display deliberately avoided so that the
build can run in headless environments?  If so, we could just split the
tests into 2 groups and only run the headless ones unless all are explicitly
asked for.  I'm thinking about this in the context of possibly using CI for
future Pivot builds, but in general terms as well.


FYI - I have nearly finished documenting some utility classes for testing
Pivot events.
I'll commit them soon with some usage examples, and send a follow up email
about some issues that came up when I was working on them.

Chris

Reply via email to