Skip to content

3 TESTAR configuration and settings

Fernando Pastor edited this page Jun 18, 2024 · 2 revisions

TESTAR execution using CLI

All these settings can be added and modified in the specific file test.settings file or used if we launch TESTAR through CLI

test.setting file example:

https://github.com/TESTARtool/TESTAR_dev/blob/master/testar/resources/settings/desktop_generic/test.settings

CLI execution example:

testar sse=desktop_generic ShowVisualSettingsDialogOnStartup=false Sequences=5 SequenceLength=100 Mode=Generate SUTConnectorValue=" ""C:\\Windows\\notepad.exe"" " SuspiciousTitles=".[eE]rror.|.[eE]xcep[ct]ion."

IMPORTANT Inside setting file we use space as ident to declare the values Mode = Generate , but with CLI mode we need to declare the values without space Mode=Generate

TESTAR Protocol to execute

Select a specific protocol to run

sse=desktop_generic

TESTAR GUI Dialog

Enable or disable TESTAR GUI.

ShowVisualSettingsDialogOnStartup = true

TESTAR mode

Set the mode you want TESTAR to start in: Spy, Generate, Replay

Mode = Generate

Connect to the System Under Test (SUT)

Indicate how you want to connect to the SUT:

  1. When SUTConnector is COMMAND_LINE then SUTConnectorValue property must be a command line that starts the SUT.

It should work from a Command Prompt terminal window (e.g. java - jar SUTs/calc.jar ).

For web applications, follow the next format: web_browser_path SUT_URL.

SUTConnector = COMMAND_LINE

SUTConnectorValue = c:\\windows\\system32\\notepad.exe

  1. When SUTConnector is SUT_WINDOW_TITLE the SUTConnectorValue property must be the title displayed in the SUT main window. The SUT must be manually started and closed.

SUTConnector = SUT_WINDOW_TITLE

SUTConnectorValue = Untitled

  1. When SUTConnector is SUT_PROCESS_NAME then SUTConnectorValue property must be the process name of the SUT. The SUT must be manually started and closed.

SUTConnector = SUT_PROCESS_NAME

SUTConnectorValue = notepad.exe

Connect with a multi-processes SUT (Advanced dialog)

Indicate with regular expressions which processes conform to the SUT
This also works for SUTs that invoke the primary process using a launcher

SUTProcesses = .*notepad.exe.*

image

Java Swing & Access Bridge

Activate the Java Access Bridge in your Windows System in order to test Java Swing applications

(Control Panel / Ease of Access / Ease of Access Center / Make the computer easier to see)

Enable the variable Access Bridge Enabled in TESTAR as true

AccessBridgeEnabled = true

Sequences

Number of sequences and the length of these sequences

Sequences = 1

SequenceLength = 100

Oracles based on suspicious titles

Regular expression to detect sequences suspicioustitle

SuspiciousTitles = .*[eE]rror.*|.*[eE]xcepti[o?]n.*

Freeze Oracle

Maximum time TESTAR will wait for an application to respond before throwing the error sequences unresponsive

TimeToFreeze = 30.0

Oracles based on Suspicious Outputs detected by Process Listeners

Requires ProcessListenerEnabled (Only available for desktop applications through COMMAND_LINE)

Regular expression SuspiciousProcessOutput contains the specification of what is considered to be suspicious output.

ProcessListenerEnabled = false

SuspiciousProcessOutput = .*[eE]rror.*|.*[eE]xcep[ct]i[o?]n.*

Process Logs

Requires ProcessListenerEnabled (Only available for desktop applications through COMMAND_LINE)

Allow TESTAR to store execution logs coming from the processes. You can use the regular expression ProcessLogs below to filter the logs. Use .*.* if you want to store all the outputs of the process.

ProcessLogs = .*.*

Actionfilter

Regular expression. More filters can be added in Spy mode, these will be added to the protocol_filter.xml file.

