Jump to content

Auto It for executing multiple tests back to back with results(Pass/fail)...


giyer
 Share

Recommended Posts

Can AutoIt be used to run multiple tests back to back and generate a pass/fail results for each of them.

For eg. I am testing a desktop application and have designed test cases for File Menu(Open,New,Save) and Edit Menu(Cut,Copy,Paste). I tried implementing it but found the following issues:

1) AutoIt pauses when a test case fails,it doesnot proceed to next test case.

2) I found no option to generate a pass/fail status for each of them.

Can anyone help me in this regards??

Link to comment
Share on other sites

  • Moderators

giyer,

Welcome to the AutoIt forum. :)

The answer to your question is "almost certainly" - but until we can see your code we cannot really help much more than that. :D

When you post your code please use Code tags - put [autoit] before and [/autoit] after it. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

For your tags, change <autoit> to [autoit], same with end tags.

[/color]
[color=#818181]Opt("WinWaitDelay",100)[/color]
[color=#818181]Opt("WinTitleMatchMode",4)[/color]
[color=#818181]Opt("WinDetectHiddenText",1)[/color]
[color=#818181]Opt("MouseCoordMode",0)[/color]
[color=#818181]WinWait("classname=Shell_TrayWnd","")[/color]
[color=#818181]If Not WinActive("classname=Shell_TrayWnd","") Then WinActivate("classname=Shell_TrayWnd","")[/color]
[color=#818181]WinWaitActive("classname=Shell_TrayWnd","")[/color]
[color=#818181]MouseMove(54,33)[/color]
[color=#818181]MouseDown("left")[/color]
[color=#818181]MouseUp("left")[/color]
[color=#818181]WinWait("Start Menu","")[/color]
[color=#818181]If Not WinActive("Start Menu","") Then WinActivate("Start Menu","")[/color]
[color=#818181]WinWaitActive("Start Menu","")[/color]
[color=#818181]MouseMove(95,200)[/color]
[color=#818181]MouseDown("left")[/color]
[color=#818181]MouseUp("left")[/color]
[color=#818181]WinWait("Untitled - Notepad","")[/color]
[color=#818181]If Not WinActive("Untitled - Notepad","") Then WinActivate("Untitled - Notepad","")[/color]
[color=#818181]WinWaitActive("Untitled - Notepad","")[/color]
[color=#818181]MouseMove(16,38)[/color]
[color=#818181]MouseDown("left")[/color]
[color=#818181]MouseUp("left")[/color]
[color=#818181]MouseMove(21,76)[/color]
[color=#818181]MouseDown("left")[/color]
[color=#818181]MouseUp("left")[/color]
[color=#818181]WinWait("Open","")[/color]
[color=#818181]If Not WinActive("Open","") Then WinActivate("Open","")[/color]
[color=#818181]WinWaitActive("Open","")[/color]
[color=#818181]MouseMove(145,315)[/color]
[color=#818181]MouseDown("left")[/color]
[color=#818181]MouseUp("left")[/color]
[color=#818181]MouseMove(496,368)[/color]
[color=#818181]MouseDown("left")[/color]
[color=#818181]MouseUp("left")[/color]
[color=#818181]WinWait("sample - Notepad","")[/color]
[color=#818181]If Not WinActive("sample - Notepad","") Then WinActivate("sample - Notepad","")[/color]
[color=#818181]WinWaitActive("sample - Notepad","")[/color]
[color=#818181]MouseMove(636,19)[/color]
[color=#818181]MouseDown("left")[/color]
[color=#818181]MouseUp("left")[/color]
[color=#818181]

[/color]
[color=#818181]Opt("WinWaitDelay",100)[/color]
[color=#818181]Opt("WinTitleMatchMode",4)[/color]
[color=#818181]Opt("WinDetectHiddenText",1)[/color]
[color=#818181]Opt("MouseCoordMode",0)[/color]
[color=#818181]WinWait("classname=Shell_TrayWnd","")[/color]
[color=#818181]If Not WinActive("classname=Shell_TrayWnd","") Then WinActivate("classname=Shell_TrayWnd","")[/color]
[color=#818181]WinWaitActive("classname=Shell_TrayWnd","")[/color]
[color=#818181]MouseMove(12,20)[/color]
[color=#818181]MouseDown("left")[/color]
[color=#818181]MouseMove(13,20)[/color]
[color=#818181]MouseUp("left")[/color]
[color=#818181]WinWait("Start Menu","")[/color]
[color=#818181]If Not WinActive("Start Menu","") Then WinActivate("Start Menu","")[/color]
[color=#818181]WinWaitActive("Start Menu","")[/color]
[color=#818181]MouseMove(58,198)[/color]
[color=#818181]MouseDown("left")[/color]
[color=#818181]MouseUp("left")[/color]
[color=#818181]WinWait("Untitled - Notepad","")[/color]
[color=#818181]If Not WinActive("Untitled - Notepad","") Then WinActivate("Untitled - Notepad","")[/color]
[color=#818181]WinWaitActive("Untitled - Notepad","")[/color]
[color=#818181]MouseMove(65,192)[/color]
[color=#818181]MouseDown("left")[/color]
[color=#818181]MouseUp("left")[/color]
[color=#818181]Send("hi")[/color]
[color=#818181]MouseMove(23,35)[/color]
[color=#818181]MouseDown("left")[/color]
[color=#818181]MouseUp("left")[/color]
[color=#818181]MouseMove(36,97)[/color]
[color=#818181]MouseDown("left")[/color]
[color=#818181]MouseUp("left")[/color]
[color=#818181]WinWait("Save As","")[/color]
[color=#818181]If Not WinActive("Save As","") Then WinActivate("Save As","")[/color]
[color=#818181]WinWaitActive("Save As","")[/color]
[color=#818181]Send("new{SPACE}notepad")[/color]
[color=#818181]MouseMove(506,369)[/color]
[color=#818181]MouseDown("left")[/color]
[color=#818181]MouseUp("left")[/color]
[color=#818181]WinWait("new notepad - Notepad","")[/color]
[color=#818181]If Not WinActive("new notepad - Notepad","") Then WinActivate("new notepad - Notepad","")[/color]
[color=#818181]WinWaitActive("new notepad - Notepad","")[/color]
[color=#818181]MouseMove(638,20)[/color]
[color=#818181]MouseDown("left")[/color]
[color=#818181]MouseMove(637,20)[/color]
[color=#818181]MouseUp("left")[/color]

[color=#818181]
Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

ok..here it is

I have used Au3Record 3.1(Scriptwriter) for this purpose:

1) First is the File Open Test.This will open a file already saved in hard disc.

Opt("WinWaitDelay",100)
Opt("WinTitleMatchMode",4)
Opt("WinDetectHiddenText",1)
Opt("MouseCoordMode",0)
WinWait("classname=Shell_TrayWnd","")
If Not WinActive("classname=Shell_TrayWnd","") Then WinActivate("classname=Shell_TrayWnd","")
WinWaitActive("classname=Shell_TrayWnd","")
MouseMove(54,33)
MouseDown("left")
MouseUp("left")
WinWait("Start Menu","")
If Not WinActive("Start Menu","") Then WinActivate("Start Menu","")
WinWaitActive("Start Menu","")
MouseMove(95,200)
MouseDown("left")
MouseUp("left")
WinWait("Untitled - Notepad","")
If Not WinActive("Untitled - Notepad","") Then WinActivate("Untitled - Notepad","")
WinWaitActive("Untitled - Notepad","")
MouseMove(16,38)
MouseDown("left")
MouseUp("left")
MouseMove(21,76)
MouseDown("left")
MouseUp("left")
WinWait("Open","")
If Not WinActive("Open","") Then WinActivate("Open","")
WinWaitActive("Open","")
MouseMove(145,315)
MouseDown("left")
MouseUp("left")
MouseMove(496,368)
MouseDown("left")
MouseUp("left")
WinWait("sample - Notepad","")
If Not WinActive("sample - Notepad","") Then WinActivate("sample - Notepad","")
WinWaitActive("sample - Notepad","")
MouseMove(636,19)
MouseDown("left")
MouseUp("left")

2) Second is to check File is be saved or not.

Opt("WinWaitDelay",100)
Opt("WinTitleMatchMode",4)
Opt("WinDetectHiddenText",1)
Opt("MouseCoordMode",0)
WinWait("classname=Shell_TrayWnd","")
If Not WinActive("classname=Shell_TrayWnd","") Then WinActivate("classname=Shell_TrayWnd","")
WinWaitActive("classname=Shell_TrayWnd","")
MouseMove(12,20)
MouseDown("left")
MouseMove(13,20)
MouseUp("left")
WinWait("Start Menu","")
If Not WinActive("Start Menu","") Then WinActivate("Start Menu","")
WinWaitActive("Start Menu","")
MouseMove(58,198)
MouseDown("left")
MouseUp("left")
WinWait("Untitled - Notepad","")
If Not WinActive("Untitled - Notepad","") Then WinActivate("Untitled - Notepad","")
WinWaitActive("Untitled - Notepad","")
MouseMove(65,192)
MouseDown("left")
MouseUp("left")
Send("hi")
MouseMove(23,35)
MouseDown("left")
MouseUp("left")
MouseMove(36,97)
MouseDown("left")
MouseUp("left")
WinWait("Save As","")
If Not WinActive("Save As","") Then WinActivate("Save As","")
WinWaitActive("Save As","")
Send("new{SPACE}notepad")
MouseMove(506,369)
MouseDown("left")
MouseUp("left")
WinWait("new notepad - Notepad","")
If Not WinActive("new notepad - Notepad","") Then WinActivate("new notepad - Notepad","")
WinWaitActive("new notepad - Notepad","")
MouseMove(638,20)
MouseDown("left")
MouseMove(637,20)
MouseUp("left")

I want to run these two tests back to back and generate a pass or fail result.

The basic idea is to automate the whole Menu Bar functionality tests in a similar manner and obtain a result for each test cases.

This is eventually to be used as a "night build" to perform regression tests in case of further enhacements to the build to reduce human effort involved.

Link to comment
Share on other sites

What represents "Pass" and "Fail" in your eyes? Is it when a window never appears?

Link to comment
Share on other sites

I understand what your end goal is, but still dont know what establishes weather or not the test passed or failed. What happens or dosnt happen that you consider pass/fail? Establish that first, then we can move on to generating a report of the outcome.

Link to comment
Share on other sites

Ok. Each group of code you have should be in a function. this way you can return a 1 or a 0 for weather or not the test passed/failed. For the first case set a timeout for winwaitactive. If the timeout occurs it failed. For the second you could use fileexists() function to see if the file got created.

$open = WinWaitActive("Open","", 5)
If Not $open then
consolewrite('test failed')
return 0
endif
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...