File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Testing and the fly likes automated testing for swing program? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "automated testing for swing program?" Watch "automated testing for swing program?" New topic

automated testing for swing program?

Mandar Khire
Ranch Hand

Joined: Sep 11, 2007
Posts: 557

I write swing program with the help of coderanch posts,
program some thing like JDialog holds JPanel which holds lots of small JPanels which have feature like drag-drop by mouse.

now my question is, for checking my code works right or after some time it go wrong, i drag panel here & there frequently. I drag one small panel over another small panel & try to see it save overlap or not, or try to drag beyond the boundaries.
But doing this after 50-100 drag event my hand in as i heard there are lots of automated testing tools for test various types of programs.
So for this kind of swing program. is there any automated testing tool?

Millions saw the apple fall, but Newton asked why.
Joanne Neal

Joined: Aug 05, 2005
Posts: 3742
As a code rancher since 2007 I am sure that before asking this question, you searched the web for gui testing tools. So it would help if you told us which ones you have tried and why they didn't meet your needs so that people here can make suggestions that better fit your requirements.

Mandar Khire
Ranch Hand

Joined: Sep 11, 2007
Posts: 557

Thanks Joanne Neal, for reply.
I am sorry for not posting question with proper way so people here can make suggestions that better fit requirements.
I try to explain what i done last few days regarding this question as bellow:-
My code as bellow:-
Program contain 2 java files, 1st as & 2nd as

I try very basic only swing program for testing, if my concept clear then i will try it on swing+jdbc+hibernate+
mysql+asteriskjava program.
so for clearing concepts i do following:-

1. I search google automated testing for swing java gui.
By this i got info about 3 things
1. java.awt.Robot
For this i again search google java.awt.Robot, mouse drag
By this i found small code like this:-

I am thinking & trying how to use it in my code.
2. i read wikipedia.
Still i confuse about few points:-
1. As different IDE's we can see code & we have debug/run buttons which testing tool is giving same functionality with better performance? eg in perticular app i will open my java files, then i can enter how many time i want to test it & how...somthing GUI format....?
2. For many techniques, i have to write small piece of code & add it into the my code then run all thing & do nothing till testing not finish...
3. Many GUI testing is like some textbox , button, we should check, in textbox some text enter & then click on button & see result & this process for many times. but not always GUI means some input in text or list or combo boxes or fields etc.

I know i stretch this reply too far, but for explaining this is important to me to write all things.
Ranganathan Kaliyur Mannar

Joined: Oct 16, 2003
Posts: 1101

The IDE debugging options and using them to test is not really testing. Or at best, it can be called manual testing.
The idea of automated testing is to test something and add assertions - so that when the assertions fail, we will know instantly. And, unlike manual testing, automated tests can be repeated very quickly.

As for such a record-playback testing of Swing GUI programs, you can check out marathonman.

I agree. Here's the link:
subject: automated testing for swing program?
It's not a secret anymore!