ClickFilter = .*[sS]ave.*|.*[gG]uardar.*|.*[fF]ormat.*|.*[fF]ormatear.*|.*[pP]rint.*|.*[iI]mprimir.*|.*[eE]mail.*|.*[fF]ile.*|.*[aA]rchivo.*|.*[mM]inimize.*|.*[mM]inimizar.*|.*[dD]isconnect.*|.*[dD]esconectar.*

Processfilter

Regular expression. Kill the processes that your SUT can start up but that you do not want to test.

ProcessesToKillDuringTest = firefox.exe

Protocolclass

Indicate the location of the protocol class for your specific SUT, and if you want to always compile the Java protocol file before TESTAR starts is execution.

ProtocolClass = web_generic/Protocol_web_generic

AlwaysCompile = true

State model inference settings

Enable or disable this feature

StateModelEnabled = true

The graph database we use to store the State Model

DataStore = OrientDB

remote mode uses a network connection that allows TESTAR to connect to the database using an IP address.

plocal mode connects to the database at the file level, reading andwriting directly to disk

DataStoreType = remote || DataStoreType = plocal

IP address to connect if we desired to use remote mode

DataStoreServer = localhost

Path of the directory on which local OrientDB exists, if we use plocal mode

DataStoreDirectory = C:\\Users\\testar\\Desktop\\orientdb-3.0.34\\databases

The name of the desired database on which we want to store the State Model. OrientDB allow us to create multiple databases in the same server.

DataStoreDB = testar

User and password credential to authenticate TESTAR

DataStoreUser = testar

DataStorePassword = testar

Indicate how TESTAR should store the model objects in the database (instant, delayed, hybrid, none)

DataStoreMode = instant

Name and version to identify the SUT. This is an important parameter for the State Model because it will determine if we connect with an existing model or if we create a new one

ApplicationName = Notepad

ApplicationVersion = 1

State Model offer an Action Selection mechanism to explore the SUT using random or unvisited actions. This will also need the correct implementation of the protected Action selectAction(State state, Set<Action> actions) method in the Java protocols:

https://github.com/TESTARtool/TESTAR_dev/blob/master/testar/resources/settings/desktop_generic_statemodel/Protocol_desktop_generic_statemodel.java

ActionSelectionAlgorithm = unvisited

Save all widget tree information in the graph database every time TESTAR discovers a new Concrete State.

WARNING This feature needs extra time and memory in the runtime execution.

StateModelStoreWidgets = false

Delete all existing State Models from the selected database before creating a new one.

ResetDataStore = true

State identifier attributes

Specify the widget attributes that you wish to use in constructing the widget and state hash strings. Use a comma separated list.

AbstractStateAttributes = WidgetControlType

Override display scale

Overrides the displayscale obtained from the system.

Can solve problems when the mouse clicks are not aligned with the elements on the screen. This can easily be detected when running the spy mode. For example hover over a text element and the popup window should appear with information about the element, if the popup window is not shown or when the mouse is located somewhere else you can try to override the displayscale Values should be provided as doubles (1.5).

OverrideWebDriverDisplayScale = 1.0

Cutomize TESTAR output folders

OutputDir = ./output

TempDir = ./output/temp

Replay sequence file

Select the desired testar sequence file to be used by Replay Mode

PathToReplaySequence = ./output/temp

Force the SUT to foreground

Force the SUT to be in the foreground of the Desktop. If the SUT is no longer in the foreground, TESTAR will try to use Windows API or ALT+TAB for this purpose

ForceForeground = true

Action time

Customize the Action time in seconds at which an UI action is performed, also the time to wait after executing it

ActionDuration = 0.1

TimeToWaitAfterAction = 0.1

Max Sequence time

Maximum time TESTAR can take to generate a sequence

MaxTime = 3.1536E7

Activate Visualization feature

VisualizeActions = false

VisualizeSelectedAction = true

Max Start SUT time

Maximum time TESTAR will wait for an application to start, after that time an exception will be thrown.

StartupTime = 10.0

QLearning

QLearning values to be used in the desktop_qlearning protocol

MaxReward = 9999999

Discount = .95