httpunit-commit Mailing List for httpunit (Page 28)
Brought to you by:
russgold
You can subscribe to this list here.
| 2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(5) |
Sep
(31) |
Oct
(39) |
Nov
(18) |
Dec
(6) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2001 |
Jan
(8) |
Feb
(5) |
Mar
(8) |
Apr
(25) |
May
(20) |
Jun
(23) |
Jul
(28) |
Aug
(10) |
Sep
(3) |
Oct
(32) |
Nov
(61) |
Dec
(24) |
| 2002 |
Jan
(50) |
Feb
(34) |
Mar
(35) |
Apr
(3) |
May
(25) |
Jun
(25) |
Jul
(30) |
Aug
(146) |
Sep
(49) |
Oct
(156) |
Nov
(121) |
Dec
(54) |
| 2003 |
Jan
(12) |
Feb
(79) |
Mar
(88) |
Apr
(26) |
May
(67) |
Jun
(29) |
Jul
(8) |
Aug
(16) |
Sep
(20) |
Oct
(17) |
Nov
|
Dec
(5) |
| 2004 |
Jan
|
Feb
(40) |
Mar
(30) |
Apr
(5) |
May
|
Jun
(83) |
Jul
(34) |
Aug
(20) |
Sep
(44) |
Oct
(46) |
Nov
|
Dec
(14) |
| 2005 |
Jan
(4) |
Feb
|
Mar
(5) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(4) |
Oct
|
Nov
|
Dec
(1) |
| 2006 |
Jan
|
Feb
|
Mar
(26) |
Apr
(8) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(5) |
Nov
|
Dec
|
| 2008 |
Jan
|
Feb
|
Mar
|
Apr
(36) |
May
(38) |
Jun
(1) |
Jul
(1) |
Aug
|
Sep
(4) |
Oct
|
Nov
(18) |
Dec
(4) |
| 2009 |
Jan
|
Feb
(2) |
Mar
(3) |
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
(35) |
Sep
(1) |
Oct
|
Nov
|
Dec
(1) |
| 2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(3) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2011 |
Jan
(9) |
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(21) |
Oct
(18) |
Nov
(1) |
Dec
|
|
From: Russell G. <rus...@us...> - 2003-05-23 21:53:01
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/cookies
In directory sc8-pr-cvs1:/tmp/cvs-serv19595/test/com/meterware/httpunit/cookies
Modified Files:
CookieTest.java
Log Message:
bug #741965: be more lenient in accepting cookie domains
Index: CookieTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/cookies/CookieTest.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CookieTest.java 4 Nov 2002 21:01:38 -0000 1.2
+++ CookieTest.java 23 May 2003 21:52:58 -0000 1.3
@@ -104,7 +104,9 @@
checkAcceptance( 5, false, "www.meterware.com/servlets/special", "meterware", null );
checkAcceptance( 6, false, "www.meterware.com/servlets/special", ".com", null );
checkAcceptance( 7, false, "www.meterware.com/servlets/special", ".httpunit.org", null );
- checkAcceptance( 8, false, "www.some.meterware.com/servlets/special", ".meterware.com", null );
+
+ // N.B. This cookie should be rejected if we are using strict domain matching, but is accepted with lenient matching.
+ checkAcceptance( 8, true, "www.some.meterware.com/servlets/special", ".meterware.com", null );
}
|
|
From: Russell G. <rus...@us...> - 2003-05-23 03:24:53
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory sc8-pr-cvs1:/tmp/cvs-serv32696/src/com/meterware/httpunit
Modified Files:
HttpUnitUtils.java WebRequestSource.java WebWindow.java
Log Message:
bug #734133: javascript URLs must handle prefix with mixed / upper case
Index: HttpUnitUtils.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/HttpUnitUtils.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- HttpUnitUtils.java 24 Mar 2003 03:22:09 -0000 1.12
+++ HttpUnitUtils.java 23 May 2003 03:24:49 -0000 1.13
@@ -172,4 +172,9 @@
return string1.equals( string2 );
}
}
+
+
+ static boolean isJavaScriptURL( String urlString ) {
+ return urlString.toLowerCase().startsWith( "javascript:" );
+ }
}
Index: WebRequestSource.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebRequestSource.java,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- WebRequestSource.java 23 May 2003 03:09:27 -0000 1.29
+++ WebRequestSource.java 23 May 2003 03:24:50 -0000 1.30
@@ -125,7 +125,7 @@
*/
String getRelativePage() {
final String url = getRelativeURL();
- if (url.startsWith( "javascript:" )) return url;
+ if (HttpUnitUtils.isJavaScriptURL( url )) return url;
final int questionMarkIndex = url.indexOf("?");
if (questionMarkIndex >= 1 && questionMarkIndex < url.length() - 1) {
return url.substring(0, questionMarkIndex);
@@ -142,7 +142,7 @@
private String trimFragment( String href ) {
- if (href.startsWith( "javascript:" )) return href;
+ if (HttpUnitUtils.isJavaScriptURL( href )) return href;
final int hashIndex = href.indexOf( '#' );
if (hashIndex < 0) {
return href;
@@ -304,7 +304,7 @@
private String getParametersString() {
String url = trimFragment( getDestination() );
if (url.trim().length() == 0) url = getBaseURL().toExternalForm();
- if (url.startsWith( "javascript:" )) return "";
+ if (HttpUnitUtils.isJavaScriptURL( url )) return "";
final int questionMarkIndex = url.indexOf("?");
if (questionMarkIndex >= 1 && questionMarkIndex < url.length() - 1) {
return url.substring( questionMarkIndex + 1 );
Index: WebWindow.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebWindow.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- WebWindow.java 4 Apr 2003 14:20:12 -0000 1.13
+++ WebWindow.java 23 May 2003 03:24:50 -0000 1.14
@@ -158,7 +158,7 @@
String urlString = request.getURLString().trim();
if (urlString.startsWith( "about:" )) {
response = WebResponse.BLANK_RESPONSE;
- } else if (!urlString.startsWith( "javascript:" )) {
+ } else if (!HttpUnitUtils.isJavaScriptURL( urlString )) {
response = _client.newResponse( request, frameName );
} else {
WebRequestSource wrs = request.getWebRequestSource();
|
|
From: Russell G. <rus...@us...> - 2003-05-23 03:24:53
|
Update of /cvsroot/httpunit/httpunit/doc
In directory sc8-pr-cvs1:/tmp/cvs-serv32696/doc
Modified Files:
release_notes.txt
Log Message:
bug #734133: javascript URLs must handle prefix with mixed / upper case
Index: release_notes.txt
===================================================================
RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v
retrieving revision 1.299
retrieving revision 1.300
diff -u -r1.299 -r1.300
--- release_notes.txt 23 May 2003 03:09:27 -0000 1.299
+++ release_notes.txt 23 May 2003 03:24:49 -0000 1.300
@@ -16,6 +16,7 @@
22-May-2003
Problems fixed:
1. bug #722788: WebForm.submit() was not invoking the 'onClick' event of the specified submit button.
+ 2. bug #734133: javascript: URLs were ignored if "javascript:" is not all lower case.
2-May-2003
Acknowledgements:
|
|
From: Russell G. <rus...@us...> - 2003-05-23 03:24:53
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript
In directory sc8-pr-cvs1:/tmp/cvs-serv32696/test/com/meterware/httpunit/javascript
Modified Files:
ScriptingTest.java
Log Message:
bug #734133: javascript URLs must handle prefix with mixed / upper case
Index: ScriptingTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript/ScriptingTest.java,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -r1.52 -r1.53
--- ScriptingTest.java 27 Mar 2003 03:36:37 -0000 1.52
+++ ScriptingTest.java 23 May 2003 03:24:50 -0000 1.53
@@ -51,7 +51,7 @@
public void testJavaScriptURLWithValue() throws Exception {
defineResource( "OnCommand.html", "<html><head></head>" +
"<body>" +
- "<a href='javascript:\"You made it!\"'>go</a>" +
+ "<a href='JavaScript:\"You made it!\"'>go</a>" +
"</body></html>" );
WebConversation wc = new WebConversation();
WebResponse response = wc.getResponse( getHostPath() + "/OnCommand.html" );
|
|
From: Russell G. <rus...@us...> - 2003-05-23 03:11:13
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/servletunit
In directory sc8-pr-cvs1:/tmp/cvs-serv25229/src/com/meterware/servletunit
Modified Files:
JUnitServlet.java
Log Message:
Always show exception on failures
Index: JUnitServlet.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/servletunit/JUnitServlet.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- JUnitServlet.java 2 May 2003 22:20:39 -0000 1.5
+++ JUnitServlet.java 23 May 2003 03:11:10 -0000 1.6
@@ -423,7 +423,7 @@
private boolean displayException( TestFailure failure ) {
- return !failure.isFailure();
+ return true;
}
|
|
From: Russell G. <rus...@us...> - 2003-05-23 03:09:30
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript
In directory sc8-pr-cvs1:/tmp/cvs-serv24044/test/com/meterware/httpunit/javascript
Modified Files:
FormScriptingTest.java
Log Message:
bug #722788: form submit now invokes button's onclick event
Index: FormScriptingTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript/FormScriptingTest.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- FormScriptingTest.java 1 Apr 2003 13:42:09 -0000 1.21
+++ FormScriptingTest.java 23 May 2003 03:09:27 -0000 1.22
@@ -232,7 +232,7 @@
}
- public void donttestSubmitButtonScript() throws Exception { // XXX not sure this is the desired behavior
+ public void testSubmitButtonScript() throws Exception { // XXX not sure this is the desired behavior
defineResource( "DoIt?color=green", "You made it!" );
defineResource( "OnCommand.html", "<html><head></head>" +
"<body>" +
|
|
From: Russell G. <rus...@us...> - 2003-05-23 03:09:30
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory sc8-pr-cvs1:/tmp/cvs-serv24044/src/com/meterware/httpunit
Modified Files:
Button.java SubmitButton.java WebForm.java
WebRequestSource.java
Log Message:
bug #722788: form submit now invokes button's onclick event
Index: Button.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/Button.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- Button.java 4 Apr 2003 14:20:11 -0000 1.8
+++ Button.java 23 May 2003 03:09:27 -0000 1.9
@@ -68,8 +68,11 @@
}
- final
- protected boolean doOnClickEvent() {
+ /**
+ * Does the 'onClick' event defined for this button.
+ * @return true if subsequent actions should be performed.
+ */
+ final protected boolean doOnClickEvent() {
return _onClickEvent.length() == 0 || getScriptableDelegate().doEvent( _onClickEvent );
}
Index: SubmitButton.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/SubmitButton.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- SubmitButton.java 17 Feb 2003 23:54:41 -0000 1.15
+++ SubmitButton.java 23 May 2003 03:09:27 -0000 1.16
@@ -44,7 +44,7 @@
* Perform the normal action of this button.
*/
protected void doButtonAction() throws IOException, SAXException {
- getForm().submit( this );
+ getForm().doFormSubmit( this );
}
Index: WebForm.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebForm.java,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -r1.83 -r1.84
--- WebForm.java 2 Apr 2003 15:31:05 -0000 1.83
+++ WebForm.java 23 May 2003 03:09:27 -0000 1.84
@@ -56,11 +56,19 @@
/**
* Submits this form using the web client from which it was originally obtained.
- * Will usually return the result of that submission; however, if the 'onsubmit' event is triggered and
- * inhibits the submission, will return the updated contents of the frame containing this form. Note that
- * this will not run any event associated with the specified submit button. Use SubmitButton#click for that.
+ * Will usually return the result of that submission; however, if the submit button's 'onclick'
+ * or the form's 'onsubmit' event is triggered and
+ * inhibits the submission, will return the updated contents of the frame containing this form.
**/
public WebResponse submit( SubmitButton button ) throws IOException, SAXException {
+ return button.doOnClickEvent() ? doFormSubmit( button ) : getCurrentFrameContents();
+ }
+
+
+ /**
+ * Submits the form without also invoking the button's "onclick" event.
+ */
+ WebResponse doFormSubmit( SubmitButton button ) throws IOException, SAXException {
return submitRequest( getAttribute( "onsubmit" ), getRequest( button ) );
}
Index: WebRequestSource.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebRequestSource.java,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- WebRequestSource.java 2 Apr 2003 15:31:05 -0000 1.28
+++ WebRequestSource.java 23 May 2003 03:09:27 -0000 1.29
@@ -214,8 +214,13 @@
protected WebResponse submitRequest( String event, final WebRequest request ) throws IOException, SAXException {
WebResponse response = null;
if (event.length() == 0 || getScriptableDelegate().doEvent( event )) response = submitRequest( request );
- if (response == null) response = getCurrentFrame( getBaseResponse().getWindow(), getPageFrame() );
+ if (response == null) response = getCurrentFrameContents();
return response;
+ }
+
+
+ protected WebResponse getCurrentFrameContents() {
+ return getCurrentFrame( getBaseResponse().getWindow(), getPageFrame() );
}
|
|
From: Russell G. <rus...@us...> - 2003-05-23 03:09:29
|
Update of /cvsroot/httpunit/httpunit/doc
In directory sc8-pr-cvs1:/tmp/cvs-serv24044/doc
Modified Files:
release_notes.txt
Log Message:
bug #722788: form submit now invokes button's onclick event
Index: release_notes.txt
===================================================================
RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v
retrieving revision 1.298
retrieving revision 1.299
diff -u -r1.298 -r1.299
--- release_notes.txt 18 May 2003 05:20:46 -0000 1.298
+++ release_notes.txt 23 May 2003 03:09:27 -0000 1.299
@@ -13,6 +13,10 @@
Revision History:
+22-May-2003
+Problems fixed:
+ 1. bug #722788: WebForm.submit() was not invoking the 'onClick' event of the specified submit button.
+
2-May-2003
Acknowledgements:
Thanks to David D. Kilzer for creating thorough tests for URLs containing navigation and showing a way to handle them.
|
|
From: Russell G. <rus...@us...> - 2003-05-23 03:07:33
|
Update of /cvsroot/httpunit/httpunit/doc/tutorial
In directory sc8-pr-cvs1:/tmp/cvs-serv23156/doc/tutorial
Modified Files:
task1editor-entry.html task1editor-validation.html
Log Message:
use form.setParameter
Index: task1editor-entry.html
===================================================================
RCS file: /cvsroot/httpunit/httpunit/doc/tutorial/task1editor-entry.html,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- task1editor-entry.html 27 Nov 2001 16:40:47 -0000 1.3
+++ task1editor-entry.html 23 May 2003 03:07:30 -0000 1.4
@@ -89,13 +89,13 @@
WebForm form = response.getFormWithID( "pool" );
assertNotNull( "No form found with ID 'pool'", form );
- WebRequest request = form.getRequest( "save", "Save" ); // (1) select a submit button
- request.setParameter( "away1", "Detroit Lions" ); // (2) enter values into the form
- request.setParameter( "home1", "Denver Broncos" );
- request.setParameter( "tiebreaker", "1" );
- response = client.getResponse( request ); // (3) submit the form
- form = response.getFormWithID( "pool" );
+ form.setParameter( "away1", "Detroit Lions" ); // (1) enter values into the form
+ form.setParameter( "home1", "Denver Broncos" );
+ form.setParameter( "tiebreaker", "1" );
+
+ SubmitButton saveButton = getSubmitButton( "save", "Save" ); // (2) select the desired submit button
+ response = form.submit( saveButton ); // (3) submit the form
assertEquals( "Away team 0", "", form.getParameterValue( "away0" ) ); // (4) verify the response
assertEquals( "Home team 0", "", form.getParameterValue( "home0" ) );
@@ -106,11 +106,10 @@
}
</pre>
<p>This is our first form submission. Take note:<ol>
-<li>The first step in submitting a form is obtaining a request from it. Since this form has two named submit buttons,
-we must specify which one we want to be included in the request.</li>
<li>We make a call for each parameter that we want to set. Any parameters we do not set will be submitted with their
default values.</li>
-<li>We submit the form by asking our client to get a response to the prepared request.</li>
+<li>Since there is more than one button in the form, we ask for the one we want by name and value.</li>
+<li>We submit the form, specifying the desired button.</li>
<li>We can use the same methods as above to check the new state of the pool. Alternately, we could have examined the
BettingPool object directly.</li></ol></p>
Index: task1editor-validation.html
===================================================================
RCS file: /cvsroot/httpunit/httpunit/doc/tutorial/task1editor-validation.html,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- task1editor-validation.html 22 Feb 2002 15:49:04 -0000 1.5
+++ task1editor-validation.html 23 May 2003 03:07:30 -0000 1.6
@@ -32,24 +32,26 @@
client.setAuthorization( "aUser", "pool-admin" );
WebResponse response = client.getResponse( "http://localhost/PoolEditor" );
WebForm form = response.getFormWithID( "pool" );
- WebRequest request = form.getRequest( "save", "Open Pool" );
- request.setParameter( "away1", "Detroit Lions" );
- request.setParameter( "home1", "Denver Broncos" );
- request.setParameter( "home2", "Baltimore Ravens" );
- request.setParameter( "tiebreaker", "3" );
- InvocationContext context = client.newInvocation( request ); // (1) create an invocation context
-
- PoolEditorServlet servlet = (PoolEditorServlet) context.getServlet(); // (2) locate the invoked servlet
- servlet.updateBettingPool( context.getRequest() ); // (3) ask servlet to update the data
- String[] errors = servlet.getValidationErrors(); // (4) ask servlet to check the data
+ form.setParameter( "away1", "Detroit Lions" );
+ form.setParameter( "home1", "Denver Broncos" );
+ form.setParameter( "home2", "Baltimore Ravens" );
+ form.setParameter( "tiebreaker", "3" );
+ WebRequest request = form.getRequest( "save", "Open Pool" ); // (1) select the request object directly
+ InvocationContext context = client.newInvocation( request ); // (2) create an invocation context
+
+ PoolEditorServlet servlet = (PoolEditorServlet) context.getServlet(); // (3) locate the invoked servlet
+ servlet.updateBettingPool( context.getRequest() ); // (4) ask servlet to update the data
+ String[] errors = servlet.getValidationErrors(); // (5) ask servlet to check the data
assertEquals( "Number of errors reported", 2, errors.length );
assertEquals( "First error", "Tiebreaker is not a valid game", errors[0] );
assertEquals( "Second error", "Game 2 has no away team", errors[1] );
}
</pre>
<p>This test starts out like all the others, but once we have created the request, things venture into new territory:<ol>
-<li>Rather than simply asking for the response, we create a context in which we can step through the invocation of the servlet.
+<li>Rather than simply submitting the form, we ask for the request object used to do the submission. This was hidden
+from us in the last test.</li>
+<li>Given the request, we create a context in which we can step through the invocation of the servlet.
This uses the same mechanisms to locate and initialize the servlet, request, and response objects, but does not actually
invoke the servlet to process the request.</li>
<li>We retrieve the initialized servlet and cast it in order to get at its intermediate methods.</li>
@@ -98,28 +100,28 @@
client.setAuthorization( "aUser", "pool-admin" );
WebResponse response = client.getResponse( "http://localhost/PoolEditor" );
WebForm form = response.getFormWithID( "pool" );
- WebRequest request = form.getRequest( "save", "Open Pool" ); // (1) select a submit button
- request.setParameter( "away1", "Detroit Lions" ); // (2) enter bad values into the form
- request.setParameter( "home1", "Denver Broncos" );
- request.setParameter( "home2", "Baltimore Ravens" );
- request.setParameter( "tiebreaker", "3" );
- response = client.getResponse( request ); // (3) submit the form
+ form.setParameter( "away1", "Detroit Lions" ); // (1) enter bad values into the form
+ form.setParameter( "home1", "Denver Broncos" );
+ form.setParameter( "home2", "Baltimore Ravens" );
+ form.setParameter( "tiebreaker", "3" );
- WebTable errorTable = response.getTableStartingWithPrefix( "Cannot ope" ); // (4) Look for error table
+ SubmitButton openButton = getSubmitButton( "save", "Open Pool" ); // (2) select the desired submit button
+ response = form.submit( saveButton ); // (3) submit the form
+
+ WebTable errorTable = response.getTableWithID( "errors" ); // (4) Look for the error table
assertNotNull( "No errors reported", errorTable );
- String[][] cells = errorTable.asText(); // (5) Convert non-empty cells to text
+ String[][] cells = errorTable.asText(); // (5) Convert non-empty cells to text
assertEquals( "Number of error messages provided", 2, cells.length - 1 );
assertEquals( "Error message", "Tiebreaker is not a valid game", cells[1][0] );
assertEquals( "Error message", "Game 2 has no away team", cells[2][0] );
}
</pre>
<p>Note:<ol>
-<li>We select the "Open Pool" button to be included with the form submission.</li>
-<li>We then enter known bad values.</li>
+<li>We enter known bad values.</li>
+<li>We then select the "Open Pool" button to be included with the form submission.</li>
<li>We want the response when we submit the form changes.</li>
-<li>We expect to find them in a table which we can recognize because its upper-leftmost non-empty cell which starts with
-a known string.</li>
+<li>We expect to find them in a table with "errors" as its ID.</li>
<li>Since we want to examine the textual content of any non-empty cells in the table, we ask that the table be converted
to a two-dimensional string array. In this case, there should only be one non-blank cell in each row.</li></ol></p>
@@ -136,7 +138,7 @@
<b>private void</b> reportErrors( PrintWriter pw, String[] errors ) {
- pw.println( "<table width='90%' style='background-color=yellow; " );
+ pw.println( "<table id='errors' width='90%' style='background-color=yellow; " );
pw.println( " border-color: black; border-width: 2; border-style: solid'>" );
pw.println( "<tr><td colspan='2'><b>Cannot open pool for betting:</b></td></tr>" );
<b>for</b> (int i=0; i < errors.length; i++) {
@@ -162,14 +164,13 @@
client.setAuthorization( "aUser", "pool-admin" );
WebResponse response = client.getResponse( "http://localhost/PoolEditor" );
WebForm form = response.getFormWithID( "pool" );
- WebRequest request = form.getRequest( "save", "Open Pool" );
- request.setParameter( "away1", "Detroit Lions" );
- request.setParameter( "home1", "Denver Broncos" );
- request.setParameter( "away3", "Indianapolis Colts" );
- request.setParameter( "home3", "Baltimore Ravens" );
- request.setParameter( "tiebreaker", "3" );
- client.getResponse( request ); // (1) ignore the response
+ form.setParameter( "away1", "Detroit Lions" );
+ form.setParameter( "home1", "Denver Broncos" );
+ form.setParameter( "away3", "Indianapolis Colts" );
+ form.setParameter( "home3", "Baltimore Ravens" );
+ form.setParameter( "tiebreaker", "3" );
+ form.getSubmitButton( "save", "Open Pool" ).click(); // (1) click the submit button
response = client.getResponse( "http://localhost/PoolEditor" ); // (2) retrieve the page separately
form = response.getFormWithID( "pool" );
@@ -183,7 +184,8 @@
}
</pre>
<p>Note:<ol>
-<li>We are not interested in the response this time because we may ultimately have the browser forwarded to the main page.</li>
+<li>Since we are not interested in the response this time (because we may ultimately have the browser forwarded to the main page),
+we simply click the submit button. This does the same as calling form.submit(), but does not return a response value.</li>
<li>We come back to the form as though we were planning on editing it anew.</li>
<li>We want to ensure that the submit buttons are disabled so the user cannot submit the form.</li>
<li>We also verify that the fields are now marked readonly, which would prevent us from changing them. If the
|
|
From: Russell G. <rus...@us...> - 2003-05-18 22:36:42
|
Update of /cvsroot/httpunit/httpunit
In directory sc8-pr-cvs1:/tmp/cvs-serv10734
Modified Files:
site.css
Log Message:
style
Index: site.css
===================================================================
RCS file: /cvsroot/httpunit/httpunit/site.css,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- site.css 18 May 2003 14:14:44 -0000 1.5
+++ site.css 18 May 2003 22:36:39 -0000 1.6
@@ -39,7 +39,18 @@
.developers dd { margin-top: 0; margin-left: 0 }
.story-list dt { margin: 1em 0 0 2em; font-weight: bold }
.story-list dd { margin-left: 2em; margin-top: 0 }
-.sourceforge { text-align: right; position: absolute; top:0; right: 70px }
+.sourceforge { text-align: right;
+ position: absolute;
+ top:0;
+ right: 70px;
+/* Again, the ugly brilliant hack. */
+ voice-family: "\"}\"";
+ voice-family:inherit;
+ right:0px;
+ }
+/* Again, "be nice to Opera 5". */
+body>.sourceforge {right:0px;}
+ }
td.news { border-color: white; background-color: #ccc; padding:0px 2px 2px 2px }
td.summaries { padding: 2px 2px 2px 2px }
|
|
From: Russell G. <rus...@us...> - 2003-05-18 14:15:47
|
Update of /cvsroot/httpunit/httpunit
In directory sc8-pr-cvs1:/tmp/cvs-serv6217
Modified Files:
build.xml
Log Message:
copy style and images on update
Index: build.xml
===================================================================
RCS file: /cvsroot/httpunit/httpunit/build.xml,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -r1.66 -r1.67
--- build.xml 18 May 2003 05:20:45 -0000 1.66
+++ build.xml 18 May 2003 14:15:45 -0000 1.67
@@ -239,8 +239,6 @@
<include name="doc/**/*.*" />
</fileset>
</copy>
- <replace file="${archive.dir}/index.html" token="var:dist " value="var:dist>" />
- <replace file="${archive.dir}/index.html" token="var:publish>" value="var:publish " />
</target>
@@ -282,6 +280,9 @@
<!-- Updates the web site -->
<!-- =================================================================== -->
<target name="update-website" depends="compile-site">
+ <copy todir="${web.dir}">
+ <fileset dir="." includes="site.css,favicon.ico,doc/images/**" />
+ </copy>
<java classname="com.meterware.httpunit.site.WebSite" fork="yes" >
<classpath>
<path refid="base.classpath" />
|
|
From: Russell G. <rus...@us...> - 2003-05-18 14:14:47
|
Update of /cvsroot/httpunit/httpunit/site/com/meterware/website
In directory sc8-pr-cvs1:/tmp/cvs-serv5793/site/com/meterware/website
Modified Files:
Site.java
Log Message:
site cleanup
Index: Site.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/site/com/meterware/website/Site.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Site.java 18 May 2003 13:54:02 -0000 1.3
+++ Site.java 18 May 2003 14:14:44 -0000 1.4
@@ -215,9 +215,10 @@
public void appendPageFooter( StringBuffer sb, WebPage currentPage ) {
if (!currentPage.isLicense()) {
- sb.append( "<hr/><div>" ).append( _copyRight.getNotice() ).append( FragmentTemplate.LINE_BREAK );
+ sb.append( "<hr/><div style='position:relative'>" ).append( FragmentTemplate.LINE_BREAK );
+ sb.append( " <div>" ).append( _copyRight.getNotice() ).append( "</div>" ).append( FragmentTemplate.LINE_BREAK );
if (currentPage.isMainPage()) {
- sb.append( "<div class='sourceforge'>Hosted by <IMG SRC='http://sourceforge.net/sflogo.php?group_id=" );
+ sb.append( " <div class='sourceforge'>Hosted by <IMG SRC='http://sourceforge.net/sflogo.php?group_id=" );
sb.append( _groupId ).append( "&type=1' width='88' height='31' border='0' alt='SourceForge Logo' " );
sb.append( "naturalsizeflag='0' align='TOP'></div>" );
}
|
|
From: Russell G. <rus...@us...> - 2003-05-18 14:14:47
|
Update of /cvsroot/httpunit/httpunit
In directory sc8-pr-cvs1:/tmp/cvs-serv5793
Modified Files:
site.css
Log Message:
site cleanup
Index: site.css
===================================================================
RCS file: /cvsroot/httpunit/httpunit/site.css,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- site.css 18 May 2003 13:53:58 -0000 1.4
+++ site.css 18 May 2003 14:14:44 -0000 1.5
@@ -39,7 +39,7 @@
.developers dd { margin-top: 0; margin-left: 0 }
.story-list dt { margin: 1em 0 0 2em; font-weight: bold }
.story-list dd { margin-left: 2em; margin-top: 0 }
-.sourceforge { text-align: right; position: absolute }
+.sourceforge { text-align: right; position: absolute; top:0; right: 70px }
td.news { border-color: white; background-color: #ccc; padding:0px 2px 2px 2px }
td.summaries { padding: 2px 2px 2px 2px }
|
|
From: Russell G. <rus...@us...> - 2003-05-18 14:14:47
|
Update of /cvsroot/httpunit/httpunit/doc In directory sc8-pr-cvs1:/tmp/cvs-serv5793/doc Removed Files: Javascript-support.html Log Message: site cleanup |
|
From: Russell G. <rus...@us...> - 2003-05-18 13:54:06
|
Update of /cvsroot/httpunit/httpunit/site/com/meterware/website
In directory sc8-pr-cvs1:/tmp/cvs-serv31161/site/com/meterware/website
Modified Files:
Site.java
Log Message:
site cleanup
Index: Site.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/site/com/meterware/website/Site.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Site.java 18 May 2003 13:32:28 -0000 1.2
+++ Site.java 18 May 2003 13:54:02 -0000 1.3
@@ -214,11 +214,14 @@
public void appendPageFooter( StringBuffer sb, WebPage currentPage ) {
- if (!currentPage.isLicense()) sb.append( "<hr/><p>" ).append( _copyRight.getNotice() ).append( FragmentTemplate.LINE_BREAK );
- if (currentPage.isMainPage()) {
- sb.append( "<div class='sourceforge'>Hosted by <IMG SRC='http://sourceforge.net/sflogo.php?group_id=" );
- sb.append( _groupId ).append( "&type=1' width='88' height='31' border='0' alt='SourceForge Logo' " );
- sb.append( "naturalsizeflag='0' align='TOP'></div>" );
+ if (!currentPage.isLicense()) {
+ sb.append( "<hr/><div>" ).append( _copyRight.getNotice() ).append( FragmentTemplate.LINE_BREAK );
+ if (currentPage.isMainPage()) {
+ sb.append( "<div class='sourceforge'>Hosted by <IMG SRC='http://sourceforge.net/sflogo.php?group_id=" );
+ sb.append( _groupId ).append( "&type=1' width='88' height='31' border='0' alt='SourceForge Logo' " );
+ sb.append( "naturalsizeflag='0' align='TOP'></div>" );
+ }
+ sb.append( "</div>" ).append( FragmentTemplate.LINE_BREAK );
}
sb.append( "</div>" ).append( FragmentTemplate.LINE_BREAK );
sb.append( "</body></html>" );
|
|
From: Russell G. <rus...@us...> - 2003-05-18 13:54:05
|
Update of /cvsroot/httpunit/httpunit/doc In directory sc8-pr-cvs1:/tmp/cvs-serv31161/doc Modified Files: Javascript-support.html Log Message: site cleanup Index: Javascript-support.html =================================================================== RCS file: /cvsroot/httpunit/httpunit/doc/Javascript-support.html,v retrieving revision 1.38 retrieving revision 1.39 diff -u -r1.38 -r1.39 --- Javascript-support.html 18 May 2003 05:20:46 -0000 1.38 +++ Javascript-support.html 18 May 2003 13:54:01 -0000 1.39 @@ -647,6 +647,7 @@ -<hr/><p>Copyright © 2000-2003, Russell Gold +<hr/><div>Copyright © 2000-2003, Russell Gold +</div> </div> </body></html> |
|
From: Russell G. <rus...@us...> - 2003-05-18 13:54:04
|
Update of /cvsroot/httpunit/httpunit
In directory sc8-pr-cvs1:/tmp/cvs-serv31161
Modified Files:
site.css
Log Message:
site cleanup
Index: site.css
===================================================================
RCS file: /cvsroot/httpunit/httpunit/site.css,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- site.css 18 May 2003 13:32:28 -0000 1.3
+++ site.css 18 May 2003 13:53:58 -0000 1.4
@@ -39,7 +39,7 @@
.developers dd { margin-top: 0; margin-left: 0 }
.story-list dt { margin: 1em 0 0 2em; font-weight: bold }
.story-list dd { margin-left: 2em; margin-top: 0 }
-.sourceforge { text-align: right; margin-top: -2em }
+.sourceforge { text-align: right; position: absolute }
td.news { border-color: white; background-color: #ccc; padding:0px 2px 2px 2px }
td.summaries { padding: 2px 2px 2px 2px }
|
|
From: Russell G. <rus...@us...> - 2003-05-18 13:32:32
|
Update of /cvsroot/httpunit/httpunit/sitedocs In directory sc8-pr-cvs1:/tmp/cvs-serv19527/sitedocs Modified Files: tutorial.html Log Message: site cleanup Index: tutorial.html =================================================================== RCS file: /cvsroot/httpunit/httpunit/sitedocs/tutorial.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- tutorial.html 18 May 2003 05:20:47 -0000 1.1 +++ tutorial.html 18 May 2003 13:32:29 -0000 1.2 @@ -24,29 +24,30 @@ <p>We will identify the following uses of the system:</p> -<p class="story-name">1.1 Administrator Opens Pool</p> -<p class="story-contents">The administrator defines up to ten games, specifying the home and away team for each game. He also selects one of -these games as the tie-breaker. Once the data is correct, the administrator opens the pool for betting.</p> +<dl class="story-list"><dt>1.1 Administrator Opens Pool</dt> +<dd>The administrator defines up to ten games, specifying the home and away team for each game. He also selects one of +these games as the tie-breaker. Once the data is correct, the administrator opens the pool for betting.</dd> -<p class="story-name">1.2 Administrator Closes Pool</p> -<p class="story-contents">After the pool is open, the administrator may at any time close the pool, thus preventing any -further bets or changes to existing bets.</p> +<dt>1.2 Administrator Closes Pool</dt> +<dd>After the pool is open, the administrator may at any time close the pool, thus preventing any +further bets or changes to existing bets.</dd> -<p class="story-name">1.3 Administrator Posts Results</p> -<p class="story-contents">After the pool is closed, the administrator enters actual scores for each of the games played. -Once all scores have been entered, the administrator posts the results.</p> +<dt>1.3 Administrator Posts Results</dt> +<dd>After the pool is closed, the administrator enters actual scores for each of the games played. +Once all scores have been entered, the administrator posts the results.</dd> -<p class="story-name">2.1 Users enters a bet</p> -<p class="story-contents">After the pool is open, a user may sign on and create a bet, predicting the winner of each game -and the total score of the tie-breaker game. The user may change his bet until the pool is closed.</p> +<dt>2.1 Users enters a bet</dt> +<dd>After the pool is open, a user may sign on and create a bet, predicting the winner of each game +and the total score of the tie-breaker game. The user may change his bet until the pool is closed.</dd> -<p class="story-name">2.2 User views results</p> -<p class="story-contents">Once the results have been posted, a user may examine his own bet to see how well he did. The -system will indicate the correct predictions and the user's rank in the pool.</p> +<dt>2.2 User views results</dt> +<dd>Once the results have been posted, a user may examine his own bet to see how well he did. The +system will indicate the correct predictions and the user's rank in the pool.</dd> -<p class="story-name">2.3 User views standings</p> -<p class="story-contents">Once the results have been posted, a user may view a list of all bidders ranked by number of -correct predictions.</p> +<dt>2.3 User views standings</dt> +<dd>Once the results have been posted, a user may view a list of all bidders ranked by number of +correct predictions.</dd> +</dl> <p>This application is fairly simple, and hardly robust, but contains more than enough interactions to allow us to explore development and testing with HttpUnit. |
|
From: Russell G. <rus...@us...> - 2003-05-18 13:32:32
|
Update of /cvsroot/httpunit/httpunit/site/com/meterware/website
In directory sc8-pr-cvs1:/tmp/cvs-serv19527/site/com/meterware/website
Modified Files:
Site.java
Log Message:
site cleanup
Index: Site.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/site/com/meterware/website/Site.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Site.java 18 May 2003 05:20:47 -0000 1.1
+++ Site.java 18 May 2003 13:32:28 -0000 1.2
@@ -216,9 +216,9 @@
public void appendPageFooter( StringBuffer sb, WebPage currentPage ) {
if (!currentPage.isLicense()) sb.append( "<hr/><p>" ).append( _copyRight.getNotice() ).append( FragmentTemplate.LINE_BREAK );
if (currentPage.isMainPage()) {
- sb.append( "<P class='sourceforge'>Hosted by <IMG SRC='http://sourceforge.net/sflogo.php?group_id=" );
+ sb.append( "<div class='sourceforge'>Hosted by <IMG SRC='http://sourceforge.net/sflogo.php?group_id=" );
sb.append( _groupId ).append( "&type=1' width='88' height='31' border='0' alt='SourceForge Logo' " );
- sb.append( "naturalsizeflag='0' align='TOP'></p>" );
+ sb.append( "naturalsizeflag='0' align='TOP'></div>" );
}
sb.append( "</div>" ).append( FragmentTemplate.LINE_BREAK );
sb.append( "</body></html>" );
|
|
From: Russell G. <rus...@us...> - 2003-05-18 13:32:31
|
Update of /cvsroot/httpunit/httpunit/site/com/meterware/httpunit/site
In directory sc8-pr-cvs1:/tmp/cvs-serv19527/site/com/meterware/httpunit/site
Modified Files:
Developers.java
Log Message:
site cleanup
Index: Developers.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/site/com/meterware/httpunit/site/Developers.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Developers.java 18 May 2003 05:20:47 -0000 1.1
+++ Developers.java 18 May 2003 13:32:28 -0000 1.2
@@ -81,7 +81,7 @@
void appendTo( StringBuffer sb ) {
sb.append( "<h2>" ).append( _type ).append( "</h2>" ).append( LINE_BREAK );
- sb.append( "<dl>" ).append( LINE_BREAK );
+ sb.append( "<dl class='developers'>" ).append( LINE_BREAK );
for (int i = 0; i < _developers.size(); i++) {
Developer developer = (Developer) _developers.get( i );
if (developer.isNameOnly()) {
|
|
From: Russell G. <rus...@us...> - 2003-05-18 13:32:31
|
Update of /cvsroot/httpunit/httpunit
In directory sc8-pr-cvs1:/tmp/cvs-serv19527
Modified Files:
site.css
Log Message:
site cleanup
Index: site.css
===================================================================
RCS file: /cvsroot/httpunit/httpunit/site.css,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- site.css 18 May 2003 05:20:45 -0000 1.2
+++ site.css 18 May 2003 13:32:28 -0000 1.3
@@ -35,12 +35,12 @@
padding:10px;
}
-P.story-name { margin-left: 3em; margin-bottom: 0; font-weight: bold }
-P.story-contents { margin-left: 3em; margin-top: 0 }
-P.sourceforge { text-align: right; margin-top: -2em }
+.developers dt { font-size:120%; font-weight: bold; margin-top: 1em }
+.developers dd { margin-top: 0; margin-left: 0 }
+.story-list dt { margin: 1em 0 0 2em; font-weight: bold }
+.story-list dd { margin-left: 2em; margin-top: 0 }
+.sourceforge { text-align: right; margin-top: -2em }
td.news { border-color: white; background-color: #ccc; padding:0px 2px 2px 2px }
-dt { font-size:120%; font-weight: bold; margin-top: 1em }
-dd { margin-top: 0; margin-left: 0 }
td.summaries { padding: 2px 2px 2px 2px }
#Menu {
|
|
From: Russell G. <rus...@us...> - 2003-05-18 13:01:10
|
Update of /cvsroot/httpunit/httpunit/sitedocs/doc
In directory sc8-pr-cvs1:/tmp/cvs-serv9226/sitedocs/doc
Added Files:
cookbook.html javascript-support.html
Removed Files:
Cookbook.html Javascript-support.html
Log Message:
fix capitalization for unix
--- NEW FILE ---
<HEAD><TITLE>HttpUnit Cookbook</TITLE></HEAD>
<body>
Here is a brief description of how you can use HttpUnit with JUnit to test your own web sites.
<H2>Obtaining a web page response</H2>
The center of HttpUnit is the <A HREF="api/com/meterware/httpunit/WebConversation.html">WebConversation</A> class,
which takes the place of a browser talking to a single site. It is responsible for maintaining session context,
which it does via cookies returned by the server. To use it, one must create a
<A HREF="api/com/meterware/httpunit/WebRequest.html">request</A> and ask the WebConversation for a response.<BR>
For example:
<PRE>
WebConversation wc = <b>new</b> WebConversation();
WebRequest req = <b>new</b> GetMethodWebRequest( "http://www.meterware.com/testpage.html" );
WebResponse resp = wc.getResponse( req );
</PRE>
The <A HREF="api/com/meterware/httpunit/WebResponse.html">response</A> may now be manipulated either as
pure text (via the <CODE>getText()</CODE> method), as a DOM (via the <CODE>getDOM()</CODE> method),
or by using the various other methods described below. Because the above sequence is so common, it can be abbreviated to:
<PRE>
WebConversation wc = <b>new</b> WebConversation();
WebResponse resp = wc.getResponse( "http://www.meterware.com/testpage.html" );
</PRE>
<H2>Examining and following links</H2>
The simplest and most common form of navigation among web pages is via links. HttpUnit allows users to find links
by the text within them, and to use those links as new page requests. For example, this page contains a link to the JavaDoc
for the <CODE>WebResponse</CODE> class, above. That page could therefore be obtained as follows:
<PRE>
WebConversation wc = <b>new</b> WebConversation();
WebResponse resp = wc.getResponse( "http://www.httpunit.org/doc/Cookbook.html" ); // read this page
WebLink link = resp.getLinkWith( "response" ); // find the link
link.click(); // follow it
WebResponse jdoc = wc.getCurrentPage(); // retrieve the referenced page
</PRE>
Image links can be found as well. The <CODE>WebResponse.getLinkWithImageText()</CODE> method can look up links by examining
the ALT text, or the <CODE>HttpUnitOptions.setImagesTreatedAsAltText</CODE> method can cause ALT text to be treated as
ordinary searchable text.
<H2>Using the table structure of a web page</H2>
Many web designers make heavy use of tables to control the page formatting. You can take advantage of this by looking
at the tables in the page as discrete elements. The :<CODE>getTables()</CODE> method will return an array of the top-level
tables in the page (that is, those which are not nested within other tables), in the order in which they appear in the
document. Given a table, you can ask for one of its cells, and treat the result either as text or a DOM or ask for
and tables, links, or forms nested within it. For example, the following code will confirm that the first table in the page
has 4 rows and 3 columns, and that there is a single link in the last cell of the first row:
<PRE>
WebTable table = resp.getTables()[0];
assertEquals( "rows", 4, table.getRowCount() );
assertEquals( "columns", 3, table.getColumnCount() );
assertEquals( "links", 1, table.getTableCell( 0, 2 ).getLinks().length );
</PRE>
In most cases, the purpose of a test is to verify the text, rather than the formatting. HttpUnit provides shortcuts to do this.
For example, imagine that the second table in the page should look like this:
<DIV ALIGN="LEFT">
<TABLE CELLPADDING=1 CELLSPACING=2 WIDTH=150 BORDER=1>
<TR><TH>Name</TH><TH>Color</TH></TR>
<TR><TD>gules</TD><TD>red</TD></TR>
<TR><TD>sable</TD><TD>black</TD></TR>
</TABLE>
</DIV>
<P>The following JUnit code will verify it:<PRE>
String[][] colors = resp.getTables()[1].asText();
assertEquals( "Name", colors[0][0] );
assertEquals( "Color", colors[0][1] );
assertEquals( "gules", colors[1][0] );
assertEquals( "red", colors[1][1] );
assertEquals( "sable", colors[2][0] );
assertEquals( "black", colors[2][1] );
</PRE>
Note that the <CODE>asText()</CODE> method, used to convert an entire table into an array of String ignores all formatting tags.
At times, entire rows or columns of a table may be used for appearance purposes only. You can ignore rows or columns consisting
only of images or empty tags by invoking <CODE>purgeEmptyCells</CODE> on the table.
In many cases, tables begin with some fixed text and the purpose of the test is to verify the dynamic portion. As a general rule,
the first cell will contain something fixed and you can search for it - even if the table is nested inside other tables. Thus,
the above table could have been found with:
<PRE>String[][] colors = resp.getTableStartingWith( "Name" );
</PRE>
which has the advantage of being immune to many page formatting changes which might make it the third or fourth table.
<H2>Working with forms</H2>
<P>A dynamic web site tends to have many html forms, each of which contains various kinds of controls: text boxes, pull-down menus,
radio buttons, and so on. The HTML for these controls vary widely; however, the intent is roughly the same, so HttpUnit
makes them look the same.</P>
<P>There are a few basic things that a tester is likely to want to do with a form. The most obvious first step is to verify the
controls and their default values; if they are correct, the tester will generally make some changes and submit the form to
see how the system responds. HttpUnit makes both tasks easy.</P>
<P>The examples below assume the following form definition:</P>
<TABLE CELLPADDING="3" BORDER="1"><TR><TD><FORM>
Restaurant Name:<INPUT type="text" NAME="Name" VALUE="La Cerentolla"><BR>
Restaurant Type:
<INPUT type="radio" NAME="Food" VALUE="Chinese" CHECKED>Chinese</INPUT>
<INPUT type="radio" NAME="Food" VALUE="TexMex">Tex/Mex</INPUT>
<INPUT type="radio" NAME="Food" VALUE="Italian">Italian</INPUT><BR>
Location:<SELECT NAME="Location"><OPTION VALUE="CenterCity">Center City</OPTION>
<OPTION VALUE="Northeast">Northeast</OPTION><OPTION VALUE="Manayunk" SELECTED>Manayunk</OPTION>
<OPTION VALUE="PennsLanding">Penns Landing</OPTION></SELECT><BR>
<INPUT type="checkbox" NAME="CreditCard" CHECKED>Accepts Credit Cards</INPUT><BR>
<BR><INPUT TYPE="submit" VALUE="Update">
</FORM></TD></TR></TABLE>
The default values may be checked as follows:
<PRE>
WebForm form = resp.getForms()[0]; // select the first form in the page
assertEquals( "La Cerentolla", form.getParameterValue( "Name" ) );
assertEquals( "Chinese", form.getParameterValue( "Food" ) );
assertEquals( "Manayunk", form.getParameterValue( "Location" ) );
assertEquals( "on", form.getParameterValue( "CreditCard" ) );
</PRE>
Note that all controls are treated alike, with the exception of the checkbox.
<P>Simulating the submission of the form can be done most simply by obtaining the form object and calling its 'submit'
method, possibly modifying the form parameters beforehand. For example, to correct the restaurant type and
indicate that it does not accept credit cards:
<PRE>
form.setParameter( "Food", "Italian" ); // select one of the permitted values for food
form.removeParameter( "CreditCard" ); // clear the check box
form.submit(); // submit the form
</PRE>
And of course the test could then proceed to examine the response to this submission as well,
obtaining it from <code>wc.getCurrentPage()</code>.
<H2>Working with frames</H2>
<P>Without frames, web interaction tends to be straightforward and sequential. There is one current active page at a time,
and each new page replaces the old one that referenced it. Frames change that, allowing multiple active pages simultaneously,
and allowing for the possibility that a link from one active page could result in the replacement of a different page.</P>
<P>HttpUnit supports frames by providing methods on the WebConversation class to examine those frames
which are currently active. Each response replaces the contents of the appropriate frame, which is not necessarily
the topmost frame ("_top"). In the following scenation, there are two active subframes, named "overview" and "details":
<PRE>
WebConversation wc = <b>new</b> WebConversation();
WebResponse top = wc.getResponse( "http://www.meterware.com/Frames.html" ); // read a page with two frames
WebResponse summary = wc.getFrameContents( "summary" ); // read the summary frame
WebLink link = summary.getLinkWith( "Cake Recipe" ); // find the link (which targets "details" );
link.click(); // click on it
WebResponse response= wc.getFrameContents( "details" ); // retrieve the details frame
</PRE>
</BODY>
</HTML>
--- NEW FILE ---
<html>
<head><title>JavaScript Support</title></head>
<body>
<p>
JavaScript support is very basic at present. The near-term goal is full JavaScript 1.1 support. Currently, we do not plan
to support browser-specific JavaScript. Please let us know via the mailing list your priorities for missing features.
Inline and included scripts are supported, as are the following DOM elements:
<h2>Window</h2>
<h4>properties</h4>
<ul>
<li>closed - true if the window has been closed</li>
<li>document - the associated Document object</li>
<li>frames - an array of subframes of this window</li>
<li>location - r/w the associated Location object, which may be treated as a URL string</li>
<li>name - r/w the name of the window</li>
<li>navigator - the Navigator object</li>
<li>opener - r/o the window which opened this one (top-level frames only)</li>
<li>parent - the window which is a parent of this one.
<li>self - the Window itself</li>
<li>top - the top frame in the frameset containing this window
<li>window - a synonym for self</li>
<li><name> - the subframe of this window with the specified name
</ul>
<h4>events</h4>
<ul>
<li>onLoad - invoked when the page is loaded</li>
</ul>
<h4>methods</h4>
<ul>
<li>alert() - queues up an alert message, accessible via WebResponse.getNextAlert() or popNextAlert()</li>
<li>close() - closes the window</li>
<li>confirm() - invokes a callback supplied via WebClient.setDialogResponder to return the user's response. By default,
the callback returns true. Users may change this by supplying an implementation of DialogResponder.</li>
<li>prompt() - invokes a callback supplied via WebClient.setDialogResponder to return the user's response</li>
<li>open() - opens a new window. A callback will be generated to any WebWindowListener registered with the client.</li>
</ul>
<h2>Navigator</h2>
<h4>properties</h4>
<ul>
<li>appCodeName - the code name set in ClientProperties.setApplicationCodeName()</li>
<li>appName - the name of the browser, as set in ClientProperties.setApplicationName()</li>
<li>appVersion - the browser version, set in ClientProperties.setApplicationVersion()</li>
<li>plugins - an empty array of objects, since plugins are not universally supported</li>
<li>platform - the platform for the browser, set in ClientProperties.setPlatform (1.2 feature)</li>
<li>userAgent - the name of the user agent, set by ClientProperties.setUserAgent or derived from the code name and version</li>
</ul>
<h4>methods</h4>
<ul>
<li>javaEnabled - always returns false to indicate that applets are not supported</li>
</ul>
<h2>Screen (1.2 feature)</h2>
<h4>properties</h4>
<ul>
<li>availWidth - the available screen width, set in ClientProperties.setAvailableScreenWidth()</li>
<li>availHeight - the available screen height, set in ClientProperties.setAvailableScreenHeight()</li>
</ul>
<h4>methods</h4>
<ul>
<li>javaEnabled - always returns false to indicate that applets are not supported</li>
</ul>
<h2>Location</h2>
<h4>properties</h4>
<ul>
<li>href - r/w the current window location. Setting this value initiates a new request to the server</li>
<li>host - r/o the host and port portion of the current window location</li>
<li>hostname - r/o the host portion of the current window location</li>
<li>port - r/o the port portion of the current window location</li>
<li>protocol - r/o the port portion of the current window location</li>
<li>pathname - r/w the path portion of the current window location. Setting this value initiates a new request to the server</li>
<li>search - r/w the query portion of the current window location. Setting this value initiates a new request to the server</li>
</ul>
<h4>methods</h4>
<ul>
<li>replace - replaces the current window by doing a new request to the server</li>
</ul>
<h2>Document</h2>
<h4>properties</h4>
<ul>
<li>forms - an array of Form objects</li>
<li>images - an array of Image objects</li>
<li>links - an array of Link objects</li>
<li>title - readonly. The title of the page</li>
<li>location - a synonym for window.location</li>
<li>cookie - access to the document-specific cookies.</li>
<li><name> - the name of a form, image, or link</li>
</ul>
<h4>methods</h4>
<ul>
<li>open - opens a document for writing, optionally specifying a MIME type</li>
<li>close - closes the open document and replaces its contents with the written text</li>
<li>getElementById - returns the element in the document with the specified ID</li>
<li>getElementsByName - returns an array of all elements in the document with the specified name</li>
<li>getElementsByTagName - returns an array of all elements in the document with the specified tag name</li>
<li>write - writes a string to the contents of the current open document</li>
<li>writeln - writes a line with carriage-return to the contents of the current open document</li>
</ul>
<h2>HTMLElement</h2>
<h4>properties</h4>
<ul>
<li>title - r/o the title attribute of the element</li>
</ul>
<h2>Form (inherits from HTMLElement)</h2>
<h4>properties</h4>
<ul>
<li>action - r/w the action associated with the form</li>
<li>document - r/o the enclosing document</li>
<li>elements - r/o an array of controls in the form</li>
<li>action - r/w the target for any response from the form</li>
<li><name> - the name of a control in the form</li>
</ul>
<h4>events</h4>
<ul>
<li>onReset - invoked when form.reset() is invoked or a reset button is clicked</li>
<li>onSubmit - invoked when form.submit() is invoked or a submit button is clicked</li>
</ul>
<h4>methods</h4>
<ul>
<li>submit - submits the form</li>
<li>reset - resets the form controls to their default values</li>
<li>getElementsByTagName - returns an array of all elements in the form with the specified tag name</li>
</ul>
<h2>Image</h2>
<h4>properties</h4>
<ul>
<li>src - read/write - the relative URL of the image</li>
</ul>
<h2>Link (inherits from HTMLElement)</h2>
<h4>properties</h4>
<ul>
<li>href - read/write - the URL associated with the link</li>
</ul>
<h4>events</h4>
<ul>
<li>onClick - invoked when link.click() is invoked</li>
<li>onMouseOver - invoked when link.mouseOver() is invoked<li>
</ul>
<h2>Input (inherits from HTMLElement)</h2>
<h4>properties</h4>
<ul>
<li>form - read-only - the form containing the input</li>
<li>name - read-only - the name of the control</li>
</ul>
<h4>methods</h4>
<ul>
<li>focus() - a no-op</li>
</ul>
<h2>Button (inherits from Input)</h2>
<h4>events</h4>
<ul>
<li>onClick - invoked when button.click() is called</li>
</ul>
<h2>Text (inherits from Input)</h2>
<h4>properties</h4>
<ul>
<li>value - read/write - the current text value</li>
</ul>
<h4>events</h4>
<ul>
<li>onChange - invoked when the value of the control is changed via form.setParameter</li>
</ul>
<h2>TextArea (inherits from Input)</h2>
<h4>properties</h4>
<ul>
<li>value - read/write - the current text value</li>
</ul>
<h4>events</h4>
<ul>
<li>onChange - invoked when the value of the control is changed via form.setParameter</li>
</ul>
<h2>Hidden (inherits from Input)</h2>
<h4>properties</h4>
<ul>
<li>value - read/write - the current text value</li>
</ul>
<h2>Password (inherits from Input)</h2>
<h4>properties</h4>
<ul>
<li>value - read/write - the current text value</li>
</ul>
<h4>events</h4>
<ul>
<li>onChange - invoked when the value of the control is changed via form.setParameter</li>
</ul>
<h2>Checkbox (inherits from Input)</h2>
<h4>properties</h4>
<ul>
<li>checked - read/write - the state of the checkbox</li>
<li>defaultChecked - read-only - the default state of the checkbox</li>
<li>value - read/write - the value transmitted if the control is checked</li>
</ul>
<h4>events</h4>
<ul>
<li>onClick - invoked when the state of the control is changed via form.setParameter or form.removeParameter</li>
</ul>
<h2>Radio (inherits from Input)</h2>
<h4>properties</h4>
<ul>
<li>checked - read/write - the state of the radio button</li>
<li>defaultChecked - read-only - the default state of the radio button</li>
<li>value - read/write - the value transmitted if the control is checked</li>
</ul>
<h4>events</h4>
<ul>
<li>onClick - invoked when the state of the control is changed via form.setParameter</li>
</ul>
<h2>Select (inherits from Input)</h2>
<h4>properties</h4>
<ul>
<li>length - read-only - the number of options associated with the control</li>
<li>selectedIndex - read-write - the index of the selected option</li>
<li>options - read-write - an array of the options associated with the control</li>
<li>options.length - read-write - the number of options associated with the control</li>
<li>value - read-write - the value of the selected option</li>
</ul>
<h4>events</h4>
<ul>
<li>onChange - invoked when the value of the control is changed via form.setParameter</li>
</ul>
<h2>Option (inherits from Input)</h2>
<h4>constructor</h4>
You may construct an Option object and assign it to an element in the Select.options array
<h4>properties</h4>
<ul>
<li>text - read-write - the display text associated with the option (listed after the <'option> tag)</li>
<li>value - read-write - the value associated with the option (from the 'value' attribute)</li>
<li>selected - read-write - true if this option is currently selected</li>
<li>defaultSelected - read-only - true if this option is selected by default</li>
<li>index - read-only - the index of this option in its select</li>
</ul>
</body>
</html>
|
|
From: Russell G. <rus...@us...> - 2003-05-18 05:20:51
|
Update of /cvsroot/httpunit/httpunit/sitedocs
In directory sc8-pr-cvs1:/tmp/cvs-serv25966/sitedocs
Added Files:
news.xml site.xml tutorial.html welcome.html
Log Message:
publish new website design
--- NEW FILE ---
<?xml version='1.0' ?>
<news>
<item date="16-May-2003">New web site format created</item>
<item date="2-May-2003" url='http://www.httpunit.org/prerelease/httpunit-1.5.4-d-05May.zip'>Added WebForm.getOptions() support for radio buttons and checkboxes</item>
<item date="4-Apr-2003">HttpUnit 1.5.3 released</item>
</news>
--- NEW FILE ---
<?xml version='1.0' ?>
<site project="HttpUnit" group-id="6550" logo="doc/images/HttpUnit.jpg">
<copyright owner="Russell Gold" dates="2000-2003"/>
<page location="index.html" title="Home" mainPage="true">
<fragment source="sitedocs/welcome.html"/>
<fragment source="sitedocs/news.xml" />
</page>
<page location="doc/license.html" title="License" license="true">
<fragment source="sitedocs/doc/license.html"/>
</page>
<external location="http://prdownloads.sourceforge.net/httpunit/httpunit-1.5.3.zip?download" item="Download 1.5.3"/>
<space/>
<page location="doc/cookbook.html" title="Cookbook">
<fragment source="sitedocs/doc/cookbook.html"/>
</page>
<page location="doc/tutorial/index.html" title="Tutorial">
<fragment source="sitedocs/tutorial.html"/>
</page>
<!-- <external location="doc/manual/index.html" item="User Manual"/> -->
<external location="doc/api/index.html" item="JavaDoc"/>
<page location="doc/faq.html" item="FAQ" title="Frequently Asked Questions">
<fragment source="sitedocs/doc/faq.xml"/>
</page>
<page location="doc/citations.html" title="Citations on the Web" item="External Citations">
<fragment source="sitedocs/doc/citations.xml" />
</page>
<page location="doc/javascript-support.html" item="JavaScript Support" title="JavaScript DOM Elements Supported">
<fragment source="sitedocs/doc/javascript-support.html" />
</page>
<page location="doc/servletunit-intro.html" item="ServletUnit Intro" title="ServletUnit Overview">
<fragment source="sitedocs/doc/servletunit-intro.html" />
</page>
<space/>
<page location="doc/developers.html" title="Developers">
<fragment source="sitedocs/doc/developers.xml" />
</page>
<project-page type="cvs" item="CVS Repository"/>
<external location="http://lists.sourceforge.net/lists/listinfo/httpunit-develop" item="Mailing List"/>
<space/>
<project-page type="bugs" item="Bug Database" />
<project-page type="enhancements" item="Feature Requests" />
</site>
--- NEW FILE ---
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>HttpUnit Tutorial - intro</title>
<LINK REL="stylesheet" HREF="tutorial.css" TYPE="text/css">
</head>
<body>
<p>This tutorial should help you to learn to use HttpUnit to develop and test your web sites. It will take you through the incremental
development of a simple servlet-based web application using a test-first approach. That is, first you are encouraged to
write and execute a test for the next piece of functionality to be added, verify that the test fails (demonstrating that
the functionality is not in place), and then implement the functionality and verify that the test now passes.</p>
<p>The initial tasks will use the <code>ServletRunner</code> class, thus bypassing the need for a web browser or servlet
engine. Later tasks will require a web browser and a servlet engine, and use <code>WebConversation</code>.</p>
<h2>The Application</h2>
<p>Our application is an office sport betting pool. An administrator is designated to manage the pool, which includes
opening and closing the betting. Entrants select the winner in each of the up to 10 games defined by the administrator
and also guess the total score in one of those games, as designated by the administrator. The winner of the pool is the
one who got the most winners correct, with any ties going to the person whose predicted total score in the tie-breaker game
was closest to the actual final score.</p>
<p>We will identify the following uses of the system:</p>
<p class="story-name">1.1 Administrator Opens Pool</p>
<p class="story-contents">The administrator defines up to ten games, specifying the home and away team for each game. He also selects one of
these games as the tie-breaker. Once the data is correct, the administrator opens the pool for betting.</p>
<p class="story-name">1.2 Administrator Closes Pool</p>
<p class="story-contents">After the pool is open, the administrator may at any time close the pool, thus preventing any
further bets or changes to existing bets.</p>
<p class="story-name">1.3 Administrator Posts Results</p>
<p class="story-contents">After the pool is closed, the administrator enters actual scores for each of the games played.
Once all scores have been entered, the administrator posts the results.</p>
<p class="story-name">2.1 Users enters a bet</p>
<p class="story-contents">After the pool is open, a user may sign on and create a bet, predicting the winner of each game
and the total score of the tie-breaker game. The user may change his bet until the pool is closed.</p>
<p class="story-name">2.2 User views results</p>
<p class="story-contents">Once the results have been posted, a user may examine his own bet to see how well he did. The
system will indicate the correct predictions and the user's rank in the pool.</p>
<p class="story-name">2.3 User views standings</p>
<p class="story-contents">Once the results have been posted, a user may view a list of all bidders ranked by number of
correct predictions.</p>
<p>This application is fairly simple, and hardly robust, but contains more than enough interactions to allow us to
explore development and testing with HttpUnit.
<h2>Tutorial Organization</h2>
<p>Each section of the tutorial will address a specific use of the system, and show how HttpUnit and ServletUnit can be used
to write tests which verify that functionality. You should begin each section by copying the initial directory, which includes
an ant build script and some classes that you will need to complete it. Running the ant script will compile the code and
run the tests. If you are not using ant, compile and run tutorial.TutorialTestSuite. After you implement each test,
it should fail until you then add the implementation.</p>
<p>Tasks</p>
<ul>
<li><a href="task1.html">Task 1: Create the pool editor</a>
<li><a href="task2.html">Task 2: Control access to the application</a>
</ul>
</body>
</html>
--- NEW FILE ---
<html>
<body>
<p>Automated testing is a great way to ensure that code being maintained works.
The <A HREF="http://www.XProgramming.com/">Extreme Programming</A> (XP) methodology relies heavily on it,
and practitioners have available to them a range of
<A HREF="http://www.xprogramming.com/software.htm">testing frameworks</A>,
most of which work by making direct calls to the code being tested.
But what if you want to test a web application?
Or what if you simply want to use a web-site as part of a distributed application?</p>
<p>In either case, you need to be able to bypass the browser and access your site from a program.
HttpUnit makes this easy. Written in Java,
HttpUnit emulates the relevant portions of browser behavior, including
form submission, <a href="doc/Javascript-support.html">JavaScript</a>,
basic <A HREF="ftp://ftp.isi.edu/in-notes/rfc2617.txt">http authentication</A>,
cookies and automatic page redirection, and allows
Java test code to examine returned pages either as text, an XML DOM, or containers of forms, tables, and links. When
combined with a framework such as <A HREF="http://www.junit.org">JUnit</a>, it is fairly easy to write tests that very
quickly verify the functioning of a web site.</p>
<p>The same techniques used to test web sites can be used to test and develop servlets without a servlet container
using <A HREF="doc/servletunit-intro.html">ServletUnit</A>, included in the download.</p>
<h2>Documentation</h2>
Several working example files come with the distribution download.
A rudimentary <A HREF="doc/Cookbook.html">Cookbook</A> is available, as are
a <a href="doc/tutorial/index.html">tutorial</a>, a <A HREF="doc/faq.html">FAQ</A> and
the <A HREF="doc/api/index.html">javadoc</A>.
Work has also begun on a <a href="doc/manual/index.html">User's Manual</a>
</body>
</html>
|
|
From: Russell G. <rus...@us...> - 2003-05-18 05:20:51
|
Update of /cvsroot/httpunit/httpunit/doc In directory sc8-pr-cvs1:/tmp/cvs-serv25966/doc Modified Files: Javascript-support.html release_notes.txt Removed Files: Cookbook.html automated-testing.html faq.html favicon.ico license.html servletunit-intro.html Log Message: publish new website design Index: Javascript-support.html =================================================================== RCS file: /cvsroot/httpunit/httpunit/doc/Javascript-support.html,v retrieving revision 1.37 retrieving revision 1.38 diff -u -r1.37 -r1.38 --- Javascript-support.html 2 Apr 2003 15:30:59 -0000 1.37 +++ Javascript-support.html 18 May 2003 05:20:46 -0000 1.38 @@ -1,253 +1,652 @@ -<html> -<head><title>JavaScript Support</title></head> +<html><head><title>HttpUnit JavaScript DOM Elements Supported</title> +<link rel='stylesheet' href='../site.css' type='text/css'> +</head> <body> -<p> +<image src='images/HttpUnit.jpg'/> +<h1>JavaScript DOM Elements Supported</h1> +<div id='Menu'> + <a href='../index.html'>Home</a><br/> + <a href='license.html'>License</a><br/> + <a href='http://prdownloads.sourceforge.net/httpunit/httpunit-1.5.3.zip?download'>Download 1.5.3</a><br/> +<br/> + <a href='cookbook.html'>Cookbook</a><br/> + <a href='tutorial/index.html'>Tutorial</a><br/> + <a href='api/index.html'>JavaDoc</a><br/> + <a href='faq.html'>FAQ</a><br/> + <a href='citations.html'>External Citations</a><br/> + <b>JavaScript Support</b><br/> + <a href='servletunit-intro.html'>ServletUnit Intro</a><br/> +<br/> + <a href='developers.html'>Developers</a><br/> + <a href='http://sourceforge.net/cvs/?group_id=6550'>CVS Repository</a><br/> + <a href='http://lists.sourceforge.net/lists/listinfo/httpunit-develop'>Mailing List</a><br/> +<br/> + <a href='http://sourceforge.net/tracker/?group_id=6550&atid=106550'>Bug Database</a><br/> + <a href='http://sourceforge.net/tracker/?group_id=6550&atid=356550'>Feature Requests</a><br/> +</div> +<div id='Content'> + + + <P> JavaScript support is very basic at present. The near-term goal is full JavaScript 1.1 support. Currently, we do not plan to support browser-specific JavaScript. Please let us know via the mailing list your priorities for missing features. Inline and included scripts are supported, as are the following DOM elements: -<h3>Window</h3> -<h4>properties</h4> -<ul> -<li>closed - true if the window has been closed</li> -<li>document - the associated Document object</li> -<li>frames - an array of subframes of this window</li> -<li>location - r/w the associated Location object, which may be treated as a URL string</li> -<li>name - r/w the name of the window</li> -<li>navigator - the Navigator object</li> -<li>opener - r/o the window which opened this one (top-level frames only)</li> -<li>parent - the window which is a parent of this one. -<li>self - the Window itself</li> -<li>top - the top frame in the frameset containing this window -<li>window - a synonym for self</li> -<li><name> - the subframe of this window with the specified name -</ul> -<h4>events</h4> -<ul> -<li>onLoad - invoked when the page is loaded</li> -</ul> -<h4>methods</h4> -<ul> -<li>alert() - queues up an alert message, accessible via WebResponse.getNextAlert() or popNextAlert()</li> -<li>close() - closes the window</li> -<li>confirm() - invokes a callback supplied via WebClient.setDialogResponder to return the user's response. By default, - the callback returns true. Users may change this by supplying an implementation of DialogResponder.</li> -<li>prompt() - invokes a callback supplied via WebClient.setDialogResponder to return the user's response</li> -<li>open() - opens a new window. A callback will be generated to any WebWindowListener registered with the client.</li> -</ul> - -<h3>Navigator</h3> -<h4>properties</h4> -<ul> -<li>appCodeName - the code name set in ClientProperties.setApplicationCodeName()</li> -<li>appName - the name of the browser, as set in ClientProperties.setApplicationName()</li> -<li>appVersion - the browser version, set in ClientProperties.setApplicationVersion()</li> -<li>plugins - an empty array of objects, since plugins are not universally supported</li> -<li>platform - the platform for the browser, set in ClientProperties.setPlatform (1.2 feature)</li> -<li>userAgent - the name of the user agent, set by ClientProperties.setUserAgent or derived from the code name and version</li> -</ul> -<h4>methods</h4> -<ul> -<li>javaEnabled - always returns false to indicate that applets are not supported</li> -</ul> - -<h3>Screen (1.2 feature)</h3> -<h4>properties</h4> -<ul> -<li>availWidth - the available screen width, set in ClientProperties.setAvailableScreenWidth()</li> -<li>availHeight - the available screen height, set in ClientProperties.setAvailableScreenHeight()</li> -</ul> -<h4>methods</h4> -<ul> -<li>javaEnabled - always returns false to indicate that applets are not supported</li> -</ul> - -<h3>Location</h3> -<h4>properties</h4> -<ul> -<li>href - r/w the current window location. Setting this value initiates a new request to the server</li> -<li>host - r/o the host and port portion of the current window location</li> -<li>hostname - r/o the host portion of the current window location</li> -<li>port - r/o the port portion of the current window location</li> -<li>protocol - r/o the port portion of the current window location</li> -<li>pathname - r/w the path portion of the current window location. Setting this value initiates a new request to the server</li> -<li>search - r/w the query portion of the current window location. Setting this value initiates a new request to the server</li> -</ul> -<h4>methods</h4> -<ul> -<li>replace - replaces the current window by doing a new request to the server</li> -</ul> - -<h3>Document</h3> -<h4>properties</h4> -<ul> -<li>forms - an array of Form objects</li> -<li>images - an array of Image objects</li> -<li>links - an array of Link objects</li> -<li>title - readonly. The title of the page</li> -<li>location - a synonym for window.location</li> -<li>cookie - access to the document-specific cookies.</li> -<li><name> - the name of a form, image, or link</li> -</ul> -<h4>methods</h4> -<ul> -<li>open - opens a document for writing, optionally specifying a MIME type</li> -<li>close - closes the open document and replaces its contents with the written text</li> -<li>getElementById - returns the element in the document with the specified ID</li> -<li>getElementsByName - returns an array of all elements in the document with the specified name</li> -<li>getElementsByTagName - returns an array of all elements in the document with the specified tag name</li> -<li>write - writes a string to the contents of the current open document</li> -<li>writeln - writes a line with carriage-return to the contents of the current open document</li> -</ul> - -<h3>HTMLElement</h3> -<h4>properties</h4> -<ul> -<li>title - r/o the title attribute of the element</li> -</ul> - -<h3>Form (inherits from HTMLElement)</h3> -<h4>properties</h4> -<ul> -<li>action - r/w the action associated with the form</li> -<li>document - r/o the enclosing document</li> -<li>elements - r/o an array of controls in the form</li> -<li>action - r/w the target for any response from the form</li> -<li><name> - the name of a control in the form</li> -</ul> -<h4>events</h4> -<ul> -<li>onReset - invoked when form.reset() is invoked or a reset button is clicked</li> -<li>onSubmit - invoked when form.submit() is invoked or a submit button is clicked</li> -</ul> -<h4>methods</h4> -<ul> -<li>submit - submits the form</li> -<li>reset - resets the form controls to their default values</li> -<li>getElementsByTagName - returns an array of all elements in the form with the specified tag name</li> -</ul> - -<h3>Image</h3> -<h4>properties</h4> -<ul> -<li>src - read/write - the relative URL of the image</li> -</ul> - -<h3>Link (inherits from HTMLElement)</h3> -<h4>properties</h4> -<ul> -<li>href - read/write - the URL associated with the link</li> -</ul> -<h4>events</h4> -<ul> -<li>onClick - invoked when link.click() is invoked</li> -<li>onMouseOver - invoked when link.mouseOver() is invoked<li> -</ul> - -<h3>Input (inherits from HTMLElement)</h3> -<h4>properties</h4> -<ul> -<li>form - read-only - the form containing the input</li> -<li>name - read-only - the name of the control</li> -</ul> -<h4>methods</h4> -<ul> -<li>focus() - a no-op</li> -</ul> - -<h3>Button (inherits from Input)</h3> -<h4>events</h4> -<ul> -<li>onClick - invoked when button.click() is called</li> -</ul> - -<h3>Text (inherits from Input)</h3> -<h4>properties</h4> -<ul> -<li>value - read/write - the current text value</li> -</ul> -<h4>events</h4> -<ul> -<li>onChange - invoked when the value of the control is changed via form.setParameter</li> -</ul> - -<h3>TextArea (inherits from Input)</h3> -<h4>properties</h4> -<ul> -<li>value - read/write - the current text value</li> -</ul> -<h4>events</h4> -<ul> -<li>onChange - invoked when the value of the control is changed via form.setParameter</li> -</ul> - -<h3>Hidden (inherits from Input)</h3> -<h4>properties</h4> -<ul> -<li>value - read/write - the current text value</li> -</ul> - -<h3>Password (inherits from Input)</h3> -<h4>properties</h4> -<ul> -<li>value - read/write - the current text value</li> -</ul> -<h4>events</h4> -<ul> -<li>onChange - invoked when the value of the control is changed via form.setParameter</li> -</ul> - -<h3>Checkbox (inherits from Input)</h3> -<h4>properties</h4> -<ul> -<li>checked - read/write - the state of the checkbox</li> -<li>defaultChecked - read-only - the default state of the checkbox</li> -<li>value - read/write - the value transmitted if the control is checked</li> -</ul> -<h4>events</h4> -<ul> -<li>onClick - invoked when the state of the control is changed via form.setParameter or form.removeParameter</li> -</ul> - -<h3>Radio (inherits from Input)</h3> -<h4>properties</h4> -<ul> -<li>checked - read/write - the state of the radio button</li> -<li>defaultChecked - read-only - the default state of the radio button</li> -<li>value - read/write - the value transmitted if the control is checked</li> -</ul> -<h4>events</h4> -<ul> -<li>onClick - invoked when the state of the control is changed via form.setParameter</li> -</ul> - -<h3>Select (inherits from Input)</h3> -<h4>properties</h4> -<ul> -<li>length - read-only - the number of options associated with the control</li> -<li>selectedIndex - read-write - the index of the selected option</li> -<li>options - read-write - an array of the options associated with the control</li> -<li>options.length - read-write - the number of options associated with the control</li> -<li>value - read-write - the value of the selected option</li> -</ul> -<h4>events</h4> -<ul> -<li>onChange - invoked when the value of the control is changed via form.setParameter</li> -</ul> +</P> + + <H2>Window</H2> + + + <H4>properties</H4> + + + <UL> + + <LI>closed - true if the window has been closed</LI> + + + <LI>document - the associated Document object</LI> + + + <LI>frames - an array of subframes of this window</LI> + + + <LI>location - r/w the associated Location object, which may be treated as a URL string</LI> + + + <LI>name - r/w the name of the window</LI> + + + <LI>navigator - the Navigator object</LI> + + + <LI>opener - r/o the window which opened this one (top-level frames only)</LI> + + + <LI>parent - the window which is a parent of this one. +</LI> + + <LI>self - the Window itself</LI> + + + <LI>top - the top frame in the frameset containing this window +</LI> + + <LI>window - a synonym for self</LI> + + + <LI><name> - the subframe of this window with the specified name +</LI> + </UL> + + + <H4>events</H4> + + + <UL> + + <LI>onLoad - invoked when the page is loaded</LI> + +</UL> + + + <H4>methods</H4> + + + <UL> + + <LI>alert() - queues up an alert message, accessible via WebResponse.getNextAlert() or popNextAlert()</LI> + + + <LI>close() - closes the window</LI> + + + <LI>confirm() - invokes a callback supplied via WebClient.setDialogResponder to return the user's response. By default, + the callback returns true. Users may change this by supplying an implementation of DialogResponder.</LI> + + + <LI>prompt() - invokes a callback supplied via WebClient.setDialogResponder to return the user's response</LI> + + + <LI>open() - opens a new window. A callback will be generated to any WebWindowListener registered with the client.</LI> + +</UL> + + + + <H2>Navigator</H2> + + + <H4>properties</H4> + + + <UL> + + <LI>appCodeName - the code name set in ClientProperties.setApplicationCodeName()</LI> + + + <LI>appName - the name of the browser, as set in ClientProperties.setApplicationName()</LI> + + + <LI>appVersion - the browser version, set in ClientProperties.setApplicationVersion()</LI> + + + <LI>plugins - an empty array of objects, since plugins are not universally supported</LI> + + + <LI>platform - the platform for the browser, set in ClientProperties.setPlatform (1.2 feature)</LI> + + + <LI>userAgent - the name of the user agent, set by ClientProperties.setUserAgent or derived from the code name and version</LI> + +</UL> + + + <H4>methods</H4> + + + <UL> + + <LI>javaEnabled - always returns false to indicate that applets are not supported</LI> + +</UL> + + + + <H2>Screen (1.2 feature)</H2> + + + <H4>properties</H4> + + + <UL> + + <LI>availWidth - the available screen width, set in ClientProperties.setAvailableScreenWidth()</LI> + + + <LI>availHeight - the available screen height, set in ClientProperties.setAvailableScreenHeight()</LI> + +</UL> + + + <H4>methods</H4> + + + <UL> + + <LI>javaEnabled - always returns false to indicate that applets are not supported</LI> + +</UL> + + + + <H2>Location</H2> + + + <H4>properties</H4> + + + <UL> + + <LI>href - r/w the current window location. Setting this value initiates a new request to the server</LI> + + + <LI>host - r/o the host and port portion of the current window location</LI> + + + <LI>hostname - r/o the host portion of the current window location</LI> + + + <LI>port - r/o the port portion of the current window location</LI> + + + <LI>protocol - r/o the port portion of the current window location</LI> + + + <LI>pathname - r/w the path portion of the current window location. Setting this value initiates a new request to the server</LI> + + + <LI>search - r/w the query portion of the current window location. Setting this value initiates a new request to the server</LI> + +</UL> + + + <H4>methods</H4> + + + <UL> + + <LI>replace - replaces the current window by doing a new request to the server</LI> + +</UL> + + + + <H2>Document</H2> + + + <H4>properties</H4> + + + <UL> + + <LI>forms - an array of Form objects</LI> + + + <LI>images - an array of Image objects</LI> + + + <LI>links - an array of Link objects</LI> + + + <LI>title - readonly. The title of the page</LI> + + + <LI>location - a synonym for window.location</LI> + + + <LI>cookie - access to the document-specific cookies.</LI> + + + <LI><name> - the name of a form, image, or link</LI> + +</UL> + + + <H4>methods</H4> + + + <UL> + + <LI>open - opens a document for writing, optionally specifying a MIME type</LI> + + + <LI>close - closes the open document and replaces its contents with the written text</LI> + + + <LI>getElementById - returns the element in the document with the specified ID</LI> + + + <LI>getElementsByName - returns an array of all elements in the document with the specified name</LI> + + + <LI>getElementsByTagName - returns an array of all elements in the document with the specified tag name</LI> + + + <LI>write - writes a string to the contents of the current open document</LI> + + + <LI>writeln - writes a line with carriage-return to the contents of the current open document</LI> + +</UL> + + + + <H2>HTMLElement</H2> + + + <H4>properties</H4> + + + <UL> + + <LI>title - r/o the title attribute of the element</LI> + +</UL> + + + + <H2>Form (inherits from HTMLElement)</H2> + + + <H4>properties</H4> + + + <UL> + + <LI>action - r/w the action associated with the form</LI> + + + <LI>document - r/o the enclosing document</LI> + + + <LI>elements - r/o an array of controls in the form</LI> + + + <LI>action - r/w the target for any response from the form</LI> + + + <LI><name> - the name of a control in the form</LI> + +</UL> + + + <H4>events</H4> + + + <UL> + + <LI>onReset - invoked when form.reset() is invoked or a reset button is clicked</LI> + + + <LI>onSubmit - invoked when form.submit() is invoked or a submit button is clicked</LI> + +</UL> + + + <H4>methods</H4> + + + <UL> + + <LI>submit - submits the form</LI> + + + <LI>reset - resets the form controls to their default values</LI> + + + <LI>getElementsByTagName - returns an array of all elements in the form with the specified tag name</LI> + +</UL> + + + + <H2>Image</H2> + + + <H4>properties</H4> + + + <UL> + + <LI>src - read/write - the relative URL of the image</LI> + +</UL> + + + + <H2>Link (inherits from HTMLElement)</H2> + + + <H4>properties</H4> + + + <UL> + + <LI>href - read/write - the URL associated with the link</LI> + +</UL> + + + <H4>events</H4> + + + <UL> + + <LI>onClick - invoked when link.click() is invoked</LI> + + + <LI>onMouseOver - invoked when link.mouseOver() is invoked</LI> + + <LI> +</LI> + </UL> + + + + <H2>Input (inherits from HTMLElement)</H2> + + + <H4>properties</H4> + + + <UL> + + <LI>form - read-only - the form containing the input</LI> + + + <LI>name - read-only - the name of the control</LI> + +</UL> + + + <H4>methods</H4> + + + <UL> + + <LI>focus() - a no-op</LI> + +</UL> + + + + <H2>Button (inherits from Input)</H2> + + + <H4>events</H4> + + + <UL> + + <LI>onClick - invoked when button.click() is called</LI> + +</UL> + + + + <H2>Text (inherits from Input)</H2> + + + <H4>properties</H4> + + + <UL> + + <LI>value - read/write - the current text value</LI> + +</UL> + + + <H4>events</H4> + + + <UL> + + <LI>onChange - invoked when the value of the control is changed via form.setParameter</LI> + +</UL> + + + + <H2>TextArea (inherits from Input)</H2> + + + <H4>properties</H4> + + + <UL> + + <LI>value - read/write - the current text value</LI> + +</UL> + + + <H4>events</H4> + + + <UL> + + <LI>onChange - invoked when the value of the control is changed via form.setParameter</LI> + +</UL> + + + + <H2>Hidden (inherits from Input)</H2> + + + <H4>properties</H4> + + + <UL> + + <LI>value - read/write - the current text value</LI> + +</UL> + + + + <H2>Password (inherits from Input)</H2> + + + <H4>properties</H4> + + + <UL> + + <LI>value - read/write - the current text value</LI> + +</UL> + + + <H4>events</H4> + + + <UL> + + <LI>onChange - invoked when the value of the control is changed via form.setParameter</LI> + +</UL> + + + + <H2>Checkbox (inherits from Input)</H2> + + + <H4>properties</H4> + + + <UL> + + <LI>checked - read/write - the state of the checkbox</LI> + + + <LI>defaultChecked - read-only - the default state of the checkbox</LI> + + + <LI>value - read/write - the value transmitted if the control is checked</LI> + +</UL> + + + <H4>events</H4> + + + <UL> + + <LI>onClick - invoked when the state of the control is changed via form.setParameter or form.removeParameter</LI> + +</UL> + + + + <H2>Radio (inherits from Input)</H2> + + + <H4>properties</H4> + + + <UL> + + <LI>checked - read/write - the state of the radio button</LI> + + + <LI>defaultChecked - read-only - the default state of the radio button</LI> + + + <LI>value - read/write - the value transmitted if the control is checked</LI> + +</UL> + + + <H4>events</H4> + + + <UL> + + <LI>onClick - invoked when the state of the control is changed via form.setParameter</LI> + +</UL> + + + + <H2>Select (inherits from Input)</H2> + + + <H4>properties</H4> + + + <UL> + + <LI>length - read-only - the number of options associated with the control</LI> + + + <LI>selectedIndex - read-write - the index of the selected option</LI> + + + <LI>options - read-write - an array of the options associated with the control</LI> + + + <LI>options.length - read-write - the number of options associated with the control</LI> + + + <LI>value - read-write - the value of the selected option</LI> + +</UL> + + + <H4>events</H4> + + + <UL> + + <LI>onChange - invoked when the value of the control is changed via form.setParameter</LI> + +</UL> + + + + <H2>Option (inherits from Input)</H2> + + + <H4>constructor</H4> -<h3>Option (inherits from Input)</h3> -<h4>constructor</h4> You may construct an Option object and assign it to an element in the Select.options array -<h4>properties</h4> -<ul> -<li>text - read-write - the display text associated with the option (listed after the <'option> tag)</li> -<li>value - read-write - the value associated with the option (from the 'value' attribute)</li> -<li>selected - read-write - true if this option is currently selected</li> -<li>defaultSelected - read-only - true if this option is selected by default</li> -<li>index - read-only - the index of this option in its select</li> -</ul> -</body> -</html> + <H4>properties</H4> + + + <UL> + + <LI>text - read-write - the display text associated with the option (listed after the <'option> tag)</LI> + + + <LI>value - read-write - the value associated with the option (from the 'value' attribute)</LI> + + + <LI>selected - read-write - true if this option is currently selected</LI> + + + <LI>defaultSelected - read-only - true if this option is selected by default</LI> + + + <LI>index - read-only - the index of this option in its select</LI> + +</UL> + +<hr/><p>Copyright © 2000-2003, Russell Gold +</div> +</body></html> \ No newline at end of file Index: release_notes.txt =================================================================== RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v retrieving revision 1.297 retrieving revision 1.298 diff -u -r1.297 -r1.298 --- release_notes.txt 6 May 2003 13:31:04 -0000 1.297 +++ release_notes.txt 18 May 2003 05:20:46 -0000 1.298 @@ -26,7 +26,7 @@ 3. When setting a selection control, HttpUnit would always select a value matching its first option if possible, rather than taking the first valid value. - 4-Apr-2003 + 4-Apr-2003 1.5.3 Acknowledgements: Thanks to Andrew Bickerton for: correcting the handling of document.open for non-HTML pages and new pages with base tags, @@ -105,7 +105,7 @@ Thanks to Daniel Sheppard for correcting the return status for HttpServletResponse.sendRedirect Thanks to Daniel Sheppard, Navid Vahdat, and Ron Hanson for help in adding capabilities to the RequestDispatcher implementation. Thanks to Ron Hanson for catching the obsolete behavior of HttpServletRequest.setAttribute. - Thanks to Raphael Corre for improving logger of transmitted headers + Thanks to Raphael Corre for improving logging of transmitted headers Thanks to Jason Bedell for supplying an implementation for HttpSession.getValueNames. Thanks to Jianqin Qu for finding the getTableStartingWithPrefix bug when using NekoHTML Thanks to Scott Fleischman for providing tests for missing frame handling functionality |
|
From: Russell G. <rus...@us...> - 2003-05-18 05:20:51
|
Update of /cvsroot/httpunit/httpunit
In directory sc8-pr-cvs1:/tmp/cvs-serv25966
Modified Files:
build.xml site.css
Removed Files:
index.html project.xml
Log Message:
publish new website design
Index: build.xml
===================================================================
RCS file: /cvsroot/httpunit/httpunit/build.xml,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -r1.65 -r1.66
--- build.xml 9 Apr 2003 16:11:23 -0000 1.65
+++ build.xml 18 May 2003 05:20:45 -0000 1.66
@@ -14,6 +14,7 @@
<property name="src.dir" value="src" />
<property name="tstsrc.dir" value="test" />
<property name="examples.dir" value="examples" />
+ <property name="website.dir" value="site" />
<property name="lib.dir" value="lib" />
<property name="jars.dir" value="jars" />
@@ -21,6 +22,7 @@
<property name="build.dir" value="build" />
<property name="build.classes" value="${build.dir}/classes" />
<property name="test.classes" value="${build.dir}/testclasses" />
+ <property name="website.classes" value="${build.dir}/siteclasses" />
<property name="example.classes" value="${build.dir}/examples" />
<property name="javadoc.dir" value="${docs.dir}/api" />
@@ -192,7 +194,7 @@
<javadoc packagenames="${packages}" sourcepath="${basedir}/${src.dir}"
destdir="${javadoc.dir}" author="true" version="true"
windowtitle="${Name} ${version} API" doctitle="${Name}"
- footer="Copyright &copy; 2000-2003 Russell Gold. See <a href="http://www.httpunit.org/doc/license.html">license agreement</A> for rights granted." >
+ footer="Copyright &copy; 2000-2003 Russell Gold. See <a target="_top" href="../license.html">license agreement</A> for rights granted." >
<classpath refid="base.classpath"/>
</javadoc>
</target>
@@ -225,6 +227,8 @@
<include name="build.xml" />
<include name="readme.txt" />
<include name="index.html" />
+ <include name="site.css" />
+ <include name="favicon.ico" />
<include name="src/**" />
<include name="test/**" />
<include name="examples/**" />
@@ -254,11 +258,37 @@
<target name="publish" depends="dist-zip">
<mkdir dir="${web.dir}" />
<copy todir="${web.dir}" >
- <fileset dir="." includes="*.zip,index.html,doc/**"/>
+ <fileset dir="." includes="site.css,favicon.ico,index.html,doc/**"/>
</copy>
- <replace file="${web.dir}/index.html" token="var:dist>" value="var:dist " />
- <replace file="${web.dir}/index.html" token="var:publish " value="var:publish>" />
- <replace file="${web.dir}/index.html" token="<version>" value="${version}" />
+ <antcall target="update-website" />
+</target>
+
+
+<!-- =================================================================== -->
+<!-- Compiles the website generator -->
+<!-- =================================================================== -->
+<target name="compile-site">
+ <mkdir dir="${website.classes}" />
+ <javac srcdir="${website.dir}" destdir="${website.classes}"
+ debug="${debug}" deprecation="${deprecation}" optimize="${optimize}">
+ <classpath>
+ <path refid="base.classpath" />
+ </classpath>
+ </javac>
+</target>
+
+
+<!-- =================================================================== -->
+<!-- Updates the web site -->
+<!-- =================================================================== -->
+<target name="update-website" depends="compile-site">
+ <java classname="com.meterware.httpunit.site.WebSite" fork="yes" >
+ <classpath>
+ <path refid="base.classpath" />
+ <pathelement location="${website.classes}" />
+ </classpath>
+ <arg path="${web.dir}"/>
+ </java>
</target>
Index: site.css
===================================================================
RCS file: /cvsroot/httpunit/httpunit/site.css,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- site.css 1 Apr 2003 16:18:27 -0000 1.1
+++ site.css 18 May 2003 05:20:45 -0000 1.2
@@ -1,19 +1,73 @@
-FORM.sample { margin-left: 2%; margin-right: 2%;
+/* based on a style sheet from www.bluerobot.com/web/layouts */
+
+
+body {
+ background-color:white;
+ }
+h1 {
+ margin:5px 0px 5px 0px;
+ padding:0px;
+ font-size:28px;
+ line-height:28px;
+ font-weight:900;
+ }
+h2 {
+ color:white;
+ background-color:#666699;
+ padding:0px 5px;
+ }
+p {
+ margin:0px 0px 16px 0px;
+ padding:0px;
+ }
+pre { font-family: "courier new", courier; font-size: 8pt;
+ margin-left: 2%; margin-right: 2%;
padding-top: .5em; padding-bottom: .5em; padding-right: .5em; padding-left: .5em;
- background-color: #cccccc; border-color: #0000cc; border-width: 2; border-style: solid }
+ border-color: black; border-width: 2; border-style: solid
+ }
-H2 { padding-left: .5em; padding-top: .1em; padding-bottom: .1 em; margin-bottom: 1em;
- color: white; background-color: #666699; border-width: 2; border-style: solid; border-color: #330066 }
-P.main { padding-left: 3em }
+#Content>p {margin:0px;}
+#Content>p+p {text-indent:30px;}
-SPAN.code { font-family: courier, monospaced, sans-serif }
+#Content {
+ margin:0px 50px 50px 170px;
+ padding:10px;
+ }
-PRE { font-family: "courier new", courier; font-size: 8pt;
- margin-left: 2%; margin-right: 2%;
- padding-top: .5em; padding-bottom: .5em; padding-right: .5em; padding-left: .5em;
- border-color: black; border-width: 2; border-style: solid }
+P.story-name { margin-left: 3em; margin-bottom: 0; font-weight: bold }
+P.story-contents { margin-left: 3em; margin-top: 0 }
+P.sourceforge { text-align: right; margin-top: -2em }
+td.news { border-color: white; background-color: #ccc; padding:0px 2px 2px 2px }
+dt { font-size:120%; font-weight: bold; margin-top: 1em }
+dd { margin-top: 0; margin-left: 0 }
+td.summaries { padding: 2px 2px 2px 2px }
+
+#Menu {
+ position:absolute;
+ top:120px;
+ left:10px;
+ width:172px;
+ padding:10px;
+ font-size:11px;
+ font-family:verdana, arial, helvetica, sans-serif;
+ background-color:#ccc;
+ line-height:17px;
+/* Again, the ugly brilliant hack. */
+ voice-family: "\"}\"";
+ voice-family:inherit;
+ width:150px;
+ }
+/* Again, "be nice to Opera 5". */
+body>#Menu {width:150px;}
+
+
+#Menu a {
+ color:#669;
+ text-decoration:none;
+ font-weight:600;
+ }
+#Menu a:hover {background-color:#eee;}
-PRE.code-examples { background-color: #cccccc }
|