TextScriptRunner Examples

This document shows examples of the scripting language interpreted by the TextScriptRunner. Note the use of variables (SetVariable) and Include

Test Login

View Script
Script: 472 User: 3 File: testLogin.txt Description: test login to prod

Contents

SetVariable base_url http://textscriptrunner.com/
browse ${base_url}
SetWebOption CookiesEnabled true
click login
set email tester42@textscriptrunner.com
set password **************!
click submitButton

    
Run This Script
� 2022-2025 TextScriptRunner

Test Login Results

Script Results
Home |   My Account |   My Scripts |   Add Script |   Extend Subscription |   Cancel My Subscription |  
|   Help

Script Results



Script: 472 User: 3 File: testLogin.txt Description: test login to prod

Results:

Command Status Result
SetVariable base_url http://textscriptrunner.com/ PASS
browse ${base_url} PASS
SetWebOption CookiesEnabled true PASS
click login PASS
set email tester42@textscriptrunner.com PASS
set password ***********! PASS
click submitButton PASS

© 2022-2025 TextScriptRunner

View a Script

Include testLogin.txt
clicklink viewScript?scriptID=1

View Script Results

Home |   My Account |   Add Script |   Help |   Logout |   Help

Script Results



Script: 68 User: 2 File: testViewScript.txt Description: test view script

Results:

Command Status Result
Include testLogin.txt PASS Included script testLocalLogin.txt
connect http://textscriptrunner.com/ PASS

Welcome to TextScriptRunner

TextScriptRunner - making testing easy since 2001.
The first version was created in 2000/2001 for a project at ThoughtWorks. We created it to help Business Analysts write and execute tests for a large leasing application.
The second version was created in 2005 for Harris Corporation to help test a large Java application to monitor cell phone networks - NetBoss.
The third version is being created based on what we learned building the first 2 versions and adds support for web page testing.
© 2022-2025 TextScriptRunner
ClickLink /login PASS

Login

Enter user name and password:

Email:
Password:

Common Problems:
© 2022-2025 TextScriptRunner
SelectForm getlogin PASS
Email:
Password:
enter email dbuser1@sims.net PASS dbuser1@sims.net
enter password 123 PASS 123
clickButton Login PASS User Info Home | My Account | Add Script | Help | Logout | Help

User Info Page

Welcome : dbuser1



UserName:dbuser1 (ROLE_USER)

Hi dbuser1

Roles:

RoleID Role Name
2 ROLE_USER

Scripts:

ScriptID UserID Filename Description View Script Run Script Delete Script
1 2 testExecutionerConfigFileForCommandEchoMultipleCommands.txt test mult cmds View Run Delete
40 2 teslLogin.txt test login View Run Delete
61 2 testLocalTestPage.txt test local test page View Run Delete
62 2 testLocalComment.txt test comment verb View Run Delete
68 2 testLocalViewScript.txt local view script View Run Delete
76 2 testLocalRunScript.txt local run script View Run Delete
77 2 localIncludeAll.txt local IncludeAll View Run Delete
79 2 testLocalContents.txt test local contents View Run Delete

© 2022-2025 TextScriptRunner
clicklink viewScript?scriptID=1 PASS Home | My Account | Add Script | Help | Logout | Help

View Script

Welcome : dbuser1



    

Script: 1 User: 2 File: testExecutionerConfigFileForCommandEchoMultipleCommands.txt Description: test mult cmds Contents command echo default

© 2022-2025 TextScriptRunner

Run a Script

Include testLogin.txt
comment "this comment is to test that we dont lose the prev exec target"
clicklink runScript?scriptID=1

Run Script Results

Home |   My Account |   Add Script |   Help |   Logout |   Help

Script Results



Script: 76 User: 2 File: testRunScript.txt Description: run script

Results:

Command Status Result
Include testLocalLogin.txt PASS Included script testLogin.txt
connect http://textscriptrunner.com/ PASS

Welcome to TextScriptRunner

TextScriptRunner - making testing easy since 2001.
The first version was created in 2000/2001 for a project at ThoughtWorks. We created it to help Business Analysts write and execute tests for a large leasing application.
The second version was created in 2005 for Harris Corporation to help test a large Java application to monitor cell phone networks - NetBoss.
The third version is being created based on what we learned building the first 2 versions and adds support for web page testing.
© 2022-2025 TextScriptRunner
ClickLink /login PASS

Login

Enter user name and password:

Email:
Password:

Common Problems:
© 2022-2025 TextScriptRunner
SelectForm getlogin PASS
Email:
Password:
enter email dbuser1@sims.net PASS dbuser1@sims.net
enter password 123 PASS 123
clickButton Login PASS User Info Home | My Account | Add Script | Help | Logout | Help

