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,
First we have to create a setup method like this inside the subclass we extended from UISpecTestCase
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,
UISpec4J.setWindowInterceptionTimeLimit(12000);If anything wrong, inform me. :)
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