11 Dec 2009 @ 8:55 AM 

Java Power Tools

This book was an impulse purchase.  About a year ago, I was wandering through my local book mega-store with my wife, looking for guides on how to raise a puppy.  As I tend to do, I gravitated toward the technical section of the bookstore.  I had taken a few classes on Java at my local community college, and wanted to eventually make a living at it, so I scanned the available books on Java.  That was when Java Power Tools caught my eye.  This book is certainly focused on Java, but it is not a programming manual, not a language specification, not an exam study guide.  It is a reference that leads the reader through the extensive world of open-source tools written to make Java software development easier and more fun.

Any organization worth its salt uses at least some of the tools described herein, and many of the larger-scale enterprises will use quite a few, often together in interlocking ways.  If you’re serious about Java development, you need to know how to use the available build tools, unit testing frameworks, issue trackers, source control management, continuous integration, code coverage, and profilers.  This book answers the vital questions of:  ”what is it?”, “where can I find it?”, “how do I use it?”, and “why do I need it?”.

As a young tester peeking my head out of the black box for the first time, I found answers to all the questions that I had stored away in my head about these mysterious terms “Ant”, “CruiseControl“, “JUnit“, and “CVS”.  Most importantly, I had finally internalized that there is far more to Java software development than just the programming language chosen.  In order to develop and release quality software, an organization must rely upon many tools (power tools) to work with the greatest possible efficiency and focus.  In the past year, I’ve used many of these tools myself, either to improve my organization’s build and release process, or to power my own Java-based automation framework.  I don’t know that I could’ve progressed with as much confidence and persistence had it not been for this book.  I’d recommend it to any blossoming Java developer, quality assurance professional in a Java shop, or project manager looking to improve the release process.

Posted By: chris
Last Edit: 15 Dec 2009 @ 12:18 PM

EmailPermalinkComments (0)
Tags
 10 Sep 2009 @ 11:08 AM 

I am a self-taught automation engineer for a major privately-held web company.  When I joined the organization, it was as a manual tester.  We had an automation engineer with one foot in the development department.  His automation framework was a custom mish-mash of C# and Java.  Code was duplicated everywhere.  Many of the tests (for a web application, mind you) were reliant on the specific [X,Y] coordinates of a link, button, etc.   Only one test would run at a time, and all input data was hard-coded.   Put simply, it was a mess.   When our lone automation engineer left for greener pastures, with no one who could maintain, read, or even execute his framework, we found ourselves releasing software riddled with issues that just didn’t come out in testing..

QA had very close and amicable ties to the developers, but often found ourselves speaking the language of the users, unable to translate to the language of the engineers (Java), so I went ahead and learned Java and design patterns.  They’d written unit tests using JUnit that were apparently run with every build, so I learned JUnit.  All that was fine, but QA’s testing was still being done manually, and often ad-hoc!

While hiring for automation and performance test engineers, I noticed a pattern in the resumes I received: the vast majority of candidates out there work almost exclusively in drag-and-drop tools like Quick Test Pro and LoadRunner.  These tools are prohibitively expensive, inflexible, and, frankly, serve mostly to separate the engineer from the code under test!  Frustrated by the lack of passion and quality in the resumes coming in, I pulled the postings from the job boards, and began an effort to bring this QA department up to modern using exclusively open-source tools.

It seemed like a good idea at the time.  It certainly didn’t seem like I’d be tripling my technical library and dedicating my nights and weekends to all the base topics I’d need even to get started! I’ve been endeavoring to build the entire system utilizing the same technologies as our development team, so that it can integrate most seamlessly with our continuous integration (CruiseControl) and deployment tools (Ant & Maven).  I’ve taught myself Perl, JDBC, XHTML & CSS, JavaScript, XML, SAX, DOM, TestNG(parallelism!), Selenium (IDE, RC, and Grid), JMeter, CVS, SVN, and git.