User Info Page

Welcome : dbuser1



UserName:dbuser1 (ROLE_USER)

Hi dbuser1

Roles:

RoleID Role Name
2 ROLE_USER

Scripts:

ScriptID UserID Filename Description View Script Run Script Delete Script
1 2 testExecutionerConfigFileForCommandEchoMultipleCommands.txt test mult cmds View Run Delete
40 2 testLocalLogin.txt localhost login View Run Delete
61 2 testLocalTestPage.txt test local test page View Run Delete
62 2 testLocalComment.txt test comment verb View Run Delete
68 2 testViewScript.txt view script View Run Delete
76 2 testRunScript.txt run script View Run Delete
77 2 IncludeAll.txt IncludeAll View Run Delete
79 2 teslContents.txt test contents View Run Delete

© 2022-2025 TextScriptRunner
comment "this comment is to test that we dont lose the prev exec target" PASS "this comment is to test that we dont lose the prev exec target"
clicklink runScript?scriptID=1 PASS Home | My Account | Add Script | Help | Logout | Help

Script Results



Script: 1 User: 2 File: testExecutionerConfigFileForCommandEchoMultipleCommands.txt Description: test mult cmds

Results:

Command Status Result
command FAIL No Target Specified for Command
echo PASS echo
default PASS default

© 2022-2025 TextScriptRunner

Exercise a Web Page

       
Script: 385 User: 3 File: 3prodTestHtml.txt Description: test test.html in Prod

Contents

INCLUDE 0setDisplayVerbose.txt
#there are a few FAILs in the test to show what a FAIL looks like, so don't stop because of that
INCLUDE 0setAbortOnFailFalse.txt
INCLUDE 1connectProdTestHtml.txt
INCLUDE testTestHtml.txt

which expands to:

       
Script: 385 User: 3 File: 3prodTestHtml.txt Description: test test.html in Prod

Contents

INCLUDE 0setDisplayVerbose.txt
setOption DisplayLevel verbose
#there are a few FAILs in the test to show what a FAIL looks like, so don't stop because of that
INCLUDE 0setAbortOnFailFalse.txt
setOption AbortOnFail false
INCLUDE 1connectProdTestHtml.txt
SetVariable test_base_url http://textscriptrunner.com/test.html
browse ${test_base_url}
INCLUDE testTestHtml.txt
INCLUDE select.txt
set lang de
delay 3
GetValue lang
Validate lang de

INCLUDE validate.txt
select Form PersonalInfo
FAIL validate junk junkiejunk
validate firstname joe
#this next one will fail just to show what a FAIL looks like
validate firstname fred
FAIL validate firstname fred
validate lastname example
set firstname joe
getValue firstname
validate firstname joe
set lastname smith
getValue lastname
validate lastname smith
getValue birthday
# this fails due to date format
set birthday 12/22/1929
set birthday 1929-12-22
getValue birthday
validate birthday 1929-12-22
set email joe@example.com
getValue email
validate email joe@example.com
validate lastname smith
INCLUDE checkboxes.txt
select form checkboxes
Set bike true
GetValue bike
validate bike true
Set car true
getValue car
Validate car true
Click SubmitCheckboxes
select form checkboxes
Set bike false
GetValue bike
Validate bike false
Click SubmitCheckboxes
INCLUDE radiobuttons.txt
select form radiobuttons
getValue female
validate female true
click male
GetValue male
validate male true
Click SubmitRadiobuttons
select form page
INCLUDE popup.txt
ClickAndConfirm AlertButton1
# not needed as handler auto clicks the okay button 
# Click Okay
Click PopupButton
select window PopupWindow
Click CloseButton
INCLUDE popupMultiple.txt
ClickAndConfirm AlertButton1
# not needed as handler auto clicks the okay button 
# Click Okay
Click PopupButton
select window PopupWindow
Click CloseButton
ClickAndConfirm AlertButton1
# not needed as handler auto clicks the okay button 
# Click Okay
Click PopupButton
select window PopupWindow
Click CloseButton
INCLUDE getAndSetCalcValue.txt
select form OutputExample
GetValue a
GetValue b
GetValue myCalcValue
set a 47
GetValue a
validate a 47
# revalidate a
GetValue a
validate a 47
# should check the calc value with validate
GetValue myCalcValue
validate myCalcValue 72
set b 52
GetValue myCalcValue
validate myCalcValue 99

