<a name="1176"></a><a name="wbp25Chapter24P1"></a><span>Chapter 24: </span> Swing Testing with jfcUnit - Professional Java Tools for Extreme Programming [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Professional Java Tools for Extreme Programming [Electronic resources] - نسخه متنی

Richard Hightower, Warner Onstineet al.

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
توضیحات
افزودن یادداشت جدید











Chapter 24: Swing Testing with jfcUnit


Overview


Chapter 13, JUnit allows us to do unit testing of our application’s individual classes to ensure that they are performing as designed. jfcUnit extends that functionality to Swing-based applications, allowing us to test our user interfaces as well as our application interfaces.

Currently it supplies support for:



Obtaining window and dialog handles.



Locating specific components inside of a window, including components inside of components (a component hierarchy).



Raising events on the found components, e.g. clicking a button, or typing text in a text field.



Handling testing of components in a thread-safe manner.



XML recording of events for playback testing.



The version of jfcUnit that we will be covering in this chapter is 2.0.2. Earlier versions do not have the XML support for recording and playback that this version has.

So, why would you want to test your Swing application—why not just test the classes that it uses? In order to properly ensure that your application functions properly under all circumstances, you should perform as many tests as possible. By providing a Swing test framework, the makers of jfcUnit have made it possible to not only test the underlying classes but also the user interface. By testing the user interface you ensure that your users will always see what they should be seeing, and that your application receives the proper input to its underlying classes.

Testing with jfcUnit is rather straightforward. Because jfcUnit offers an extension of the normal JUnit test case, you can simply integrate it with your normal test cases as either its own test suite or as a member of an existing suite. The primary difficulty that you may encounter when using a tool like jfcUnit is ensuring that you are finding the correct component for testing. We will show you how to do this in the next section.



Where to Get jfcUnit


JfcUnit is an open source project hosted at Sourceforge and is available under the GNU Library or Lesser GPL at:

[ http://jfcunit.sourceforge.net/ ]







/ 228