Sunday, March 29, 2015

Star(schema) Commander, Iteration 3

So much for micro releases.  :|

So far I have experienced a few interesting things:

  • Micro releases are not that satisfying when doing initial development - especially across three interconnected projects - core, cli and gui libraries.
  • Unit testing user interfaces really sucks.  I tried to find something but no solution seems to be around for very long.  In the end I created my own UI framework based on standalone components and messaging which made testing very easy and meant the runtime app just had to wire them together properly.  It also achieved a nice encapsulation of the different UI parts.
  • It is WAY too easy to get stuck testing every detail in a UI and it can eat up a LOT of time because everything you have to do is a new one-off.
  • The internet is not very helpful on the issue of user interface testing.  If I have to read another lecture about separation of responsibility and how you should test the domain layer, not the UI objects, blah blah barf, I will delete the internet.  Guess what, people? User interfaces have requirements as well and those must be tested with the same level of reliability as other parts.
  • When testing a user interface, there is a lot you have to let go.  Unit testing Java code can be very granular and specific, but if you try that in a user interface it will be a train-wreck.  E.G., if a table has headers that read "Name", and "Schema", testing those is going to add more semi-useless tests and will make any change to the UI break way too many tests.  Besides which I would like to refactor my UI (changing lists to tables, etc) without extra tests breaking.
  • I did manage to temper my desire to create the perfect user interface library.  I simply created what I needed and refactored as I realized that I needed more functionality.  There is a word for that but it escapes me at the moment (and most other times) ;)  . . .
  • I am toying with the idea of rewriting my UI using JxBrowser - a Java library for using an embedded Chromium container.  My Java desktop apps look so crappy and take so much work to wire together and are therefore resistant to change, and HTML makes a nice container for UI code - as compared to Java code.  I am concerned about the extreme commercial nature of the project - $1600 per license minimum; I don't know what they think they are providing that is worth that price - even if I do have a free open source license at my disposal.

Thursday, March 5, 2015

YAJUEHP - Yet Another JUnit Exception-Handling Post . . . *yawn*

I can't imagine anyone will find this useful when it is so tiresome to me, but after a jaunt in UI Testing purgatory I had to go back and test some plain old library code, but this time with a new twist.  I have been using the rather awesome ExpectedException class with nice results.  The Code Under Test in this case, however, threw InvocationTargetException's with wrapped cause's which made that approach too brittle.  I found this nice post about it which solved my issue:

JUNIT EXPECTEDEXCEPTION RULE: BEYOND BASICS

Toward the bottom there is a nice discussion of verifying causes.  I found another article he wrote comparing various exception strategies in JUnit here:

6 WAYS OF HANDLING EXCEPTIONS IN JUNIT. WHICH ONE TO CHOOSE?

I thought these were pretty handy - hopefully someone else will as well.