Google+
HtmlClient
English
Deutsch

Add new attachment

Only authorized users are allowed to upload new attachments.

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

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

Only authorized users are allowed to rename pages.

Only authorized users are allowed to delete pages.

Difference between version and

At line 17 changed one line
<version>1.0-SNAPSHOT</version>
<version>1.1</version>
At line 24 changed one line
Page page = client.begin(new URL("http://localhost/"), null, false);
Page page = client.begin(new MutableURL("http://localhost/"), null, false);
At line 56 added 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;
}
}
}}}
Version Date Modified Size Author Changes ... Change note
8 12-Sep-2014 15:35 4.124 kB Dieter Käppel to previous
7 12-Sep-2014 15:35 2.516 kB Dieter Käppel to previous | to last
6 25-Jun-2014 00:01 2.472 kB Dieter Käppel to previous | to last
5 24-Jun-2014 13:46 2.471 kB Dieter Käppel to previous | to last
4 24-Jun-2014 13:45 1.682 kB Dieter Käppel to previous | to last
3 26-Apr-2012 18:53 1.191 kB Dieter Käppel to previous | to last
2 26-Apr-2012 18:01 1.179 kB Dieter Käppel to previous | to last
1 26-Apr-2012 18:00 1.192 kB Dieter Käppel to last
« This page (revision-8) was last changed on 12-Sep-2014 15:35 by Dieter Käppel