Default Command Set

Describe Describes this test case using formatted text.

Requires version 1.1

Descibes this test case using formatted text (incl. links).

Parameters

markdown
The description formatted using the Markdown notation.
Wetator uses the Txtmark markdown processor. Please check the Txtmark page for more details.

Examples

Add a simple description to a test case.

Command Parameter Optional Parameter
describe # Happy path walktrough for our registration workflow.
**Use case:** [Register User](https://www.wetator.org/use-cases/register-user)

You are now reading a more detailed description of this test case.
.... ....

Your resulting report will look like this.

Open URL Open a given URL in the current window.

Open a given URL in the current window.

Parameters

url
Specifies the URL to open (required).
May be absolute or relative to the configured base URL (see examples).

Examples

Open a page by using a relative URL

Config (wetator.properties)
wet.baseUrl=https://www.wetator.org

Open url 'https://www.wetator.org/commands/openurl.html'.

Command Parameter Optional Parameter
open-url commands/openurl.html
assert-title WETATOR / Open Url
Use Module Calls another test and executes all commands as part of this test.

Calls another test and executes all commands as part of this test.

Parameters

module
The (absolute or relative) path of the module.
When using relative paths, they are always relative to the callers file location.
parameters
The parameters (comma separated) to be used when executing the given module. They can be accessed by their index within the module, e.g. the first parameter as ${1}.
If a parameter contains a comma, precede it with a backslash.

Examples

Use a module that performs the login.

The caller

Call a module that performs the login. The first login is done with user/secret, the second login with admin/master and the last one uses some variables defined in config.properties.

Command Parameter Optional Parameter
use-module modules/login.wet user, secret
...
use-module modules/login.wet admin, master
...
use-module modules/login.wet ${usr}, ${pwd}
The called module
Command Parameter Optional Parameter
open-url myapp.html
assert-title MyApp / Login
set User Id ${1}
set Password ${2}
click-on Login
assert-title MyApp / Home
assert-content Welcome ${1}
The config file
Config (wetator.properties)
...
$usr=tester
$$pwd=accurate
Click On Click with the mouse on the specified element.

Click with the mouse on the specified element.
Use this for clicking buttons and links.

If you like to tick a checkbox, select a radio button or choose an item from a list, use the Select command instead.

Parameters

wpath
The WPath identifying the control to click on (see WPath for a detailed description).
It is possible to use the '*' and the '?' character als wildcards; '*' matches zero or many characters; '?' matches one single character.
It is also possible to define a > separated list of words (with '*' and '?' if needed). Then this command clicks on the first clickable element after all these words.

Examples

Click a button

Click on a button labled 'Search'.

Command Parameter Optional Parameter
click-on Search

Click an anchor

Click on an anchor labled 'Show details'.

Command Parameter Optional Parameter
click-on Show details
Click Double On Double click with the mouse on the specified element.

Double click with the mouse on the specified element.

Parameters

wpath
The WPath identifying the control to double click on (see WPath for a detailed description).
It is possible to use the '*' and the '?' character als wildcards; '*' matches zero or many characters; '?' matches one single character.
It is also possible to define a > separated list of words (with '*' and '?' if needed). Then this command clicks on the first double clickable element after all these words.

Examples

Double click an entry field

Double click on an entry field labled 'Name'.

Command Parameter Optional Parameter
click-double-on Name
Click Right On Right click with the mouse on the specified element.

Right click with the mouse on the specified element.

Parameters

wpath
The WPath identifying the control to right click on (see WPath for a detailed description).
It is possible to use the '*' and the '?' character als wildcards; '*' matches zero or many characters; '?' matches one single character.
It is also possible to define a > separated list of words (with '*' and '?' if needed). Then this command clicks on the first double clickable element after all these words.

Examples

Right click an entry field

Right click on an entry field labled 'Name'.

Command Parameter Optional Parameter
click-right-on Name
Confirm Next Prepares the processing of the next confirmation dialog.

Prepares the processing of the next confirmation dialog.
If your application makes usage of confirmation dialogs (javascript: res=window.confirm(question);), by default WETATOR will close those by clicking the 'OK' button.
Use this command to assert the expected description or to click the 'Cancel' button instead.

Parameters

button
The button to click; only 'OK' and 'Cancel' are allowed here.
message
The text to match against the confirmation dialog.
If the confirmation text of the next dialog does not match, the command that started the dialog (usually a clock-on) will fail. It is possible to use the '*' and the '?' character as wildcards; '*' matches zero or many characters; '?' matches one single character.
It is also possible to define a comma separated list of words (with '*' and '?' if needed). Then this command checks, that the words in the defined order are parts of the page title.
If your assertion contains a comma, star, or question mark, precede it with a backslash.

Examples

The application uses a dialog to get a confirmation from the user.

In this sample the click on the Delete button will open the confirmation dialog and the application deletes all the data only if the user confirms by clicking 'OK'.

Command Parameter Optional Parameter
confirm-next OK Do you really like to delete all data?
click-on Delete
assert-content All date deleted.

If you like to test the correct implementation for the case where the user clicks the cancel button do it like this.

Command Parameter Optional Parameter
confirm-next Cancel Do you really like to delete all data?
click-on Delete
assert-content Nothing deleted.
Set Sets the value of an entry field.

Sets the value of an entry field.
Use this to set the value of an input field, a password field or a text area. This commands also supports the file input field (for file upload).

Parameters

wpath
The WPath identifying the control (see WPath for a detailed description).
Input Field, Password Field, Text Area, File Upload
The path is usually the label of the field.
It is possible to use the '*' and the '?' character als wildcards; '*' matches zero or many characters; '?' matches one single character.
It is also possible to define a > separated list of words (with '*' and '?' if needed). Then this command sets the value of the first element after all these words.
value
The new value to set.
Input Field, Password Field, Text Area
The new value for the field. Leave this empty to clean the field.
File Upload
The file name (relativ to the location of the test source file).

Examples

Set the value of an input field

Set the value of an input field labeled 'Your profession' to 'WebApp Tester'.

Command Parameter Optional Parameter
set Your profession Wetator

You can also clear the input field labeled 'Your profession'.

Command Parameter Optional Parameter
set Your profession

Set the value of a file upload control

Set the value of a file upload control labeld 'Upload your resume' to 'my_resume.pdf'.
File 'my_resume.pdf' is in the same directory folder as the test script.

Command Parameter Optional Parameter
set Upload your resume my_resume.pdf
click-on Submit
assert-content Wow! What an impressive resume.

With modern browsers the entry field for the file name is no longer visible. The set command works the same way.

Command Parameter Optional Parameter
set Please find attached my resume my_resume.pdf
click-on Submit
assert-content Wow! What an impressive resume.

More sophisticated control libraries (like PrimeFaces) are adding a lot more decoration to the file upload control. But the usage from your Wetator test is still the same.

Command Parameter Optional Parameter
set Choose upload.png
click-on Upload
assert-content Thanks for the nice picture.
Select Selects an entry from a list.

Selects an entry from a list.
Use this to select options from a single or multiple select list, a group of radio buttons or select a checkbox.

Parameters

wpath
The WPath identifying the item to select (see WPath for a detailed description).
Check Box
Use the text usually placed after the checkbox you like to select. If this text is not unique you can as always define some words before to make the path unique.
Radio Group
Use the label of the radio button you like to select. If this text is not unique you can as always define some words before to make the path unique.
Single Select Box
Usually you can select an option from a list simply by using the text of that option.
If the same option is member of different lists use the label of the select box, a > and then the text of the option to select.
Multiple Select Box
To make more than one selection in a multiple select box, use more than one Select call.
It is possible to use the '*' and the '?' character als wildcards; '*' matches zero or many characters; '?' matches one single character.
It is also possible to define a > separated list of words (with '*' and '?' if needed). Then this command selects the first element after all these words.

Examples

Select a check box

Select the checkbox 'documentation' from the list of possible improvements.

Command Parameter Optional Parameter
select documentation

 

Select a radio button

Select the radio button 'American Express' from the payment options.

Command Parameter Optional Parameter
select American Express

 

Select an entry from a list box

Select the amount of 100€.

Command Parameter Optional Parameter
select 100€
Deselect Deselects an entry from a list.

Deselects an entry from a list.
Use this to deselect options from a single or multiple select list, a group of radio buttons or deselect a checkbox.

Keep in mind, that radio groups are not deselectable. So this command doesn't search for radio buttons.

Parameters

wpath
The WPath identifying the item to deselect (see WPath for a detailed description).
Single Select Box
The path is usually the label of the select box, a > and then the text of the option to deselect.
Multiple Select Box
To make more than one selection in a multiple select box, use more than one Deselect call.
Check Box
Use the text usually placed after the checkbox you like to deselect. If this text is not unique you can as always define some words before to make the path unique.
It is possible to use the '*' and the '?' character als wildcards; '*' matches zero or many characters; '?' matches one single character.
It is also possible to define a > separated list of words (with '*' and '?' if needed). Then this command deselects the first element after all these words.

Examples

Deselect an entry from a select box

Deselect the color named 'red' from a select box labled 'Choose color'.

Command Parameter Optional Parameter
deselect Choose color> red
Close Window Close the current window or close a window by name.

Close the current window or close a window by name.

Parameters

name
The name of the window to close.
Leave this empty to close the current window.

Examples

Close the topmost window

Close the topmost window.

Command Parameter Optional Parameter
click-on Open Dialog
close-window
Mouse Over Moves the mouse over the specified item.

Moves the mouse over the specified item.
Use this e.g. to simulate the use of menus that are only visible if the mouse is over some text.

Parameters

wpath
The 'path' to the item to select (see WPath for a detailed description).
It is possible to use the '*' and the '?' character als wildcards; '*' matches zero or many characters; '?' matches one single character.
It is also possible to define a > separated list of words (with '*' and '?' if needed). Then this command selects the first element after all these words.

Examples

Place the mouse over an menu entry

Place the mouse over a pull down menu entry named 'File'.

Command Parameter Optional Parameter
mouse-over File
assert-content File, Save, Save As, Exit
Go Back Goes back in the current window using the back button.

Goes back in the current window using the back button.

Parameters

steps
The number of steps to go back (default: 1)
Assert Title Assert that the page title matches the given one.

Assert that the page title matches the given one.

Parameters

title
The text to match (see Content Pattern for a detailed description).
It is possible to use the '*' and the '?' character as wildcards; '*' matches zero or many characters; '?' matches one single character.
It is also possible to define a comma separated list of words (with '*' and '?' if needed). Then this command checks, that the words in the defined order are parts of the page title.
You can also check the title of PDF documents.
wait
The (optional) timeout in seconds used for waiting for javascript events. This is helpful for pages working with setTimeout javascript command or doing some AJAX polling for e.g. search results.

Examples

Check the whole title

Check for the whole title.

Command Parameter Optional Parameter
open-url commands/openurl.html
assert-title WETATOR / Open Url
Assert Content Assert that the content matches the given one.

Asserts that the current page contains the expected content.

Parameters

content
The text to match (see Content Pattern for a detailed description).
It is possible to use the '*' and the '?' character as wildcards; '*' matches zero or many characters; '?' matches one single character.
It is also possible to define a comma separated list of words (with '*' and '?' if needed). Then this command checks, that the words in the defined order are parts of the content.
At the moment content of type text, html/xhtml, pdf, rtf, xls, xlsx and docx are supported.
wait
The (optional) timeout in seconds used for waiting for javascript events. This is helpful for pages working with setTimeout javascript command or doing some AJAX polling for e.g. search results.

Examples

Check for a single word on a page

Check for a single word on a page.

Command Parameter Optional Parameter
open-url commands/openurl.html
assert-content Gurkensalat
Assert Enabled Asserts, that an item is enabled and not readonly.

Asserts, that an item is enabled and not readonly.

Parameters

wpath
The WPath identifying the item to check (see WPath for a detailed description).
Input Field, Password Field, Text Area, File Upload
The path is usually the label of the field.
Single Select Box, Multiple Select Box
The path is usually the label of the select box, a > and then the text of the option to check.
Radio Group
Use the label of the radio button you like to select. If this text is not unique you can as always define some words before to make the path unique.
Check Box
Use the text usually placed after the checkbox you like to select. If this text is not unique you can as always define some words before to make the path unique.
It is possible to use the '*' and the '?' character als wildcards; '*' matches zero or many characters; '?' matches one single character.
It is also possible to define a > separated list of words (with '*' and '?' if needed). Then this command checks the first element after all these words.

Examples

Assert that an entry field is enabled

Assert that the entry field labled 'Color' is enabled.

Command Parameter Optional Parameter
assert-enabled Color
Assert Disabled Asserts, that an item is disabled or readonly.

Asserts, that an item is disabled or readonly.

Parameters

wpath
The WPath identifying the item to check (see WPath for a detailed description).
Input Field, Password Field, Text Area, File Upload
The path is usually the label of the field.
Single Select Box, Multiple Select Box
The path is usually the label of the select box, a > and then the text of the option to check.
Radio Group
Use the label of the radio button you like to select. If this text is not unique you can as always define some words before to make the path unique.
Check Box
Use the text usually placed after the checkbox you like to select. If this text is not unique you can as always define some words before to make the path unique.
It is possible to use the '*' and the '?' character als wildcards; '*' matches zero or many characters; '?' matches one single character.
It is also possible to define a > separated list of words (with '*' and '?' if needed). Then this command checks the first element after all these words.

Examples

Assert that an entry field is disabled

Assert that the entry field labled 'Color' is disabled.

Command Parameter Optional Parameter
assert-disabled Color
Assert Set Assert that the value of an entry field matches the given one.

Assert that the value of an entry field matches the given one.
Use this to check the value of an input field, a password field or a text area.

Parameters

wpath
The WPath identifying the entry field (see WPath for a detailed description).
Input Field, Password Field, Text Area
The path is usually the label of the field.
It is possible to use the '*' and the '?' character als wildcards; '*' matches zero or many characters; '?' matches one single character.
It is also possible to define a > separated list of words (with '*' and '?' if needed). Then this command checks the value of the first element after all these words.
If your assertion contains a comma, star, or question mark, precede it with a backslash.
value
The expected value.

Examples

Check the content of an entry field

Check the content of an entry field.

Command Parameter Optional Parameter
assert-set Color blue
Assert Selected Asserts, that an entry from a list is selected.

Asserts, that an entry from a list is selected.
Use this to check the selection from a single or multiple select list, a group of radio buttons or select a checkbox.

Parameters

wpath
The WPath identifying the item to select (see WPath for a detailed description).
Single Select Box
The path is usually the label of the select box, a > and then the text of the option to check.
Multiple Select Box
To make more than one selection in a multiple select box, use more than one Assert Select call.
Radio Group
Use the label of the radio button you like to select. If this text is not unique you can as always define some words before to make the path unique.
Check Box
Use the text usually placed after the checkbox you like to check. If this text is not unique you can as always define some words before to make the path unique.
It is possible to use the '*' and the '?' character als wildcards; '*' matches zero or many characters; '?' matches one single character.
It is also possible to define a > separated list of words (with '*' and '?' if needed). Then this command checks the first element after all these words.

Examples

Assert, that an entry from a select box is selected

Assert, that the color named 'red' from a select box labled 'Choose color' is selected.

Command Parameter Optional Parameter
assert-selected Choose color> red
Assert Deselected Asserts, that an entry from a list is deselected.

Asserts, that an entry from a list is deselected.
Use this to check the selection from a single or multiple select list, a group of radio buttons or select a checkbox.

Parameters

wpath
The WPath identifying the item to check (see WPath for a detailed description).
Single Select Box
The path is usually the label of the select box, a > and then the text of the option to check.
Multiple Select Box
To make more than one selection in a multiple select box, use more than one Assert Select call.
Radio Group
Use the label of the radio button you like to select. If this text is not unique you can as always define some words before to make the path unique.
Check Box
Use the text usually placed after the checkbox you like to check. If this text is not unique you can as always define some words before to make the path unique.
It is possible to use the '*' and the '?' character als wildcards; '*' matches zero or many characters; '?' matches one single character.
It is also possible to define a > separated list of words (with '*' and '?' if needed). Then this command checks the first element after all these words.

Examples

Assert, that an entry from a select box is deselected

Assert, that the color named 'red' from a select box labled 'Choose color' is deselected.

Command Parameter Optional Parameter
assert-deselected Choose color> red
Exec Java Executes the defined java method.

Executes the defined java method.

Parameters

method
The name of the class and method to be executed.
Wetator first searches for static methods with the given name.
Wetator searches for methods
  • with the same number of string parameters as strings given by the second parameter
  • with exactly one parameter of type List<String> or
  • with a vararg of type string.
If nothing found then Wetator looks for a default constructor and if one is available, Wetator creates an instance and performs the same lookup for instance methods.
args
The parametes for the method call.
It is possible to provide a comma separated list of strings.

Classpath

Of course you have to add your class (and all required classes) to the classpath. For the command line client simply copy the jar file into the lib directory. If you start wetator from inside eclipse, adjust the run configuration. For the ant task, you can define a separate classpath containing your stuff. The ant task uses a separate class loader to load your classes and shield your classes from the ant environment.

Examples

Execute a static method

Call the static method 'staticMethodWithTwoParams(String, String)' in class 'org.rbri.wet.commandset.ExecTester'

Command Parameter Optional Parameter
exec-java org.rbri.wet.commandset.ExecTester.staticMethodWithTwoParams one, two