Skip to content
This repository was archived by the owner on Apr 7, 2022. It is now read-only.

Commit fc7b098

Browse files
committed
Updated site documentation (how-to-contribute, selenium part, ...).
1 parent ba8b122 commit fc7b098

10 files changed

Lines changed: 74 additions & 80 deletions

File tree

jwebunit-htmlunit-plugin/src/main/java/net/sourceforge/jwebunit/htmlunit/HtmlUnitTestingEngineImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ public String handlePrompt(Page page, String msg) {
838838
// If Path==null, cookie is not send to the server.
839839
wc.getCookieManager().addCookie(
840840
new Cookie(c.getDomain() != null ? c.getDomain() : "", c
841-
.getName(), c.getValue(), c.getPath() != null ? c
841+
.getName(), c.getValue(), c.getPath() != null ? c
842842
.getPath() : "", c.getMaxAge(), c.getSecure()));
843843
}
844844
// Deal with custom request header

jwebunit-htmlunit-plugin/src/site/xdoc/index.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public class SearchExample extends WebTestCase {
9090
<dependency>
9191
<groupId>net.sourceforge.jwebunit</groupId>
9292
<artifactId>jwebunit-htmlunit-plugin</artifactId>
93-
<version>1.4</version>
93+
<version>2.0</version>
9494
</dependency>
9595
...
9696
</dependencies>

jwebunit-selenium-plugin/src/site/xdoc/index.xml

Lines changed: 9 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,22 @@
11
<?xml version="1.0"?>
22
<document>
33
<properties>
4-
<author email="dashorst.at.users.sourceforge.net">Martijn Dashorst</author>
4+
<author email="henryju.at.users.sourceforge.net">Julien HENRY</author>
55
<title>JWebUnit</title>
66
</properties>
7-
<meta name="keyword" content="jwebunit, java, junit, htmlunit, jacobie, httpunit, integration, test, automated, html, webtest"/>
7+
<meta name="keyword" content="jwebunit, java, junit, htmlunit, jacobie, httpunit, integration, test, automated, html, webtest, selenium"/>
88
<head>
99
<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon" />
1010
</head>
1111
<body>
12-
<section name="HtmlUnit plugin">
12+
<section name="Selenium plugin">
1313
<p>
14-
The following sample testcases illustrate the conciseness of JWebUnit versus HtmlUnit
15-
and JUnit alone. The tests perform a google search
16-
for the HtmlUnit home page, navigate to that page from Google, and validate that
17-
there is a link to the user manual on the HtmlUnit home page. The code in the
18-
first column is pure HtmlUnit / JUnit, while the second column uses the JWebUnit framework.
14+
The Selenium plugin allow to run your test in a real browser. The main advantage is the JavaScript support is perfectly identical to
15+
your target browser (of course). The main drawbacks are it is slooooooow and can't run on a headless server.
1916
</p>
2017
<p>
21-
<table cellspacing="2" border="0">
22-
<tr><th>JUnit/HtmlUnit Test</th><th>JWebUnit Test</th></tr>
23-
<tr>
24-
<td valign="top" nowrap="nowrap">
25-
<source>
26-
import java.net.URL;
27-
28-
import com.gargoylesoftware.htmlunit.WebClient;
29-
import com.gargoylesoftware.htmlunit.html.HtmlAnchor;
30-
import com.gargoylesoftware.htmlunit.html.HtmlForm;
31-
import com.gargoylesoftware.htmlunit.html.HtmlPage;
32-
import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
33-
import com.gargoylesoftware.htmlunit.html.HtmlTextInput;
34-
35-
import junit.framework.TestCase;
36-
37-
public class SearchExample extends TestCase {
38-
39-
public void testSearch() throws Exception {
40-
final WebClient webClient = new WebClient();
41-
final URL url = new URL("http://www.google.com");
42-
final HtmlPage page = (HtmlPage)webClient.getPage(url);
43-
HtmlForm form = (HtmlForm) page.getForms().get(0);
44-
HtmlTextInput text = (HtmlTextInput) form.getInputByName("q");
45-
text.setValueAttribute("HtmlUnit");
46-
HtmlSubmitInput btn = (HtmlSubmitInput) form.getInputByName("btnG");
47-
HtmlPage page2 = (HtmlPage) btn.click();
48-
HtmlAnchor link = page2.getAnchorByHref("http://htmlunit.sourceforge.net/");
49-
HtmlPage page3 = (HtmlPage) link.click();
50-
assertEquals(page3.getTitleText(), "htmlunit - Welcome to HtmlUnit");
51-
assertNotNull(page3.getAnchorByHref("gettingStarted.html"));
52-
}
53-
}
54-
</source>
55-
</td>
56-
<td valign="top" nowrap="nowrap">
57-
<source>
58-
import net.sourceforge.jwebunit.util.TestingEngineRegistry;
59-
import net.sourceforge.jwebunit.junit.WebTestCase;
60-
61-
public class SearchExample extends WebTestCase {
62-
63-
public void setUp() {
64-
setTestingEngineKey(TestingEngineRegistry.TESTING_ENGINE_HTMLUNIT);
65-
getTestContext().setBaseUrl("http://www.google.com");
66-
}
67-
68-
public void testSearch() throws Exception {
69-
beginAt("/");
70-
setTextField("q", "htmlunit");
71-
submit("btnG");
72-
clickLinkWithText("HtmlUnit");
73-
assertTitleEquals("htmlunit - Welcome to HtmlUnit");
74-
assertLinkPresentWithText("Get started");
75-
}
76-
}
77-
</source>
78-
</td>
79-
</tr>
80-
</table>
81-
</p>
18+
This plugin is still in development. In fact not all test cases works. Feel free to <a href="../how-to-contribute.html">contribute</a>
19+
</p>
8220
</section>
8321
<section name="HowTo manage dependencies with Maven 2">
8422
<p>
@@ -89,8 +27,8 @@ public class SearchExample extends WebTestCase {
8927
...
9028
&lt;dependency&gt;
9129
&lt;groupId&gt;net.sourceforge.jwebunit&lt;/groupId&gt;
92-
&lt;artifactId&gt;jwebunit-htmlunit-plugin&lt;/artifactId&gt;
93-
&lt;version&gt;1.4&lt;/version&gt;
30+
&lt;artifactId&gt;jwebunit-selenium-plugin&lt;/artifactId&gt;
31+
&lt;version&gt;2.0&lt;/version&gt;
9432
&lt;/dependency&gt;
9533
...
9634
&lt;/dependencies&gt;

src/site/fml/faq.fml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Finally, you can temporary disable JavaScript in your test:</p>
3131
setScriptingEnabled(true);
3232
...
3333
}</source>
34+
Have a look at http://htmlunit.sourceforge.net/submittingJSBugs.html
3435
</answer>
3536
</faq>
3637
</part>
@@ -51,4 +52,4 @@ Test loadTest = new LoadTest(factory, users);</source>
5152
</faq>
5253
</part>
5354

54-
</faqs>
55+
</faqs>
3.88 KB
Binary file not shown.
8.92 KB
Loading

src/site/site.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@
7171
href="#Building JWebUnit Web site and reports" />
7272

7373
</item>
74+
<item name="How-To contribute"
75+
href="/how-to-contribute.html" collapse="true">
76+
</item>
7477
</menu>
7578
<menu name="Sourceforge">
7679
<item name="Project page"

src/site/xdoc/building-maven.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
<li>
4040
add an environment variable MAVEN_HOME which
4141
points to the install directory of Maven,
42-
i.e. /opt/apache-maven-2.0.8
42+
i.e. /opt/apache-maven-2.0.9
4343
</li>
4444
<li>
4545
add
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?xml version="1.0"?>
2+
<document>
3+
<properties>
4+
<author>Julien Henry</author>
5+
<title>How-To contribute to JWebUnit</title>
6+
</properties>
7+
<body class="default">
8+
<section name="How-To contribute to JWebUnit">
9+
<p>
10+
JWebUnit is an open-source project and is looking for contributors. Please read the following sections if you plan to help.
11+
</p>
12+
<subsection name="What needs to be done?">
13+
<p>
14+
Here are some ideas:
15+
<ul>
16+
<li>
17+
Improve Selenium plugin (should ideally pass 100% unit tests). May need some modifications of the API.
18+
</li>
19+
<li>
20+
Improve Web 2.0 support (AJAX, drag&amp;drop, focus, mouse clicks, keypress, ...). Will need additions/modifications of the API.
21+
</li>
22+
<li>
23+
Take advantage of Java 5 (migrate to JUnit 4, use generics, ...)
24+
</li>
25+
<li>
26+
Create a record tool like SeleniumIDE or WebTestRecorder.
27+
</li>
28+
</ul>
29+
Of course these are simple suggestions and you can propose many different things.
30+
</p>
31+
</subsection>
32+
<subsection name="OK, I want to help. How to start with?">
33+
<p>
34+
First, you need to do your homeworks. Checkout latest code from trunk then try to <a href="building-maven.html">build JWebUnit with Maven</a>.
35+
</p>
36+
<p>
37+
Please subscribe to the developper mailing-list and tell me what feature you are working on.
38+
</p>
39+
<p>
40+
I will review your first contribution and if it doesn't break anything you will certainly be granted with commit rights (you need a sourceforge account for that).
41+
</p>
42+
</subsection>
43+
</section>
44+
</body>
45+
</document>

src/site/xdoc/index.xml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<document>
33
<properties>
44
<author email="dashorst.at.users.sourceforge.net">Martijn Dashorst</author>
5-
<title>JWebUnit 1.x</title>
5+
<title>JWebUnit</title>
66
</properties>
77
<meta name="keyword" content="jwebunit, java, junit, htmlunit, jacobie, httpunit, integration, test, automated, html, webtest"/>
88
<head>
@@ -11,8 +11,14 @@
1111
<body>
1212
<section name="Welcome">
1313
<p>
14-
You are on the JWebUnit 1.x website. Current version is 1.5. This is
15-
the "stable" version of JWebUnit. You can also consult <a href="2.x/index.html">JWebUnit 2.x website</a>.
14+
You are on the JWebUnit website. Current version is 2.0. This is
15+
the "stable" version of JWebUnit. This version requires Java 1.5.
16+
</p>
17+
</section>
18+
<section name="Please help JWebUnit !!">
19+
<p>
20+
JWebUnit is not dead but is looking for contributors. The current maintainer will only be able to do quick fix, a bit of support on the
21+
mailing-list and perfom releases. If you want new functionalities feel free to <a href="how-to-contribute.html">contribute</a>.
1622
</p>
1723
</section>
1824
<section name="What is JWebUnit?">
@@ -27,13 +33,14 @@
2733
</section>
2834
<section name="What does JWebUnit provide?">
2935
<p>
30-
JWebUnit provides a high-level API for navigating a web application combined with a set
36+
JWebUnit provides a high-level Java API for navigating a web application combined with a set
3137
of assertions to verify the application's correctness. This includes navigation
3238
via links, form entry and submission, validation of table contents, and other
3339
typical business web application features. This code try to stay independent of the libraries behind
3440
the scenes. The simple navigation methods and ready-to-use assertions allow for
3541
more rapid test creation than using only JUnit and HtmlUnit. And if you want to switch
36-
from HtmlUnit to the other soon available plugins, no need to rewrite your tests.
42+
from HtmlUnit to the other soon available plugins, no need to rewrite your tests (in the past, the HttpUnit to HtmlUnit migration was done
43+
with only minor API changes).
3744
</p>
3845
<img src="images/jwebunit-architecture.png" alt="JWebUnit architecture"/>
3946
</section>

0 commit comments

Comments
 (0)