| By Satadip Dutta | Article Rating: |
|
| July 18, 2009 12:45 PM EDT | Reads: |
40,125 |
The script editor will be used to create the test cases. Costello, the script editor, can be started by:
java -jar lib/abbot.jar
Once the GUI is running, the first step is to create a new script (File->New Script). Each script has a launch line that specifies the method (containing the GUI) to be tested. The launch line is edited with the information that can launch the GUI. The launch information requires the method name, arguments for the method, class information, and the classpath (see Figure 2).
method="main"
args="[]"
class="CelsiusConverter"
classpath="src/demo"
Note that the XML test script example has the same information in the launch tag.
With the launch information in place, the GUI can be launched (Test->Launch). This will prepare the framework to record user actions. To record user actions, press F2 (Capture->All Actions). With this step we can record the first case, which inputs a positive number, and then press convert.
Once the user interactions have been captured, we can move the actions out of the sequence block for better readability. With the script looking the way we want, it's now time to add an assertion. To do this, we'll use the Hierarchy tab to navigate to the GUI component. Upon selection of the GUI component, the name-value pair to be validated can be selected and the Assert Property = Value button will add the assertion (see Figure 3).
The other two test cases can be created similarly to form a test suite. The test cases can run within the JUnit test harness utilizing either the command line or the GUI test runner. The junit.extensions.abbot.ScriptFixture class is subclassed to create the CelsiusConverterTest.
public class CelsiusConverterTest
extends ScriptFixture
The junit.extensions.abbot.ScriptTestSuite class is used to autogenerate a suite based on test scripts matching a certain criteria. In this case, all scripts residing in a particular directory will be used. The test ScriptTestSuite class is subclassed from the junit.Framework.TestSuite class.
public static Test suite() {
return new ScriptTestSuite
(CelsiusConverterTest.class,
"src\demo\scripts\CelsiusConverter");
}
The main method of the CelsiusConverterTest class invokes the JUnit test runners.
public static void main(String[] args){
args = Log.init(args);
String[] names = {
CelsiusConverterTest.class.getName()
};
if (args.length == 1 &&
args[0].equals("--gui"))
junit.swingui.TestRunner.main(names);
else
junit.textui.TestRunner.main(names);
}
This approach facilitates the creation of a variety of user interaction scenarios that can be easily integrated with JUnit. Another interesting and handy feature is the ability to insert existing scripts into another script. Some high-level GUI tasks can be broken down into smaller tasks. In these cases, I've created scripts for the most granular tasks and then created different interaction scenarios by inserting the scripts for different tasks in a different order or by adding additional user interactions in between the tasks. Since the scripts are XML-based, they're very easy to read and they help in rapidly generating different scenarios.
Published July 18, 2009 Reads 40,125
Copyright © 2009 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Satadip Dutta
Satadip Dutta is a software architect at Hewlett-Packard (http://devresource.hp.com) and has been programming in Java since 1997. His areas of interest include distributed software architecture, Web services, and user interface design. Satadip holds an MS in Computer Science from Virginia Tech.
![]() |
Ashwath 01/18/05 02:34:16 AM EST | |||
I tried to run the code that u haven for 'GUI already exista' scenario. But it doen't work.. give me some eg.s |
||||
![]() |
tlroche 08/22/03 10:05:14 PM EDT | |||
"Abbot for SWT" (project name=abbotforswt) is an Eclipse plugin https://w3.opensource.ibm.com/projects/abbotforswt/ (IIOSB residence is intended to be temporary. We are currently in IBM * how abbotforswt extends j.a.Robot and Abbot * abbotforswt vs blackbox tools (e.g. RobotJ/XDE Tester) * related Eclipse 3.0 plan items see the (currently rather crude) abbotforswt homepage To demonstrate abbotforswt's feasibility, we have taken scenario 2 Sound interesting? Try it out! However, first: <required type="legalese"> If you are an IBMer and have NOT already completed your "OSPG </required> You have 2 installation options. Instructions are for Eclipse/ 0 Install the release zip. Goto our release page read the "IMPORTANT NOTICE", then follow the instructions in the Note that you need not register for IIOSB to get the release, but we 1 Install from CVS. This is a good first step toward becoming an - Run your development workbench (devbench) with either Target - Create a new CVS repository location with host=cvs.opensource.ibm.com and check out HEAD/abbotforswt. - Browse to our release notes search or scroll to "run the demo" - Skip to step 4 The demo can then be run in each of 3 ways, all of which are * using Test Collector in a launched WebSphere Studio build * using pde.junit to launch an Eclipse or WS build * using Eclipse's JUnit to launch just the UI |
||||
![]() |
tlroche 08/22/03 09:55:08 PM EDT | |||
"Abbot for SWT" (project name=abbotforswt) is an Eclipse plugin which seeks to extend Abbot ... for SWT (but you guessed :-) It is currently available only from the IIOSB (a "walled garden" version of SourceForge inaccessible outside IBM) @ https://w3.opensource.ibm.com/projects/abbotforswt/ (IIOSB residence is intended to be temporary. We are currently in IBM Open Source Steering Committee pre-review, and therefore hope to contribute our extensions back to Abbot sometime this millenium :-) For more detail, including * how abbotforswt extends j.a.Robot and Abbot * abbotforswt vs blackbox tools (e.g. RobotJ/XDE Tester) * related Eclipse 3.0 plan items see the (currently rather crude) abbotforswt homepage http://w3.opensource.ibm.com/~abbotforswt/ To demonstrate abbotforswt's feasibility, we have taken scenario 2 from the JDJ article above, recoded its SUT (a dialog) in SWT, and designed and implemented an API targeting SWT equivalent to Abbot's existing API targeting AWT/Swing. For more details, see our release notes @ http://w3.opensource.ibm.com/project/shownotes.php?release_id=597 Sound interesting? Try it out! However, first: If you are an IBMer and have NOT already completed your "OSPG training," please read the Open Source Participation Guidelines http://ltc.linux.ibm.com/open_source/ospg.html before you check out any code. You have 2 installation options. Instructions are for Eclipse/ WebSphere Studio users: 0 Install the release zip. Goto our release page http://w3.opensource.ibm.com/project/showfiles.php?group_id=1023 read the "IMPORTANT NOTICE", then follow the instructions in the release notes http://w3.opensource.ibm.com/project/shownotes.php?release_id=597 Note that you need not register for IIOSB to get the release, but we hope you will, because you're a fine human being. (Apologies for speciesism to all the fine non-human programmers http://www.newtechusa.com/PPI/pressroom.asp#higher out there :-) 1 Install from CVS. This is a good first step toward becoming an abbotforswt contributor! - Run your development workbench (devbench) with either Target Platform pointing to a WSAD build (which is how I tested), or just import org.apache.xerces (should work, but not tested). - Create a new CVS repository location with host=cvs.opensource.ibm.com and check out HEAD/abbotforswt. - Browse to our release notes http://w3.opensource.ibm.com/project/shownotes.php?release_id=597 search or scroll to "run the demo" - Skip to step 4 The demo can then be run in each of 3 ways, all of which are documented in the release notes: * using Test Collector in a launched WebSphere Studio build * using pde.junit to launch an Eclipse or WS build * using Eclipse's JUnit to launch just the UI |
||||
![]() |
tlroche 08/22/03 09:51:39 PM EDT | |||
"Abbot for SWT" (project name=abbotforswt) is an Eclipse plugin which seeks to extend Abbot ... for SWT (but you guessed :-) It is currently available only from the IIOSB (a "walled garden" version of SourceForge inaccessible outside IBM) @ https://w3.opensource.ibm.com/projects/abbotforswt/ (IIOSB residence is intended to be temporary. We are currently in IBM Open Source Steering Committee pre-review, and therefore hope to contribute our extensions back to Abbot sometime this millenium :-) For more detail, including * how abbotforswt extends j.a.Robot and Abbot * abbotforswt vs blackbox tools (e.g. RobotJ/XDE Tester) * related Eclipse 3.0 plan items see the (currently rather crude) abbotforswt homepage http://w3.opensource.ibm.com/~abbotforswt/ To demonstrate abbotforswt's feasibility, we have taken scenario 2 from the JDJ article above, recoded its SUT (a dialog) in SWT, and designed and implemented an API targeting SWT equivalent to Abbot's existing API targeting AWT/Swing. For more details, see our release notes @ http://w3.opensource.ibm.com/project/shownotes.php?release_id=597 Sound interesting? Try it out! However, first: If you are an IBMer and have NOT already completed your "OSPG training," please read the Open Source Participation Guidelines http://ltc.linux.ibm.com/open_source/ospg.html before you check out any code. You have 2 installation options. Instructions are for Eclipse/ WebSphere Studio users: 0 Install the release zip. Goto our release page http://w3.opensource.ibm.com/project/showfiles.php?group_id=1023 read the "IMPORTANT NOTICE", then follow the instructions in the release notes http://w3.opensource.ibm.com/project/shownotes.php?release_id=597 Note that you need not register for IIOSB to get the release, but we hope you will, because you're a fine human being. (Apologies for speciesism to all the fine non-human programmers http://www.newtechusa.com/PPI/pressroom.asp#higher out there :-) 1 Install from CVS. This is a good first step toward becoming an abbotforswt contributor! - Run your development workbench (devbench) with either Target Platform pointing to a WSAD build (which is how I tested), or just import org.apache.xerces (should work, but not tested). - Create a new CVS repository location with host=cvs.opensource.ibm.com and check out HEAD/abbotforswt. - Browse to our release notes http://w3.opensource.ibm.com/project/shownotes.php?release_id=597 search or scroll to "run the demo" - Skip to step 4 The demo can then be run in each of 3 ways, all of which are documented in the release notes: * using Test Collector in a launched WebSphere Studio build * using pde.junit to launch an Eclipse or WS build * using Eclipse's JUnit to launch just the UI |
||||
![]() |
Jeff 04/29/03 08:26:00 PM EDT | |||
I believe this is a forum in which comments need to be made about the article and its vaildity. The above messages should be in English and any concerns/comments should be made available for the benefit for all in the community |
||||
![]() |
Bhojohori Manna 04/29/03 06:00:00 AM EDT | |||
Chee chee, Ei rokom gala gali dile hobe.Dada koto bhalo article likheche. |
||||
![]() |
Utgandu 04/29/03 05:54:00 AM EDT | |||
Dada,ei jinis poisa diye keu porbe bhebechen apni?USa te theke apnio sobar moto boka patha hoye gechen .Apni ei jinista kotha theke chotha korechen?Ar apni ki GUI Master ke chenen???jobab chai,jobab dao. |
||||
- Kindle 2 vs Nook
- Why IBM’s Server Chief Got Busted
- Is Cloud Computing Like Teenage Sex?
- Industry Experts Discuss the State of Cloud Computing
- Performance Tuning Essentials for Java
- Confessions of a Ulitzer Addict
- Tactical Cloud Computing Panel at 1st Annual GovIT Expo
- It's the Java vs. C++ Shootout Revisited!
- Cloud Computing Can Revitalize Your Career as Software Developer
- IBM Could "Reinvent" Java: Mills
- Oracle & Cloud Computing: Exclusive Q&A with SVP Richard Sarwal
- A Brief History of Cloud Computing
- Kindle 2 vs Nook
- Cloud CEOs, CTOs & SVPs to Speak at 4th International Cloud Computing Expo
- Why IBM’s Server Chief Got Busted
- Is Cloud Computing Like Teenage Sex?
- Industry Experts Discuss the State of Cloud Computing
- Performance Tuning Essentials for Java
- The Difference Between Web Hosting and Cloud Computing
- Cloud Computing Expo: Exclusive Q&A with Yahoo! SVP Cloud Computing
- Ajax in RichFaces 3.3, JSF 2 and RichFaces 4
- Confessions of a Ulitzer Addict
- My Thoughts on Ulitzer
- Tactical Cloud Computing Panel at 1st Annual GovIT Expo
- A Cup of AJAX? Nay, Just Regular Java Please
- Java Developer's Journal Exclusive: 2006 "JDJ Editors' Choice" Awards
- The i-Technology Right Stuff
- JavaServer Faces (JSF) vs Struts
- Rich Internet Applications with Adobe Flex 2 and Java
- Java vs C++ "Shootout" Revisited
- Bean-Managed Persistence Using a Proxy List
- Reporting Made Easy with JasperReports and Hibernate
- Creating a Pet Store Application with JavaServer Faces, Spring, and Hibernate
- What's New in Eclipse?
- Why Do 'Cool Kids' Choose Ruby or PHP to Build Websites Instead of Java?
- i-Technology Predictions for 2007: Where's It All Headed?





































