How to do test automation of desktop applications using autoIT



  • We had a task of installing custom addin to Outlook and verifying that the addin was installed correctly.

    The function of addin is to send the mail automatically to higher authority when someone clicks it.

    I was able to automate the entire workflow using autoIT but I am not sure how to validate the steps.

    Is there a way to throw assertions in AutoIt?

    How to integrate with other tools like selenium or protractor to create reports?



  • So i am returning custom status code from the autoIT script if the step passes :

    Here WinActivate returns zero if the step failed ( means the window is not present)

    #include <ScreenCapture.au3>
    Local $Status
    AutoItSetOption('MouseCoordMode',0)
    AutoItSetOption('GUICoordMode',0)
    AutoItSetOption('PixelCoordMode',0)
    
    
    $Status=WinActivate('<window1 title>')
    
    
    ;if successfully opened inbox
    if $Status<>0 Then
    Sleep(1000)
    MouseClick("primary",1071,79)
    Sleep(1000)
    Local $a=WinActivate('<window2 title>')
    
    ;if unsuccessful in opening new mail throw 211
       if $a=0 Then
          Exit 211
    
    ;if successful in opening new send mail throw 0
       Else
          Exit 0
       EndIf
    
    ;if unsuccessfull in opening inbox throw exit code 111
    Else
       Exit 111
    EndIf
    

    Now i call it from protractor:

       it('Validate behavior for {Regression} {Sanity} {Sanity}', async function () {    
    
           const { spawnSync } = require('child_process');   
           let out=spawnSync('<path to autoIT exe>')
           expect(out.status).toBe(0)
    
      });
    


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2