I've coded a Swing application. Now I've got to test this big application using JUnit testing in NetBeans. I've learned some basics, but I'm unable to figure out how to trigger the events automatically. If someone worked on it, they can help. You can also redirect me to some sources at least. You know, in a Swing application you'll have buttons, etc. which generate events which are methods and I need to trigger the events. So, is there a way to test the entire software?
Asked
Active
Viewed 418 times
1
-
1"...I'm unable to figure out how to trigger the events automatically..." - trigger what events? Do you mean running the JUnit tests? Those aren't events - you just tell the IDE to run the tests. Your expectations of how things ought to work aren't clear. – duffymo Apr 17 '11 at 16:39
-
Very sorry for the unclear explanation. You know, in a swing you'll have buttons etc which generate events which are methods and I need to trigger the events. So, I need a way to test the entire software. – Mojo_Jojo Apr 17 '11 at 17:03
-
http://stackoverflow.com/questions/1480843/unit-testing-a-swing-component – andersoj Apr 17 '11 at 18:33
2 Answers
0
A bit after the fact, but hopefully helpful to someone. NB JUnit comes with NetBeans (as long as you opt it in), and using Jemmy along with JUnit (through NetBeans' Jelly) makes for testing Swing UI actually pretty simple. Here are some good links for getting setup:
http://platform.netbeans.org/tutorials/nbm-test.html
http://netbeans.dzone.com/articles/how-use-jemmy-junit-netbeans

idclaar
- 688
- 2
- 7
- 17