1

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?

  • Is your goal to send emails? Why not simply create a CLI program that sends an email via the libraries of your favorite programming language? – João Farias Jan 14 at 23:48
  • @JoãoFarias the software under test is the addin , I am testing the addin – PDHide Jan 15 at 7:03
  • 2
    @PDHide- I have done the same thing using the Winium tool. That can directly integrate into selenium. github.com/2gis/Winium – Updesh Kumar Jan 15 at 9:22
  • @UpdeshKumar Wow thanks for this – PDHide Jan 15 at 10:26
  • @PDHide whats is the exact validation you want to apply? – Muzzamil Jan 15 at 11:15
1

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)

  });
| improve this answer | |
0

I'm not that fluent in AutoIt, but the issue here I see with SMTP and step validation. There is no way you can check different inbox for incoming mails, because mail can be received even few days later (which happens rarely, but specs allows it).

The easy way would be:

  1. Send email via addon
  2. Go to outgoing emails folder in Outlook and check if it's present there with proper outgoing email address.

Assertions in AutoIt are a bit tricky according to their forum post. There are some hand made solutions here and here

There is workaround to use Selenium with AutoIt but it's really painful. One example is provided by guru99 post

| improve this answer | |
  • Hi i am not much concerned about what to validate but, how to validate . For example how to click a button and make sure autoIT script actually clicked or not and fail the script or test if it fails – PDHide Jan 15 at 10:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.