Thursday, 15 July 2010

Testing Times

Looks like this is going to be one of those rare blog entries that will live in both my tech and personal blog since I don't know where to put it. I guess that's good. Anyway:

Well, it's week number four in my new job. i have a desk, a machine and I'm just about set up with my development environment. There's a few things I've not been briefed on or covered yet, some of them quite basic (like how about giving me a Jira account, that may be useful soon, or on what branch do these guys do all their development, surely not main_latest all the time?!!)

So what have I achieved so far?

Well, not a lot yet, and it's starting to bother me. I've so far been given a single 2 part task with the aim of speeding up the build tests:
  • Go through a bunch of JUnit tests and remove anything not testing actual business logic (so for exampe if its a persist or retrieve operation, take it out).
  • Investigate getting the JUnit tests to run in parallel.
That's not so bad for a first task on an unfamiliar system.

So I spent just under a day looking at a select bunch of JUnit test code trying to decipher what was and wasn't a business logic test. Sounds quite easy, but since a lot of methods are masking non-business logic, it's very easy to leave them in. Similarly, what looks like a persist operation may be an actual calculation of one variety of another. Then you have the methods that call both responsibilities, or rely on persisted data to pass. It's not as easy as it first looked, especially on an application with which you are not familiar.

The upshot of all this? I came to the conclusion that there probably wasn't any business logic being tested in the set of tests I was looking at. I was, as you might imagine, uneasy with this deduction, it felt wrong and I couldn't be 100% sure my findings were correct, however when I returned to my "mentor" for this task he didn't seem to surprised and commented "I've skimmed over this myself and I didn't see anything leap out either."

Oh thanks.

Actually one thing that did amuse me, I had flagged up one test as possibly being business logic, however as my mentor was looking into this I noticed a section of code that clearly suggested otherwise, so at least I beat him to that one.

With that task out of the way I started looking at making the JUnit tests run in parallel. A little research on the web revealed what was needed (including a version of Spring that's still in RC status). Undeterred I created a small project with a bunch tests to try this stuff out, and sure enough it worked as I expected (albiet without a hint of Spring in sight, unlike the real project). So how did it go once I started applying this new found knowledge to actual project... well I've been on it a week now and I'll be sure to let you know what I find when I finish (if you ask nicely).

I've been hit by numerous issues with my development environment, and on the odd occasion when things do work as expected, a run can take up to 26 minutes (usually closer to 19 for a full run - at least for what I'm covering). The worst thing is I'm only making changes to a handful of POM.xml files and so far the results show no avantage at all. At this rate my findinge will be: "Hey, I've spent over a week and can't get any speed increase". That hardly makes me fell very good and I don't actually feel I've achieved anything yet. Especially when for the most part my day consists of the following routine:

  1. Start machine. Spend 1 to 2 hours getting the build to work properly.
  2. Make a small, well trodden modification to all 4 instances of a command in 3 pom files. (5 mins max, probably closer to 2 mins)
  3. Fire off build and wait to complete (up to 19 minutes if it completes)
  4. Investigate any errors or note timings (2 to 10 mins).
  5. Repeat from step 2 until time to go to lunch or home.
I can't help feeling this should have been finished some time ago. I know deep-down proving something doesn't work is as important as proving it does, but this seems to be dragging now. it feels like my fault, but frankly i don't know how to make it better, it's just the nature of this particular beast.

I guess deep down I feel the need to prove myself as the new boy, and with this task I feel like I'm coming up short, rightly or wrongly. Oh well, I guess that could be me worrying too much. Sometimes, that's just the way it is.

No comments:

Post a Comment