51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 3430|回复: 3
打印 上一主题 下一主题

silktest中脚本文件?

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2005-10-19 15:33:24 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
谁能提供一份简单的脚本文件看一下啊!!

[ Last edited by web_web_ on 2005-10-20 at 13:53 ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

该用户从未签到

4#
发表于 2006-7-25 11:01:16 | 只看该作者
谢谢楼主
回复 支持 反对

使用道具 举报

该用户从未签到

3#
 楼主| 发表于 2005-10-25 11:44:55 | 只看该作者

非常感谢

谢谢sincky
回复 支持 反对

使用道具 举报

该用户从未签到

2#
发表于 2005-10-24 22:00:09 | 只看该作者
给你提供一个脚本,希望对你有所参考:

[ ]  //        File: TestAceMenu.t
[ ] //  *******************************************************************************
[ ] //         Project:        AutoCAD Electrical
[ ] //
[ ] //        Revision History:
[ ] //        Release        day-mon-year        Name                        Comment
[ ] // --------------------------------------------------------------------------------
[ ] //                1        26-03-2004                Sijin Mathews        Created framework for ACE Menu Testing
[ ] // --------------------------------------------------------------------------------
[ ]
[ ]
[ ] boolean bCreateBaseline = FALSE
[ ] string sBaselineLocation = "S:\TEST SUITES\Data\Menu\"
[ ]
[ ]
[+] testcase CheckAppMenu()
        [ ]
        [ ] List of Window lwSomething = AppWnd.GetChildren()
        [ ]
        [ ] // remove all other objects other than menus
        [ ] int i
        [+] for (i=1; i<=ListCount(lwSomething); i++)
                [+] if !lwSomething[i].IsOfClass(Menu)
                        [ ] ListDelete(lwSomething, i)
                        [ ] i--
                        [ ]
        [ ]
        [ ] // remove the system menu. usually the first
        [+] for (i=1; i<=ListCount(lwSomething); i++)
                [+] if lwSomething[i] == AppWnd.Menu1
                        [ ] ListDelete(lwSomething, i)
                        [ ] break
                        [ ]
        [ ]
        [ ] // remove menu other than those specified to be looked up
        [+] for (i=1; i<=ListCount(lwSomething); i++)
                [+] if ListFind(lsMenus2Chk,lwSomething[i]) == 0
                        [ ] ListDelete(lwSomething, i)
                        [ ] i--
                        [ ]
        [ ]
        [ ] Print("******************************")
        [ ] Print("***** Menus Being Tested *****")
        [ ]
        [ ] ListPrint(lwSomething)
        [ ] Print("******************************")
        [ ]
        [ ] MakeFolder(sBaselineLocation)
        [ ] CheckMenu(lwSomething, bCreateBaseline)
        [ ]
[ ]
[ ] // boolean for current status of open drawing file
[ ] boolean bNewDwg = True
[+] CheckMenu(List of Window lwSomething, boolean bCreateBaseline optional)
        [ ]
        [+] if bCreateBaseline == NULL
                [ ] bCreateBaseline = false
        [ ]
        [ ] // look up each of the menus and their submenus
        [ ] int iCounter = 1
        [+] while iCounter<=ListCount(lwSomething)
                [+] do
                        [ ]
                        [+] if (!AppWnd.Exists())
                                [ ] BaseState()
                                [ ]
                        [ ]
                        [+] if !bNewDwg
                                [ ] ThisDwg.New ()
                                [ ] SetBaseProject()
                                [ ]
                                [ ] ThisDwg.TypeE ("cmddia")
                                [ ] ThisDwg.TypeE ("1")
                                [ ] ThisDwg.TypeE ("FileDia")
                                [ ] ThisDwg.TypeE ("1")
                                [ ]
                                [ ] // ThisDwg.TypeE ("SDI")
                                [ ] // ThisDwg.TypeE ("0")
                                [ ]
                                [ ] bNewDwg = True
                                [ ]
                        [ ]
                        [ ] window object = lwSomething[iCounter]
                        [ ]
                        [ ] // if some initialization steps are required, perform them
                        [+] do
                                [ ] object.PreMenu()
                                [ ]
                        [+] except
                                [ ] // do nothing
                                [ ]  
                        [ ]
                        [ ] // if menu is enabled
                        [+] if object.IsEnabled()
                                [ ]
                                [ ] // if there are no further submenus
                                [+] if(object.GetChildren()=={})
                                        [ ]
                                        [ ] object.Pick()
                                        [ ]
                                        [ ] Print("Testcase {object}_{Harness.LangCode()}")
                                        [ ] Print("****************** Enteriing testcase {object} ****************")
                                        [ ]
                                        [ ]
                                        [+] do
                                                [ ]
                                                [+] do
                                                        [ ] object.PostMenu()
                                                        [ ]
                                                [+] except
                                                        [ ]
                                                [+] if (AlertDlg.Exists ())
                                                        [ ] AlertDlg.OK.Click ()
                                                        [ ]
                                                [ ] // baseline mode
                                                [+] if bCreateBaseline
                                                        [ ] CreateBaseline(sBaselineLocation, object)
                                                        [ ]
                                                [ ] // verification mode
                                                [+] else
                                                        [ ] DoVerification(sBaselineLocation, object)
                                                        [ ]
                                                [ ]
                                        [+] except
                                                [ ] LogError("The {object} menu option failed.")
                                                [ ] ExceptClear()
                                                [ ]
                                        [ ]
                                        [ ] bNewDwg= False
                                        [ ] Print("Exit testcase {object}_{Harness.LangCode()} !!!!!!!!!!!!!!!!!!!!!!!!!")
                                        [ ]
                                        [ ] Sleep(3)
                                        [ ] // dismiss any dialog present
                                        [+] while true
                                                [ ]
                                                [ ] WINDOW wWindow = Desktop.GetActive ()
                                                [+] if (wWindow!= AppWnd)
                                                        [ ] wWindow.Close (TRUE)
                                                        [ ]
                                                [+] else
                                                        [ ] break
                                                        [ ]
                                                [ ]
                                        [ ] // exit any active command
                                        [+] while true
                                                [+] if (!ThisDwg.ReadyForNextCommand ())
                                                        [ ] AppWnd.TypeKeys ("<ESC>")
                                                        [ ]
                                                [+] else
                                                        [ ] break
                                                        [ ]
                                        [ ]
                                        [ ]
                                [ ]
                                [ ] // else recursively seek them out
                                [+] else
                                        [ ] CheckMenu(object.GetChildren(),bCreateBaseline)
                                        [ ]
                                [ ]
                                [ ] iCounter++
                                [ ]
                        [+] else
                                [ ] LogWarning("Warning:{object} is not enabled. Please look up the same manually")
                                [ ] Print("Exit testcase {object}_{Harness.LangCode()} !!!!!!!!!!!!!!!!!!!!!!!!!")
                                [ ] iCounter++
                                [ ]
                        [ ]
                [+] except
                        [ ] print(ExceptData())
                        [ ] iCounter++
                        [ ]
                [ ]
        [ ]
[ ]
[+] CreateBaseline(string sFileLocation, window sCurrentMenu)
        [ ]
        [ ] List of cWindowDetail cTemp = {}
        [ ] ANYTYPE sValue2Write
        [ ] sleep (2)
        [ ]
        [ ] window w = Desktop.GetActive()
        [ ]
        [+] if w!= AppWnd
                [ ] w.Move(0,0)
                [ ] print("dialog")
                [ ]
                [ ] HWND iHandle = w.GetHandle()
                [ ] GetWindowDetail (iHandle, cTemp)
                [ ] sValue2Write = cTemp
                [ ]
        [+] else
                [ ]
                [ ] print("cmdline")
                [ ]
                [ ] sValue2Write = ThisDwg.ReadyForNextCommand()
                [ ]
        [ ]
        [ ] string sFileName = [string]sCurrentMenu
        [ ] string sFileName_temp = StrTran (sFileName, ".", "\")
        [ ]
        [ ] sFileName = StrTran (sFileName, ".", "_")
        [ ]
        [ ] sFileLocation = sFileLocation + sFileName_temp
        [ ] MakeFolder(sFileLocation)
        [ ]
        [ ] sFileName = sFileLocation + "\" + sFileName + ".txt"
        [ ]
        [+] do
                [ ] HFILE hBaselineFile = FileOpen (sFileName, FM_WRITE, FS_EXCLUSIVE)
                [ ] FileWriteValue (hBaselineFile, @("sValue2Write"))
                [ ] FileClose (hBaselineFile)
                [ ] print("BaseLine {sFileName} sucessfully created")
                [ ]
        [+] except
                [+] if hBaselineFile != NULL
                        [ ] FileClose (hBaselineFile)
                        [ ]
                [ ]
        [ ]
[ ]
[+] DoVerification(string sFileLocation, window sCurrentMenu)
        [ ]
        [ ] string sFileName = [string]sCurrentMenu
        [ ] string sFileName_temp = StrTran (sFileName, ".", "\")
        [ ]
        [ ] sFileName = StrTran (sFileName, ".", "_")
        [ ] sFileLocation = sFileLocation + sFileName_temp
        [ ]
        [ ] sFileName = sFileLocation + "\" + sFileName + ".txt"
        [ ]
        [ ] ANYTYPE cObjExpected = NULL
        [+] do
                [ ] HFILE hBaselineFile = FileOpen (sFileName, FM_READ, FS_DENY_WRITE)
                [+] do
                        [ ] FileReadValue (hBaselineFile, cObjExpected)
                [+] except
                        [ ] LogError("Error in file read operation")
                        [ ] reraise
                        [ ]
                [ ] FileClose (hBaselineFile)
                [ ]
                [ ] sleep (2)
                [+] if (TypeOf(cObjExpected)== List of cWindowDetail)
                        [ ]
                        [ ] hBaselineFile = FileOpen (sFileName, FM_READ, FS_DENY_WRITE)
                        [ ]
                        [ ] List of cWindowDetail ObjExpectedRefFile
                        [ ] FileReadValue (hBaselineFile, ObjExpectedRefFile)
                        [ ] FileClose (hBaselineFile)
                        [ ]
                        [ ] HWND iHandle = Desktop.GetActive().GetHandle()
                        [ ] List of cWindowDetail cObjActual
                        [ ]
                        [ ] GetWindowDetail (iHandle, cObjActual)
                        [+] if(cObjActual != ObjExpectedRefFile)
                                [ ]
                                [ ] LogError("Test Failed: Results for Review")
                                [ ] ResPrintList ("Expected", ObjExpectedRefFile)
                                [ ] ResPrintList ("Actual", cObjActual)
                                [ ]
                        [ ]
                [+] else if(ThisDwg.ReadyForNextCommand() != cObjExpected)
                                [ ] LogError("Test Failed: Results for Review")
                                [ ] LogError("Expected: {cObjExpected}. Found Otherwise.")
                                [ ]
                        [ ]
                [ ]
        [+] except
                [+] if ExceptNum() == E_FILE
                        [ ] LogError("Baseline file does not exist")
                        [+] if hBaselineFile != NULL
                                [ ] FileClose (hBaselineFile)
                                [ ]
                        [ ]
                [ ]
        [ ]
[ ]
[+] list of WINDOW lsMenus2Chk= {...}
        [ ] AppWnd.Projects
        [ ] AppWnd.Wires
        [ ] AppWnd.Components
        [ ] AppWnd.PanelLayout
        [ ]
[ ]
[ ] // *************************************
[+] type cWindowDetail is record
        [ ] LONG lStyle
        [ ] STRING sType
        [ ] STRING sClass
        [ ] INT iCtrlID
        [ ] Boolean bIsHidden
        [ ]
[+] void GetWindowDetail (HWND hWnd, inout List of cWindowDetail lsWndDetail)
        [ ]
        [+] if lsWndDetail == NULL
                [ ] lsWndDetail = {}
                [ ]
        [ ] cWindowDetail Temp
        [ ]
        [ ] HWND hWndChild = GetWindow (hWnd, GW_CHILD)
        [ ]
        [+] while (hWndChild != 0)
                [ ] Temp.lStyle = GetWindowLong (hWndChild, GWL_STYLE)
                [ ]
                [+] select
                        [+] case ((Temp.lStyle & WS_CHILD) != 0)
                                [ ] Temp.sType = "Child"
                                [ ] break
                                [ ]
                        [+] case ((Temp.lStyle & WS_POPUP) != 0)
                                [ ] Temp.sType = "Popup"
                                [ ] break
                                [ ]
                        [+] default
                                [ ] Temp.sType = "Overlapped"
                                [ ] break
                [ ]
                [ ] GetClassName (hWndChild, Temp.sClass, 256)
                [ ] Temp.iCtrlID= GetDlgCtrlID (hWndChild)               
                [ ]
                [+] if (! IsWindowVisible (hWndChild))
                        [ ] Temp.bIsHidden = True
                        [ ]
                [+] else
                        [ ] Temp.bIsHidden = False
                        [ ]
                [ ]
                [ ] ListAppend(lsWndDetail, Temp)
                [ ]
                [ ] GetWindowDetail (hWndChild, lsWndDetail)
                [ ] hWndChild = GetWindow (hWndChild, GW_HWNDNEXT)
                [ ]
[+] boolean MakeFolder(string sFolderPath, string sFNameDelimiter optional)
        [ ]
        [+] if sFNameDelimiter == NULL
                [ ] sFNameDelimiter = '\'
                [ ]
        [+] else
                [ ] sFolderPath = StrTran (sFolderPath, sFNameDelimiter, '\')
                [ ] sFNameDelimiter = '\'
                [ ]
        [ ]
        [ ] int iField = 0
        [ ] string sTemp = "test"
        [+] while sTemp != ""
                [ ] iField++
                [ ] sTemp = GetField (sFolderPath, sFNameDelimiter, iField)
                [ ]
        [ ] iField--
        [ ]
        [ ] string sTempCurrFolder = GetField (sFolderPath, sFNameDelimiter, iField)
        [ ] int iPos = StrPos (sTempCurrFolder, sFolderPath,true)
        [ ] string sTempPath = Stuff (sFolderPath, iPos-1,  Len(sFolderPath)-iPos+2, "")
        [ ]
        [+] if Right(sTempPath,1)==':'
                [ ] string sTempPath_temp = StrTran (sTempPath, ':', "")
                [ ]
                [ ] string sDriveName = SYS_GetDrive ()
                [ ]
                [+] do
                        [ ] Sys_SetDrive (sTempPath_temp)
                        [ ]
                [+] except
                        [ ] LogError("Invalid Drive Specified")
                        [ ] ExceptClear()
                        [ ] Sys_SetDrive (sDriveName)
                        [ ] return false
                        [ ]
                [ ]
                [ ] Sys_SetDrive (sDriveName)
                [ ] sTempPath = sTempPath+"\"
                [ ]
        [ ]
        [+] if !SYS_DirExists(sTempPath)
                [+] if !MakeFolder(sTempPath)
                        [ ] return false
                        [ ]
                [ ]
        [+] if !SYS_DirExists ("{sTempPath}\{sTempCurrFolder}")
                [ ] SYS_MakeDir ("{sTempPath}\{sTempCurrFolder}")
                [ ] return true
                [ ]
        [ ]
        [ ] return true
        [ ]
[ ]
回复 支持 反对

使用道具 举报

本版积分规则

关闭

站长推荐上一条 /1 下一条

小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

GMT+8, 2024-10-6 10:39 , Processed in 0.109201 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

快速回复 返回顶部 返回列表