Skip to main content

SWELL/Web - User Guide

Still under construction! Still under construction! Still under construction!

This brief User Guide introduces the available resources, and explains how they can be used to run the examples described or to run your own SWELL/Web scripts.

Prerequisites and Installation

You will need the following resources:

All the files mentioned above should be downloaded into the test directory (the directory that contains your SWELL/Web script files).

Browser-Specific Requirements

In addition to the above, the browser you plan to use may have its own prerequisite requirements. For example, the Chrome browser requires an OS-specific driver that can be downloaded from the Chrome Driver site.

Validation

You can verify that all prerequisite software has been correctly installed by running the validator script (ValidatorScript.txt) as follows.

> swellweb ValidatorScript.txt

In the line above swellweb represents eithier the shell-script of the same name (on UNIX-like systems) or the batch-file swellweb.bat (on Windows). The validator-script file has the following contents.

noBrowsers:
s = Math.sqrt(81);
fail the test with message "Math.sqrt() failing!" if s != 9;

#firefox:
#use firefox;
#go to "http://www.google.com/";
#fail test message "firefox/google malfunction" if the <title> excludes "oogle";

#chromeOnUnix:
#use chrome "chromedriver";
#go to "http://www.google.com/";
#fail test message "chrome/google malfunction" if the <title> excludes "oogle";

chromeOnWindows:
use chrome "chromedriver.exe";
go to "http://www.google.com/";
fail test message "chrome/windows malfunction" if the <title> excludes "oogle";

findPage:
key "english-like dsl for swing & web testing" into the "q" <input>;
wait until any <a> in the "rso" <ol> has it.getAttribute("href").contains("swell.java.net");
pause "Found swell.java.net!";
quit;

The first test (noBrowsers) does not use any browsers, and should run successfully. One of the 3 subsequent tests (firefox, chromeOnUnix, chromeOnWindows) should be uncommented depending on which browser is installed. The last test (findPage) will run provided a browser can be spawned off. You should comment out the tests that are not expected to run. If you need to run Internet Explorer, create a test that spawns off IE. The SWELL/Web Language Manual has further details.

Output

SWELL/Web output is written to standard output, and can be redirected to a file. The output is an XML document with a test element for each test. Each test contains a failure element for each test failure. Output from print statements, and tracing is written to standard error.

SWELL Example

A more elaborate SWELL/Web script that uses a browser to search for the SWELLWebLanguageManual.html file on the web is also available, and should be downloaded as SWELLWebHelloWorld.txt. The script file has several commented-out sections for different browser/OS combinations. The appropriate section for your OS/browser should be uncommented before use.

Running your own SWELL/Web Tests

To create a new SWELL test script proceed as follows:

Users should be aware that the parser's error-reporting capability is currently rudimentary, and the error messages are sometimes not very helpful. However we expect to improve this aspect progressively.

 
 
Close
loading
Please Confirm
Close