This example runs a scan using a Selenium script for the Explore stage. The same
principles can be applied to any other automation framework.
About this task
A Selenium script is assumed, and port 56232 is used for communication between Selenium and
AppScan Standard. You could of course change these as needed.
Note: In
each code sample, the code added in that step is highlighted in bold.
If you want to work through this example yourself, a folder containing the file used here can be
found in:
[AppScan Standard installation folder]\Docs\Selenium Example
Note: If
the path to your AppScan folder is different, you will need to change the path in the JAR
file.
Procedure
-
Create a TXT file and open it in a text editor.
-
Type in the AppScan command to open AppScan and define the Starting URL, login credentials,
Test Only option, open proxy, and proxy listening port:
START "" "[AppScan Standard installation folder]\AppScanCMD.exe"
/starting_url "https://demo.testfire.net"
/credentials "jsmith:demo1234"
/test_only
/opr
/lp "53262"
Tip: You can add additional commands as needed, such as to define a specific Test
Policy, or create a report (for details, see
CLI).
-
Add a fifteen second timeout batch, to allow AppScan time to open:
START "" "[AppScan Standard installation folder]\AppScanCMD.exe"
/starting_url "https://demo.testfire.net"
/credentials "jsmith:demo1234" /test_only /opr /lp "53262"
timeout /t 15
-
Add your Selenium script:
START "" "[AppScan Standard installation folder]\AppScanCMD.exe"
/starting_url "https://demo.testfire.net"
/credentials "jsmith:demo1234" /test_only /opr /lp "53262"
timeout /t 15
java -jar selenium-server-standalone-2.52.0.jar -trustAllSSLCertificates -htmlSuite
"*firefox" "https://demo.testfire.net" "mytestsuite.html" "results.html"
Important: The Starting URL for Selenium must be identical to the Starting URL in the
AppScan template.
-
Insert into the Selenium script the AppScan proxy port and host to which Selenium will send its
requests:
START "" "[AppScan Standard installation folder]\AppScanCMD.exe"
/starting_url "https://demo.testfire.net"
/credentials "jsmith:demo1234" /test_only /opr /lp "53262"
timeout /t 15
java -Dhttp.proxyHost=localhost -Dhttp.proxyPort=56232 -Dhttps.proxyHost=localhost
-Dhttps.proxyPort=56232 -jar selenium-server-standalone-2.52.0.jar -trustAllSSLCertificates
-htmlSuite "*firefox" "https://demo.testfire.net" "mytestsuite.html" "results.html"
-
Add a command at the end to close the AppScan proxy and start the Test stage:
START "" "[AppScan Standard installation folder]\AppScanCMD.exe" /scan_template
" C:\Users\<username>\Documents\AppScan\QA Automation Demo Template.scant " /test_only /opr /lp
"56232"
timeout /t 15
java -Dhttp.proxyHost=localhost -Dhttp.proxyPort=64345 -Dhttps.proxyHost=localhost
-Dhttps.proxyPort=56232 -jar selenium-server-standalone-2.52.0.jar -trustAllSSLCertificates
-htmlSuite "*firefox" "https://demo.testfire.net" "mytestsuite.html" "results.html"
"[AppScan Standard installation folder]\AppScanCMD.exe" cpr
-
Save the file, and run it using the command line.
Results
Selenium opens and explores the site, then AppScan starts testing. When the scan is
complete, AppScan saves it in the same folder as the batch file.Important: If the
process does not complete for any reason, or if you stop it before it completes, you may find that
your Internet Explorer and Chrome browser proxy settings are changed, and you will need to undo the
change manually.