Download
automated web testing command line scripting interface n.
Skip this Video
Loading SlideShow in 5 Seconds..
Automated Web Testing Command-Line & Scripting Interface PowerPoint Presentation
Download Presentation
Automated Web Testing Command-Line & Scripting Interface

Automated Web Testing Command-Line & Scripting Interface

207 Views Download Presentation
Download Presentation

Automated Web Testing Command-Line & Scripting Interface

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. Automated Web TestingCommand-Line &Scripting Interface

  2. Command Line Interface Typical uses: • Use macro with batch file • Integrate with Windows task scheduler • Integrate with thousands of other software packages Commands: • Start the macro: -macro <macroname> • Send values to macro: -var_myvar <x> • Repeat macro: -loop <x> • Keep IM Browser open: -noexit • Run in background: -tray / -silent • Example: –macro test –var_myvar Hello[SP]World

  3. Command Line Interface (cont’d) Take values from the command line: CMDLINE !VAR1 http://www.iOpus.com/iim Check on the return value: The Internet Macros executable "imacros.exe" set the predefined batch file variable "%ERRORLEVEL%". The value is either 1 if the macro was completed successfully or negative if an error was encountered.

  4. Example Batch File "C:\IIM\imacros.exe" -macro Demo-FillForm -loop 3 if %errorlevel% == 1 goto ok if NOT %errorlevel% == 1 goto error :ok echo Macro completed succesfully! goto end :error echo Error encountered during replay. echo Errorcode=%errorlevel% :end The batch variable %errorlevel% is set by "imacros.exe" upon exit

  5. Demo Project • Set up a test macro that runs once a day and saves the CNN.com home page to a file: The task scheduler can be accessed via the Windows Control Panel

  6. Scripting Interface Why use the Scripting Interface? • Works with any Windows Scripting or programming language • Simple but powerful set of commands • Detailed error handling • Windows OS includes Windows Scripting Host (WSH) • Easy database access

  7. The six most important commands: set iim1= CreateObject (“iMacros") i = iim1.iimInit (“”) i = iim1.iimDisplay("This is a test") i = iim1.iimSet("-var_name1", "Tom Tester") i = iim1.iimPlay(“Test1") If i > 0 Then s = "Everything OK” Else s = iim1.iimGetLastError() MsgBox s i = iim1.iimExit

  8. Error Return Codes All functions return a value > 0 if they succeed, and an error code < 0 in case of problems. Error codes below -100 are error codes generated during the macro replay. Same code as when macro is run manually. -1 Macro timeout (Macro takes too long to run) -2 IIM Interface timeout (IM browser does not respond) -3 User pressed STOP button -4 Communication error (should not happen) -5 Browser closed (User pressed EXIT button)

  9. VB6 with Intellisense Support In order to enable Intellisense support, you need to add the „IInternetMacros“ component to your project („Early binding“). The alternative is to use CreateObject („Late Binding“, no Intellisense support) Add iMacros COM object Intellisense in action…

  10. Demo Projects • Performance Monitoring • Create response time measurement macro, and return the data to your script for further processing. Use {{!STOPWATCHTIME}} to return the measured time. • Use a script to alert you when response time is above threshold • Create Google News Extractor: • Submit keyword search to Google News • Extract headlines from returned search results • Store headlines in text file • Click NEXT link until all results are extracted