jeudi 19 février 2015

UISpec4J and external application

I am trying to launch an external application for testing using UISpec4J.


Here are the questions and their answers I referred so far:


How to automate a swing java web start application which runs clicking a link into a web application, which is automated with Selenium WebDriver?


Getting all windows using UISpec4J


UISpec4J Capturing modal dialog, before the trigger finish


my.exe referred below is a Java application wrapped in exe using some tool. Internally it uses the jars and is Java GUI application.


Based on these questions I have come up with following code fragments:



this.setAdapter(new UISpecAdapter() {
@Override
public Window getMainWindow() {
return WindowInterceptor.run(new Trigger() {
@Override
public void run() throws Exception {
// running jnlp by netx launcher
Runtime.getRuntime().exec("C:\\my.exe");
Thread.sleep(10000);
}
});
}
});


In the approach above I simple get "No window was shown" error.



this.setAdapter(new UISpecAdapter() {
@Override
public Window getMainWindow() {
final Window[] result = new Window[1];
WindowInterceptor
.init(new Trigger() {
@Override
public void run() throws Exception {
Runtime.getRuntime().exec("C:\\my.exe");
//Thread.sleep(10000);
}
})
//.processTransientWindow()
.process(new WindowHandler() {
public Trigger process(Window window) throws Exception {
result[0] = window;
return Trigger.DO_NOTHING;
}
})
.run();
return result[0];
}
});


In the second approach above, I still get "No window shown" error AND control never reaches to overriden "process" method.


From the first question I referred, mentioned above, we should be able to do that because the answer to it mentions launching jnlp application which is external application.


I tried with jre 6 update 0 and I can at least run test. In java update 37, from the third question I referred above, I get abstract method not implemented error.


What am I doing wrong? Any idea?


I am using latest UISpec4J package - version 2.4.


Thanks in advance, -Neel.


Aucun commentaire:

Enregistrer un commentaire