My new test automation framework is cranking out hundreds of tests in parallel and really helping the development cycle.   The tests are flexible to changes in the UI or in the activity flow.  Input data is validated against the database… it’s a beautiful thing.  The framework, though operable, is still far from complete.  Do I know everything?  Am I finished learning?  Are my opinions as good as law?  No!  Not by a long shot!  However, the true value of a project like this is that it never has to be finished.  You can always keep learning.

I urge my readers (both of you) to go open-source, become active in user communities, contribute where you can; be it in the reporting of bugs or the fixing of them, and to never ever let good knowledge go un-spread.

Reblog this post [with Zemanta]
Reblog this post [with Zemanta]
Posted By: chris
Last Edit: 15 Dec 2009 @ 11:04 AM

EmailPermalinkComments (0)
Tags
 10 Sep 2009 @ 10:34 AM 

In the world of unit testing frameworks for Java, there are really only two that truly stand out: JUnit and TestNG.

While JUnit is the de-facto standard, and rightly so (it’s been imitated in every language from C# to Perl).  JUnit provides a comprehensive assertion library, integrated support for build management tools like Ant and Maven, as well as just about every continuous integration tool worth mentioning, and even IDE support for the most popular Java IDEs.  However, there are a few areas where JUnit just doesn’t meet every developer’s needs.

Enter TestNG.  TestNG (the “NG” stands for “Next Generation”) was developed as a replacement for JUnit 3.x, which, at the time was found to be very restrictive.  JUnit test classes had to extend org.junit.TestCase, setUp() and tearDown() methods had to be named just that and contain empty-argument signatures, to name just a few of the limitations.  TestNG, on the other hand, used the whiz-bang new J2SE 5.0 Annotations paradigm to bless any method you please as a unit test, set-up method, or otherwise.  JUnit was quick to follow suit in 4.x.  What JUnit still can’t buy you these days is parallel execution support.  Much of the value of unit tests is that they are fast.  However, in a large application, you could have thousands of unit tests, and the amount of time spent running each in turn could negate the benefit of having them in the first place.

Re-enter TestNG in billowing cape and tights.  With TestNG, all your unit tests can run in parallel using a configurable thread pool, with fail triggers that watch execution time or run the same test multiple times in a row, reporting a failure only if the test fails more than a certain percentage of executions.

Another really cool feature of TestNG is the “data provider” method.  Unit tests are great, because they can exercise a method in your class-under-test and expect a particular result.  However, that method would probably produce a deterministic result for any number of different data.  Using a data provider, you can call your test method over and over again with different arguments, exercising your method-under-test with a wide range of inputs!  Just change your test method signature to take in whatever input values you’d like to apply to your method-under-test.  Then, add the dataProvider=”someString” attribute to your @Test annotation.  Now, create a new method with the @DataProvider annotation and a matching name=”someString” attribute.  A data provider method takes no arguments and returns either an Object[][] or an Iterator<Object[]>.  (I find the latter to be more useful, as it conveniently allows you to use a Collection<Object[]> within the method, and then call iterator() in the return statement.) The first dimension of the array is the list of argument sets.  The second dimension of the array the actual list of arguments.

You’re all set!  When your test method is executed, it will be run once for each entry into the data provider’s return object!  Now that’s some good exercise for your method-under-test!

Like what you’re reading, but already using JUnit 3 or 4?  The official distribution of TestNG comes with a conversion mechanism that will run through your code and update all your JUnit tests to TestNG tests!  How cool is that??

There are more cool features of TestNG than I can get into, here.  I’d recommend reading the official page thoroughly.  For my purposes, I give TestNG two thumbs up!

Reblog this post [with Zemanta]
Reblog this post [with Zemanta]

 Last 50 Posts
Change Theme...
  • Users » 1
  • Posts/Pages » 11
  • Comments » 0
Change Theme...
  • VoidVoid
  • LifeLife « Default
  • EarthEarth
  • WindWind
  • WaterWater
  • FireFire
  • LightLight

Book Review

  • No categories

Uncategorized

  • No categories