This page (revision-8) was last changed on 12-Sep-2014 13:35 by Dieter Käppel

This page was created on 26-Apr-2012 16:00 by Dieter Käppel

Only authorized users are allowed to rename pages.

Only authorized users are allowed to delete pages.

Page revision history

Version Date Modified Size Author Changes ... Change note
8 12-Sep-2014 13:35 4 KB Dieter Käppel to previous
7 12-Sep-2014 13:35 2 KB Dieter Käppel to previous | to last
6 24-Jun-2014 22:01 2 KB Dieter Käppel to previous | to last
5 24-Jun-2014 11:46 2 KB Dieter Käppel to previous | to last
4 24-Jun-2014 11:45 1 KB Dieter Käppel to previous | to last
3 26-Apr-2012 16:53 1 KB Dieter Käppel to previous | to last
2 26-Apr-2012 16:01 1 KB Dieter Käppel to previous | to last
1 26-Apr-2012 16:00 1 KB Dieter Käppel to last

Page References

Incoming links Outgoing links

Version management

Difference between version and

At line 17 changed one line
<version>1.1</version>
<version>1.0-SNAPSHOT</version>
At line 24 changed one line
Page page = client.begin(new MutableURL("http://localhost/"), null, false);
Page page = client.begin(new URL("http://localhost/"), null, false);
At line 56 removed 41 lines
!!!Servlet Unit Protocol
Der [HtmlClient] kann auch mit dem [ServletUnitProtocol] betrieben werden. Damit vermeidet man einen [Application Server] hochzufahren, sowie Sockets und Connections zu öffnen. Dazu fügt man in die [Maven] pom.xml zunächst folgende Einträge hinzu:
{{{
<dependency>
<groupId>com.intersult</groupId>
<artifactId>testing-tomcat7</artifactId>
<version>1.1-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.intersult</groupId>
<artifactId>jsf-workspace</artifactId>
<version>1.2-SNAPSHOT</version>
<scope>test</scope>
</dependency>
}}}
__Hinweis:__ [com.intersult:testing-tomcat7|TomcatUnitProtocol] enthält automatisch das Testing-Framework [com.intersult:testing|Intersult Testing]. [com.intersult:jsf-workspace|JSF Workspace] sorgt dafür, dass JSF-Komponenten geladen werden können, die noch nicht in eigene JAR-Bibliotheken eingepackt sind.
Ein Test kann dann so aussehen:
{{{
public class JsfTest {
@Test
public void test() throws Exception {
HtmlClient client = new HtmlClient();
Page page = client.begin(new MutableURL("unit://localhost/faces/index.xhtml", getProtocol()), null, false);
Assert.assertNotNull(page);
Assert.assertEquals("Hello World!", page.getElement("//H1").getText());
Assert.assertEquals("Text-Tag", page.getElement("//DIV[@id = 'form:test-div']").getText());
}
private ServletUnitProtocol getProtocol() {
ServletUnitProtocol protocol = new TomcatUnitProtocol();
protocol.setWebXmlFile("src/test/webapp/WEB-INF/web.xml");
return protocol;
}
}
}}}