INCLUDE includeCircularA.txt
include includeCircularB.txt
include includeCircularB.txt
FAILED INCLUDE includeCircularB.txt ERROR: Circular include detected in chain: 3prodTestHtml.txt -> testTestHtml.txt -> includeCircularA.txt -> includeCircularB.txt -> includeCircularB.txt
INCLUDE includeCircularB.txt
include includeCircularB.txt
FAILED INCLUDE includeCircularB.txt ERROR: Circular include detected in chain: 3prodTestHtml.txt -> testTestHtml.txt -> includeCircularB.txt -> includeCircularB.txt
INCLUDE includeFail.txt
include NoSuchFileExists.txt
FAILED INCLUDE NoSuchFileExists.txt ERROR: file not found or not readable
INCLUDE failPosAndNeg.txt
select form PersonalInfo
FAIL validate junk junkiejunk
validate firstname joe
#this next one will fail just to show what a FAIL looks like
validate firstname fred
FAIL validate firstname fred
select form page
INCLUDE clickTest.txt
# test a link
click faqLink
back
# maps
click Coffee
verifyContains "by clicking on the coffee cup image"
back
click Phone
verifyContains "by clicking on the phone image"
back
click Computer
verifyContains "by clicking on the computer image"
back
# button 
click reload
INCLUDE setOption.txt
SetOption DisplayLevel NORMAL
SETWebOption JavaScriptEnabled false
SETWebOption CssEnabled false
SETWebOption GeolocationEnabled false
SETWebOption DoNotTrackEnabled true
SETWebOption ThrowExceptionOnScriptError false
SETWebOption ThrowExceptionOnFailingStatusCode false
SETWebOption waitForBackgroundJavaScript 10000
SETWebOption Timeout 20000
SETWebOption JavaScriptEnabled true
SETWebOption CssEnabled true
SETWebOption GeolocationEnabled true
SETWebOption DoNotTrackEnabled false
SETWebOption ThrowExceptionOnScriptError true
SETWebOption ThrowExceptionOnFailingStatusCode true
SETWebOption waitForBackgroundJavaScript 1000
SETWebOption Timeout 2000
delay 2
GETWebOption JavaScriptEnabled
GETWebOption CssEnabled
GETWebOption GeolocationEnabled
GETWebOption DoNotTrackEnabled
GETWebOption ThrowExceptionOnScriptError
GETWebOption ThrowExceptionOnFailingStatusCode
GETWebOption waitForBackgroundJavaScript
GETWebOption Timeout
GETWebOption JavaScriptEnabled
GETWebOption CssEnabled
GETWebOption GeolocationEnabled
GETWebOption DoNotTrackEnabled
GETWebOption ThrowExceptionOnScriptError
GETWebOption ThrowExceptionOnFailingStatusCode
GETWebOption waitForBackgroundJavaScript
GETWebOption Timeout
GETOption DisplayLevel
SetOption Displaylevel VERBOSE

    

Exercise Web Page Results

Script Results
Home |   My Account |   My Scripts |   Add Script |   Extend Subscription |   Cancel My Subscription |  
|   Help

Script Results



Script: 385 User: 3 File: 3prodTestHtml.txt Description: test test.html in Prod

Results:

