Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "RapUITesting"

(Replaced content with "| RAP wiki home | [http://eclipse.org/rap RAP project home] | ===Writing UI Tests for RAP applications=== This document was outdated and therefore removed. You c...")
 
(26 intermediate revisions by 9 users not shown)
Line 1: Line 1:
=<font color="red">WORK IN PROGRESS</font>=
+
| [[RAP|RAP wiki home]] | [http://eclipse.org/rap RAP project home] |
  
| [[RAP|RAP wiki home]] | [http://eclipse.org/rap RAP project home] |
 
 
===Writing UI Tests for RAP applications===
 
===Writing UI Tests for RAP applications===
  
This document will describe '''one''' way how to do UI tests for you [[RAP]] applications. For this way, we use the combination of JUnit, [http://openqa.org/selenium/ Selenium] and [http://openqa.org/selenium-rc Selenium RC] to have automatic UI tests which can be integrated into your JUnit testsuite.
+
This document was outdated and therefore removed. You can see the old content here: https://wiki.eclipse.org/index.php?title=RapUITesting&oldid=347633
 
+
We will provide a simple example application to demonstrate the usage of the several tools.
+
 
+
==Requirements==
+
If you don't have it, you need at least these files in order to follow the tutorial:
+
* [http://release.openqa.org/selenium-remote-control/nightly/selenium-remote-control-0.9.1-SNAPSHOT.zip Selenium Remote Control 0.9.1]
+
* [http://wiki.openqa.org/download/attachments/1736/qooxdooExtension_0_2.zip?version=1 Selenium User Extension for Qooxdoo]
+
 
+
Extract these files in a directory of your choice.
+
 
+
==Creating the sample application==
+
First we need something to test. Therefor I put together a little example application to demonstrate the UI testing approach.
+
 
+
Just create a new plugin project, add <code>org.eclipse.rap.ui.workbench</code> as a dependency and create the following class:
+
<pre>
+
package org.eclipse.rap.demo.ui.tests;
+
 
+
import org.eclipse.jface.dialogs.MessageDialog;
+
import org.eclipse.swt.SWT;
+
import org.eclipse.swt.events.SelectionAdapter;
+
import org.eclipse.swt.events.SelectionEvent;
+
import org.eclipse.swt.layout.GridLayout;
+
import org.eclipse.swt.lifecycle.IEntryPoint;
+
import org.eclipse.swt.widgets.Button;
+
import org.eclipse.swt.widgets.Display;
+
import org.eclipse.swt.widgets.Shell;
+
 
+
public class TestApp implements IEntryPoint {
+
 
+
public Display createUI() {
+
Display d = new Display();
+
final Shell s = new Shell(d, SWT.SHELL_TRIM);
+
s.setLayout(new GridLayout());
+
s.setText("App Title");
+
final Button b1 = new Button(s, SWT.PUSH);
+
b1.setText("Before");
+
b1.addSelectionListener(new SelectionAdapter() {
+
public void widgetSelected(SelectionEvent e) {
+
MessageDialog.openInformation(s, "MessageBox",
+
"Changing the button text now...", null);
+
b1.setText("After");
+
}
+
});
+
s.pack();
+
s.open();
+
return d;
+
}
+
 
+
}
+
</pre>
+
 
+
As you can see, this is a really tiny RAP example - but big enough to be worth to test it.
+
 
+
==Preparing the tests==
+
Now create a new java project and add the JUnit library. Additionally, you need to add the <code>selenium-java-client-driver.jar</code> to your project in order to use the Selenium Remote Control.
+
 
+
As we
+
  
 +
Current information on using RAP 2.0+ with Selenium 2.x can be found here: http://eclipsesource.com/blogs/2014/04/29/how-to-write-ui-tests-for-rap-with-selenium-2-0/
  
==Creating the test cases==
+
(TODO: Copy blog post here.)
  
==Running the Selenium RC server==
 
The Selenium RC server is a little server written in Java which cares about the interaction between your Junit tests and the browser instances. As it offers some webservices for us, we need to start it before running our tests.
 
  
==Test it!==
+
[[Category:RAP]]

Latest revision as of 03:15, 24 July 2014

| RAP wiki home | RAP project home |

Writing UI Tests for RAP applications

This document was outdated and therefore removed. You can see the old content here: https://wiki.eclipse.org/index.php?title=RapUITesting&oldid=347633

Current information on using RAP 2.0+ with Selenium 2.x can be found here: http://eclipsesource.com/blogs/2014/04/29/how-to-write-ui-tests-for-rap-with-selenium-2-0/

(TODO: Copy blog post here.)

Back to the top