Integration
...
testing involves the testing of larger segments of your Tapestry module or web application, typically including the user interface.
Div | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
| ||||||||||
Wiki Markup | ||||||||||
{float:right|background=#eee}
{contentbylabel:title=Related Articles|showLabels=false|showSpace=false|space=@self|labels=testing}
{float} |
The Tapestry Test Utilities is a small library to make it easier to build integration test suites around Selenium version 12.14.0.3.
The strategy is to start, in-process, a Selenimum Selenium Server (which, in turn, starts and manages a web browser), a Jetty instance (for the web browser to talk to), and a Selenium client (which talks to the server).
...
Note |
---|
Before Tapestry 5.2, your class should extend AbstractIntegrationTestSuite |
Here's an example from one of the Tapestry modules:
Code Block | ||||
---|---|---|---|---|
| ||||
package org.apache.tapestry5.jpa.integration.app2;
import org.apache.tapestry5.test.SeleniumTestCase;
import org.testng.annotations.Test;
public class SinglePersistenceUnitIntegrationTest extends SeleniumTestCase
{
@Test
public void persist_entities()
{
open("/persistitem");
assertEquals(getText("//span[@id='name']").length(), 0);
clickAndWait("link=create item");
assertText("//span[@id='name']", "name");
}
}
|
...
Here's an example :
Code Block | ||||
---|---|---|---|---|
| ||||
<suite name="Selenium Tests Suite" annotations="1.5">
<test name="Integration Tests" enabled="true">
<parameter name="tapestry.browser-start-command" value="*googlechrome" />
<parameter name="tapestry.port" value="9091" />
<classes>
<class name="com.example.newapp.SeleniumTest"></class>
</classes>
</test>
</suite>
|
Some Interesting Tools
Here are some interesting plugins you can use to write your integration tests.
- Google Chrome : xpathOnClick
- FireFox : Selenium IDE