Command Status Result
INCLUDE 0setDisplayVerbose.txt PASS
setOption DisplayLevel verbose PASS
#there are a few FAILs in the test to show what a FAIL looks like, so don't stop because of that PASS
INCLUDE 0setAbortOnFailFalse.txt PASS
setOption AbortOnFail false PASS
INCLUDE 1connectProdTestHtml.txt PASS
SetVariable test_base_url http://textscriptrunner.com/test.html PASS
browse ${test_base_url} PASS
INCLUDE testTestHtml.txt PASS
INCLUDE select.txt PASS
set lang de PASS
delay 3 PASS
GetValue lang PASS
Validate lang de PASS
INCLUDE validate.txt PASS
select Form PersonalInfo PASS
FAIL validate junk junkiejunk PASS
validate firstname joe PASS
#this next one will fail just to show what a FAIL looks like PASS
validate firstname fred FAIL
FAIL validate firstname fred PASS
validate lastname example PASS
set firstname joe PASS
getValue firstname PASS
validate firstname joe PASS
set lastname smith PASS
getValue lastname PASS
validate lastname smith PASS
getValue birthday PASS
# this fails due to date format PASS
set birthday 12/22/1929 FAIL
set birthday 1929-12-22 PASS
getValue birthday PASS
validate birthday 1929-12-22 PASS
set email joe@example.com PASS
getValue email PASS
validate email joe@example.com PASS
validate lastname smith PASS
INCLUDE checkboxes.txt PASS
select form checkboxes PASS
Set bike true PASS
GetValue bike PASS
validate bike true PASS
Set car true PASS
getValue car PASS
Validate car true PASS
Click SubmitCheckboxes PASS
select form checkboxes PASS
Set bike false PASS
GetValue bike PASS
Validate bike false PASS
Click SubmitCheckboxes PASS
INCLUDE radiobuttons.txt PASS
select form radiobuttons PASS
getValue female PASS
validate female true PASS
click male PASS
GetValue male PASS
validate male true PASS
Click SubmitRadiobuttons PASS
select form page PASS
INCLUDE popup.txt PASS
ClickAndConfirm AlertButton1 PASS
# not needed as handler auto clicks the okay button PASS
# Click Okay PASS
Click PopupButton PASS
select window PopupWindow PASS
Click CloseButton PASS
INCLUDE popupMultiple.txt PASS
ClickAndConfirm AlertButton1 PASS
# not needed as handler auto clicks the okay button PASS
# Click Okay PASS
Click PopupButton PASS
select window PopupWindow PASS
Click CloseButton PASS
ClickAndConfirm AlertButton1 PASS
# not needed as handler auto clicks the okay button PASS
# Click Okay PASS
Click PopupButton PASS
select window PopupWindow PASS
Click CloseButton PASS
INCLUDE getAndSetCalcValue.txt PASS
select form OutputExample PASS
GetValue a PASS
GetValue b PASS
GetValue myCalcValue PASS
set a 47 PASS
GetValue a PASS
validate a 47 PASS
# revalidate a PASS
GetValue a PASS
validate a 47 PASS
# should check the calc value with validate PASS
GetValue myCalcValue PASS
validate myCalcValue 72 PASS
set b 52 PASS
GetValue myCalcValue PASS
validate myCalcValue 99 PASS
INCLUDE includeCircularA.txt PASS
include includeCircularB.txt PASS
include includeCircularB.txt PASS
INCLUDE includeCircularB.txt FAIL
INCLUDE includeCircularB.txt PASS
include includeCircularB.txt PASS
INCLUDE includeCircularB.txt FAIL
INCLUDE includeFail.txt PASS
include NoSuchFileExists.txt PASS
INCLUDE NoSuchFileExists.txt FAIL
INCLUDE failPosAndNeg.txt PASS
select form PersonalInfo PASS
FAIL validate junk junkiejunk PASS
validate firstname joe PASS
#this next one will fail just to show what a FAIL looks like PASS
validate firstname fred FAIL
FAIL validate firstname fred PASS
select form page PASS
INCLUDE clickTest.txt PASS
# test a link PASS
click faqLink PASS
back PASS
# maps PASS
click Coffee PASS
verifyContains 'by clicking on the coffee cup image' PASS
back PASS
click Phone PASS
verifyContains 'by clicking on the phone image' PASS
back PASS
click Computer PASS
verifyContains 'by clicking on the computer image' PASS
back PASS
# button PASS
click reload PASS
INCLUDE setOption.txt PASS
SetOption DisplayLevel NORMAL PASS
SETWebOption JavaScriptEnabled false PASS
SETWebOption CssEnabled false PASS
SETWebOption GeolocationEnabled false PASS
SETWebOption DoNotTrackEnabled true PASS
SETWebOption ThrowExceptionOnScriptError false PASS
SETWebOption ThrowExceptionOnFailingStatusCode false PASS
SETWebOption waitForBackgroundJavaScript 10000 PASS
SETWebOption Timeout 20000 PASS
SETWebOption JavaScriptEnabled true PASS
SETWebOption CssEnabled true PASS
SETWebOption GeolocationEnabled true PASS
SETWebOption DoNotTrackEnabled false PASS
SETWebOption ThrowExceptionOnScriptError true PASS
SETWebOption ThrowExceptionOnFailingStatusCode true PASS
SETWebOption waitForBackgroundJavaScript 1000 PASS
SETWebOption Timeout 2000 PASS
delay 2 PASS
GETWebOption JavaScriptEnabled PASS
GETWebOption CssEnabled PASS
GETWebOption GeolocationEnabled PASS
GETWebOption DoNotTrackEnabled PASS
GETWebOption ThrowExceptionOnScriptError PASS
GETWebOption ThrowExceptionOnFailingStatusCode PASS
GETWebOption waitForBackgroundJavaScript PASS
GETWebOption Timeout PASS
GETWebOption JavaScriptEnabled PASS
GETWebOption CssEnabled PASS
GETWebOption GeolocationEnabled PASS
GETWebOption DoNotTrackEnabled PASS
GETWebOption ThrowExceptionOnScriptError PASS
GETWebOption ThrowExceptionOnFailingStatusCode PASS
GETWebOption waitForBackgroundJavaScript PASS
GETWebOption Timeout PASS
GETOption DisplayLevel PASS
SetOption Displaylevel VERBOSE PASS

© 2022-2025 TextScriptRunner
© 2022-2025 TextScriptRunner