File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Testing and the fly likes testing GUIs and multithreading Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Testing
Bookmark "testing GUIs and multithreading" Watch "testing GUIs and multithreading" New topic

testing GUIs and multithreading

Jeff Langr
Ranch Hand

Joined: May 14, 2003
Posts: 799
Greetings J.B. and congrats on the book! I noticed the blurb at Manning didn't provide complete detail on the chapters, so I was wondering to what extent you cover the testing of user interfaces and multithreading ("much more" could indeed include these). And also, what your general philosophy (i.e. 2 sentences or less) is on each.

Thanks, and good luck with the book.


Books: Pragmatic Unit Testing in Java, Agile Java, Modern C++ Programming with TDD, Essential Java Style, Agile in a Flash. Contributor, Clean Code.
Ilja Preuss

Joined: Jul 11, 2001
Posts: 14112
The only book I remember containing advice on testing concurrency is "Unit Testing in Java: How Tests Drive the Code" - and the chapter basically concluded that unit testing isn't an effective way to ensure proper use of multithreading. (It's likely that the chapter will be dropped from the second edition...)

Regarding UI testing, "JUnit Recipes" contains a whole chapter on "Testing web components". For testing Swing UIs, I only know of the above mentioned "Unit Testing in Java" and "Test-driven Development: A Practical Guide" which handle this topic.

The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
J. B. Rainsberger
Ranch Hand

Joined: Aug 05, 2004
Posts: 87
Thanks, Jeff. I enjoyed your "Essential Java Style" a great deal, so it's an honor to receive your praise.

Multithreading was in the original plan, but was cut due to time. Moreover, I am a novice at multithreaded programming, so I felt uncomfortable writing about the subject. Scott Stirling would have contributed those recipes, had he had more time to devote to the project.

As for GUI, I felt that there was no need to duplicate Dave Astels' work in _Test-Driven Development: A Practical Guide_, which says more than I ever could about testing and test-driving Swing UIs.

If you meant web UI, then _JUnit Recipes_ covers that pretty well.

Author of <a href="" target="_blank" rel="nofollow">JUnit Recipes: Practical Methods for Programmer Testing</a>
C Kutler
Ranch Hand

Joined: Apr 15, 2004
Posts: 62
I am just learning about JUnit. I happen to be working on a JavaHelp viewer and would like to devise JUnit tests for this viewer, but so far all I have read about JUnit doesn't go into testing GUIs.

Does anyone have any specific advice on how to get started?

We learn by doing, there is no other way.
Lasse Koskela

Joined: Jan 23, 2002
Posts: 11962
You might get some useful pointers from
Also, Dave Astel's TDD book discusses TDD'ing a Swing application from scratch using Jemmy. JFCUnit might also be of interest to you.

Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Surasak Leenapongpanit
Ranch Hand

Joined: May 10, 2002
Posts: 341
From book "Unit Testing in Java", you can download GUI Testing Chapter.
I agree. Here's the link:
subject: testing GUIs and multithreading
It's not a secret anymore!