giyer Posted December 28, 2011 Posted December 28, 2011 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??
Moderators Melba23 Posted December 28, 2011 Moderators Posted December 28, 2011 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. When you post your code please use Code tags - put [autoit] before and [/autoit] after it. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
JohnOne Posted December 28, 2011 Posted December 28, 2011 Does this work? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
JohnOne Posted December 28, 2011 Posted December 28, 2011 (edited) For your tags, change <autoit> to [autoit], same with end tags.expandcollapse popup[/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]expandcollapse popup[/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 December 28, 2011 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
giyer Posted December 28, 2011 Author Posted December 28, 2011 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. expandcollapse popupOpt("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. expandcollapse popupOpt("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.
Zedna Posted December 28, 2011 Posted December 28, 2011 Look at WinMenuSelectItem() Resources UDF ResourcesEx UDF AutoIt Forum Search
giyer Posted December 29, 2011 Author Posted December 29, 2011 Could you explain how it can be used for the above purpose..Also how it can be used to generate a pass/fail result...
Beege Posted December 29, 2011 Posted December 29, 2011 What represents "Pass" and "Fail" in your eyes? Is it when a window never appears? Assembly Code: fasmg . fasm . BmpSearch . Au3 Syntax Highlighter . Bounce Multithreading Example . IDispatchASMUDFs: Explorer Frame . ITaskBarList . Scrolling Line Graph . Tray Icon Bar Graph . Explorer Listview . Wiimote . WinSnap . Flicker Free Labels . iTunesPrograms: Ftp Explorer . Snipster . Network Meter . Resistance Calculator
giyer Posted December 29, 2011 Author Posted December 29, 2011 its like how QTP(Quick test) generates a report on how many tests passed/ failed on executing. So that i can run multiple tests at night and get results in the morning..
Beege Posted December 29, 2011 Posted December 29, 2011 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. Assembly Code: fasmg . fasm . BmpSearch . Au3 Syntax Highlighter . Bounce Multithreading Example . IDispatchASMUDFs: Explorer Frame . ITaskBarList . Scrolling Line Graph . Tray Icon Bar Graph . Explorer Listview . Wiimote . WinSnap . Flicker Free Labels . iTunesPrograms: Ftp Explorer . Snipster . Network Meter . Resistance Calculator
giyer Posted December 29, 2011 Author Posted December 29, 2011 ok..i get it. for 1st case, when u click File->Open, if Open dialog doesnt appear its Fail. for 2nd case,if file dosnt get saved its a Fail.
Beege Posted December 29, 2011 Posted December 29, 2011 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 Assembly Code: fasmg . fasm . BmpSearch . Au3 Syntax Highlighter . Bounce Multithreading Example . IDispatchASMUDFs: Explorer Frame . ITaskBarList . Scrolling Line Graph . Tray Icon Bar Graph . Explorer Listview . Wiimote . WinSnap . Flicker Free Labels . iTunesPrograms: Ftp Explorer . Snipster . Network Meter . Resistance Calculator
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now