Basic Structure
A source code file may contain a test and/or function definitions. Function definitions are useful for reusing often needed test blocks (e.g. a login sequence).
Syntax |
include "PATH" test "TESTNAME" { session SESSIONNAME1() { section "SECTIONNAME1" { run FUNCTIONNAME1() } } session SESSIONNAME2("USERNAME", "PASSWORD") { } session ("USERNAME", "PASSWORD", location="URL") { } session ("USERNAME", "PASSWORD", location="URL", cookie="name@url=value") { } session (applicationtype="JAVA", clienttype="EXTERNAL", jarfile="apptest-commander.jar", classname="Commander") { } session (applicationtype="JAVA", clienttype="EXTERNAL", jarfile="apptest-mail.jar", classname="Mail") { } session (applicationtype="NATIVE", clienttype="NOTEPAD", location="WINDOWTITLE", options="LOCKED") { } } def FUNCTIONNAME1() { } |
Includes
The keyword include allows the reuse of function definitions stored in other files. Function definition may contain sessions. The paths given are relative to the current file.
Test Definition
The test block can be named and defines a runnable test.
Sessions
A session block can be named and serves as a scope for using a web browser or an external application. The session will be closed at the end of the block which implies, for example, that the web browser instance is closed. The parameters username and password can be defined position-based (position one and two) or as all other allowed parameters as named parameters.
Available parameters:
- username
The user name used for authentication. - password
The password of the user. - location
The URL to be opened or in case of an opened document the window title of the third-party product.
Only needed if the default address of the run configuration should be overwritten. - cookie
Before starting the test, set the specified cookie at the optionally specified URL. When using scenarios, the cookie information for users is available in the returned scenario body. Cookies can be used to log in into a domain with a cookie-based login mechanism. The format of the value is <name>@[<url>]=<value>. - applicationtype
The application that should be used.
Only needed if the default application type of the run configuration should be overwritten.
Possible values:- BROWSER
Used for an installed web browser. - JAVA
Used for a JAR file that provides functionality. - NATIVE
Used for interacting with a third-party application (closing the window).
- clienttype
The client that should be used based on the application type.
Only needed if the default client type of the run configuration should be overwritten.
Possible values:- APPLE_SAFARI, GOOGLE_CHROME, GOOGLE_CHROME_HEADLESS, MICROSOFT_EDGE_CHROMIUM, MOZILLA_FIREFOX, MOZILLA_FIREFOX_HEADLESS
(for application type BROWSER) - EXTERNAL
(for application type JAVA) - NOTEPAD, ACROBAT, WINZIP, OUTLOOK, MAIL, PAGES, NUMBERS, KEYNOTE, THUNDERBIRD, OFFICE, WINWORD, EXCEL, POWERPOINT, OPENOFFICE, AUTOCAD, AUTOCAD_PROJECT
(for application type NATIVE)
- jarfile
Defines the external JAR file (only used for application type JAVA). Fabasoft app.test provides: apptest-commander.jar (mainly file system operations) and apptest-mail.jar (retrieving e-mails from a mailbox). - classname
The object class that provides the methods (only used for application type JAVA). In case of the JAR files described before the usable object classes are: Commander and Mail. - options
Defines whether the opened document is locked (only used for application type NATIVE).
Possible values:
Sections
A section block can be named and allows a logic structuring of the test, which may improve the readability of the test and test result.
Function Definitions
A def block defines a reusable function and facilitates modularization of tests. Function definitions are called using following syntax: run FUNCTIONNAME()