I would like to share some information regarding how to use UISpec4J for GUI Testing. This post will be edited with more information as soon as I gain experience in that.
First we have to create a setup method like this inside the subclass we extended from UISpecTestCase
If the element is not directly accessible (ie. nested inside many panels). We have to use the panel1 = window.getPanel("PANELNAME") method to get a reference.
So using the panel2 = panel1.getPanel("PANELNAME") method we can easily
go to the particular panel in the application window.
Note :- Before making assertions we have to call the UISpec4J.setAssertionTimeLimit(int ms) to give a delay before starting the assertion.
To intercept a modal dialog box, we have to use like this,
If anything wrong, inform me. :)
First we have to create a setup method like this inside the subclass we extended from UISpecTestCase
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | protected void setUp() throws Exception { super .setUp(); UISpec4J.setWindowInterceptionTimeLimit(TIMELIMITININT); setAdapter( new MainClassAdapter(YOURMAINCLASS. class )); Window window = getMainWindow(); // Get references to UI elements } |
If the element is not directly accessible (ie. nested inside many panels). We have to use the panel1 = window.getPanel("PANELNAME") method to get a reference.
So using the panel2 = panel1.getPanel("PANELNAME") method we can easily
go to the particular panel in the application window.
Note :- Before making assertions we have to call the UISpec4J.setAssertionTimeLimit(int ms) to give a delay before starting the assertion.
To intercept a modal dialog box, we have to use like this,
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | UISpec4J.setWindowInterceptionTimeLimit( 12000 ); WindowInterceptor .init(ANY TRIGGER EVENT) .process( new WindowHandler( "Main Window" ) { public Trigger process(Window window) { // Now you can use the window to access the elements in the modal dialog box return window.getButton( "OK" ).triggerClick(); } }) .run(); |
No comments:
Post a Comment