Menu

#2 Initial WebTable and UnitTesting support

open
nobody
None
5
2002-09-24
2002-09-24
No

This is a zip of the entire archive, less jars.
You'll need to perform a diff accross all files/directories
to find the changes.

Here are a few highlights:
0) Added a readme.txt. What directory do you think it
should go in? I just stuck it in the root. This is an
introduction to a developer new to WebUnit.

1) HtmlTablesTest.java exercises the table support that
I've added. There's not much, but it is a solid start. You
can find this tester under the new /webunit/test
directory. See next item for details.

2) Testing framework.
I made a number of additions to build.xml to support the
new testing framework. Also, I left a few message
boxes in one of the unit tests (eagerly awaiting msgbox
support).

It might be helpful to place all the following comments
into a document to make it easy for people to add tests
that flex WebUnit.

The testing framework was mostly copied from
HttpUnit. Thank you, Russell Gold. I left his copyright
and changed the package name to be com.zeborg....
The HttpUnit maillist describes a persistent bug with the
pseudoserver component. Here is Russell Gold's
description of this bug we have now inherited:

"There is an intermittent bug in PseudoServer. When
running tests individually, it often fails on the first test. If
you run it over and over, sometimes it will work on all of
the tests at once. "

In WebUnit, the bug looks like this:
When you run the unit tests with 'ant unittest', you see
Explorer windows. Instead of seeing the first test page
in an Explorer window, you see 'Action Canceled".

On a separate note, AFTER you run the unit tests from
ant (again, using 'ant unittest'), my Win2k does not
return control to the command prompt. You have to Ctrl-
C to get the prompt back. When running WebUnit
from .cmd files, I didn't get this behaviour. Don't know if
this is an Ant or Win2k problem. My ant task looks like
this: <java classname="${test.class}" fork="yes" >

If you just want to run a SINGLE test, and not all the
tests, set this environment variable:

set ANT_OPTS=-
Dtest.class=com.zeborg.webunit.HtmlTablesTest

Then run 'ant unittest'. Just HtmlTablesTest will run.

When adding a new unit test:
a) All unit testers should extend
com.zeborg.webunit.WebUnitTest

b) All unit testers should reside in this directory:
/webunit/test/src/com/zeborg/webunit
FYI, /test/ is a new directory (as of 9/24/2002).

c) If you create a new .java file for a test,
be sure to add a reference to the new class in
WebUnitSuite.

d) to compile the testers,
ant compileunittest

e) to run the tests
ant unittest

f) Html for each test is defined in the unit test .java file.

Discussion

  • Erik Ostermueller

    Erik's WebUnit src enhancements

     
  • Erik Ostermueller

    Logged In: YES
    user_id=180587

    One other important thing.

    I can only think of one of my changes that could possible
    break your stuff: Here it is. Look in
    com.zeborg.webunit.util.htmlparser.tidy.DomHTMLNode#getN
    odeValue().

    Your code returns <myTag>myValue</myTag>.
    My code returns must myValue.

    If you don't like this new behaviour, perhaps
    we'll have to parameterize this so we can
    each have our own ways!

    Another thought: I added junit.jar.

    Here is how I tested things.
    I downloaded the CVS earler today (09/24/2002 12:44p
    central time).

    Then, I overlayed the files in the attached zip to this cvs).
    I compiled and ran. All the new unit tests ran OK.

     
  • Erik Ostermueller

    Logged In: YES
    user_id=180587

    Just remembered. Also added support for double click.

     

Log in to post a comment.