发布新日志

  • using AutoIt to automate WMP (play video)

    2009-12-30 17:31:30

    If embedded in IE:

    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <file.au3>
    #include <common.au3>
    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #include <GuiEdit.au3>
    #include <date.au3>
    #include <ScreenCapture.au3>
    #include <IE.au3>

    ; Define global parameters;
    ; Set Global Values
    $Network_Path="\\_Projects\Test Projects\ WMP Plugin\Version 1.2\Test Data\"
    $Test_Scripts_Path=$Network_Path&"Test Scripts\"
    $Local_Path="C:\temp\ WMP Plugin\"
    dim $TestResultFiles[3]
    ;$VIQ_Page_URL="C:\Program Files\\ WMP Plug-in\.html"
    $VIQ_Page_URL="http://192.168.1.2:9091/.html"
    $WMP_Title = "Windows Media Player" ; Windows Media Player Main Screen Title
    Global $page

    Opt("GUIOnEventMode", 1)
    #Region ### START Koda GUI section ### Form=\\_projects\test projects\wmp plugin\version 1.2\test data\test scripts\form1.kxf
    $TestConsoleForm. = GUICreate("Test Console", 633, 454, 190, 111)
    GUISetOnEvent($GUI_EVENT_CLOSE, "TestConsoleFormClose")
    GUISetOnEvent($GUI_EVENT_MINIMIZE, "TestConsoleFormMinimize")
    GUISetOnEvent($GUI_EVENT_MAXIMIZE, "TestConsoleFormMaximize")
    GUISetOnEvent($GUI_EVENT_RESTORE, "TestConsoleFormRestore")
    $bSelectDataFile = GUICtrlCreateButton("Browse", 440, 120, 75, 25, 0)
    GUICtrlSetOnEvent(-1, "bSelectDataFileClick")
    $SelectDataFile = GUICtrlCreateLabel("Select test data file:", 16, 120, 97, 17)
    GUICtrlSetOnEvent(-1, "SelectDataFileClick")
    Global $iSelectDataFile = GUICtrlCreateInput("iSelectDataFile", 208, 120, 209, 21)
    GUICtrlSetOnEvent(-1, "iSelectDataFileChange")

    $bRunScript. = GUICtrlCreateButton("Run", 208, 216, 75, 25, 0)
    GUICtrlSetOnEvent(-1, "bRunScriptClick")
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                Exit
            Case $bSelectDataFile
               
        EndSwitch
    WEnd

    Func bSelectDataFileClick()
        $var = FileOpenDialog("Select a file", $Network_Path, "All (*.*)")
        ;Global $Test_Data_File
        _GUICtrlEdit_SetText($iSelectDataFile, $var)

    EndFunc   ;==>bSelectDataFileClick

    Func GetTestType()
        Global $sTestType
       
        if StringInStr($Test_Data_File, "Baseline") Then
            $sTestType= "Baseline"
        elseif StringInStr($Test_Data_File, "Web") Then
            $sTestType= "Web"
        Elseif StringInStr($Test_Data_File, "Others") Then
            $sTestType= "Others"
        EndIf
        return $sTestType
    EndFunc

    Func CreateTestResultFile($TestCase_ID,$File_Name,$CurrentDT)
       
        $sTestType=GetTestType()   
       
        $TestResult_Dir_Name = $Network_Path & "Test Results\" & $sTestType&"_" & $CurrentDT & "\"
        $TestResult_File = $TestResult_Dir_Name&$sTestType&"_" & $CurrentDT & ".txt";
        $Url_List_File = $Network_Path & "Test Results\" & "_WMP_URL_List-"&$sTestType&"_" & $CurrentDT & ".txt";
           
        DirCreate($TestResult_Dir_Name)
        DirCreate($Local_Path)
       
    ;~     ; Copy files to local path if they do not exist
    ;~         If Not FileExists($Local_Path & $File_Name) Then
    ;~             If $Codec == "Mpeg4" Then
    ;~                 FileCopy($Network_Path & "Mpeg4 Files\" & $File_Name, $Local_Path)
    ;~             ElseIf $Codec == "H.264" Then
    ;~                 FileCopy($Network_Path & "H.264 Files\" & $File_Name, $Local_Path)
    ;~             ElseIf $Codec == "Playlist" Then
    ;~                 FileCopy($Network_Path & "Playlist\" & $File_Name, $Local_Path)
    ;~             EndIf
    ;~             If $Codec == "External" Then
    ;~                 FileCopy($Network_Path & "External .mp4 files\" & $File_Name, $Local_Path)
    ;~             EndIf
    ;~         EndIf
           
            ; Create Test Result File
           
            If Not FileExists($TestResult_File) Then
               
                FileChangeDir($TestResult_Dir_Name)
                _FileCreate($TestResult_File)
                ;FileWrite($TestResult_File,"OS:"&$OS&@CRLF)
                FileWrite($TestResult_File, "Windows Media Player:" & $WMP_CurVersion & @CRLF)
                ;FileWrite($TestResult_File,"Web Browser:"&$Browser&@CRLF&@CRLF)
            EndIf
           
            WinActivate($WMP_Title)
           
            FileWrite($TestResult_File, "executing Test Case " & $TestCase_ID & " on " & $CurrentDT & @CRLF & @CRLF)
           
            $TestResultFiles[1]=$TestResult_File
            $TestResultFiles[0]=$TestResult_Dir_Name
            $TestResultFiles[2]=$Url_List_File
           
            Return $TestResultFiles
    EndFunc  

    Func OpenFile($File_Path,$File_Name)
        Send("^o")
        WinWaitActive("Open")
        $File_To_Enter = StringReplace($File_Path & $File_Name, "+", "{+}")
        ControlSend("Open", "", "[CLASS:Edit; INSTANCE:1]", $File_To_Enter)
        ControlClick("Open", "", "&Open")
        MsgBox(0, "Open File", $File_To_Enter, 5)
    EndFunc

    Func OpenURL($Url,$File_Name)
        Send("^u")
        WinWaitActive("Open URL")
        $URL_To_Enter = StringReplace($Url & $File_Name, "+", "{+}")
        ControlSend("Open URL", "", "[CLASS:Edit; INSTANCE:1]", $URL_To_Enter)
        ControlClick("Open URL", "Enter the URL", "OK")
        MsgBox(0, "Open URL", $URL_To_Enter, 5)
    EndFunc

    Func ExitRelaunchWMP()
        WinWaitActive($WMP_Title)
        ;MsgBox(0,"","test")
        Sleep(1000)
        Send("!{F4}")
        Sleep(3000)
        Run("C:\Program Files\Windows Media Player\wmplayer.exe");Launch Windows Media Player
        WinWaitActive($WMP_Title)
    EndFunc

    Func ExecTC()
       
        $sTestType=GetTestType()
       
        if $sTestType=="Web" Then
            ;Launch the web page;
                Global $page = _IECreate($VIQ_Page_URL)
                Send("{ENTER}")
                _IELoadWait($page)
               
        Else
            Run("C:\Program Files\Windows Media Player\wmplayer.exe");Launch Windows Media Player
        EndIf   
           
        ; Check if data file exists
        Dim $aRecords
        If Not _FileReadToArray($Test_Data_File, $aRecords) Then
            MsgBox(4096, "Error", " Error reading file to Array. Error:" & @error)
            Exit
        EndIf
       
        ; Get Current Date Time
        Global $CurrentDT = Get_Current_DT()
    ;~     $TestData_Line_Array = StringSplit(FileReadLine($Test_Data_File, 16), @TAB)
    ;~         $TestCase_ID = $TestData_Line_Array[1]
    ;~         MsgBox(0,"",$TestCase_ID)
        ; Read from test data file and execute test cases
        For $Line_Num = 2 To _FileCountLines($Test_Data_File)
            ;for $Line_Num = 16 To 17
            $TestData_Line_Array = StringSplit(FileReadLine($Test_Data_File, $Line_Num), @TAB)
            ;MsgBox(0,"",$TestData_Line_Array)
            $TestCase_ID = $TestData_Line_Array[1]
            $File_Path = $TestData_Line_Array[2]
            $File_Name = $TestData_Line_Array[3]
            $Url = $TestData_Line_Array[4]
            ;$Codec = $TestData_Line_Array[5]
            ;MsgBox(0,"",$TestCase_ID&$File_Path&$File_Name&$Url&$Codec)
            ;MsgBox(0,"",$TestCase_ID)
            $TestResultFiles=CreateTestResultFile($TestCase_ID,$File_Name,$CurrentDT)
           
            ; Open File or Open URL
            If ($File_Path == "" And $Url <> "") Then
                FileWrite($TestResultFiles[2], $TestCase_ID & ":  " & $Url & $File_Name & @CRLF & @CRLF)
                FileWrite($TestResultFiles[1], "URL is " & $Url & $File_Name & @CRLF & @CRLF)
                Switch $sTestType
                    case "Web"
                        WinActivate($VIQ_Page_URL&" - Microsoft Internet Explorer")
                        $oInput=_IEGetObjByName($page,"inputURL")
                        $oSetvalue=_IEFormElementSetValue($oInput,$url&$File_Name)
                        $oButton=_IEGetObjByName($page,"BtnPlay")
                        _IEAction($oButton,"click")
                        MsgBox(0,"",$url&$File_Name,1)       
                    Case "Baseline" or "Others"
                        WinWaitActive($WMP_Title)
                        OpenURL($Url,$File_Name)
                EndSwitch
                Sleep(5000)
               
            ElseIf ($File_Path <> "" And $Url == "") Then
                FileWrite($TestResultFiles[2], $TestCase_ID & ":  " & $File_Path & $File_Name & @CRLF & @CRLF)
                FileWrite($TestResultFiles[1], "URL is " & $File_Path & $File_Name & @CRLF & @CRLF)
                Switch $sTestType
                    case "Web"
                       
                        WinActivate($VIQ_Page_URL&" - Microsoft Internet Explorer")
                        ;MsgBox(0,"",$page)
                       
                        $oInput=_IEGetObjByName($page,"inputURL")
                        ;MsgBox(0,"",$oInput)
                        $oButton=_IEGetObjByName($page,"BtnPlay")
                        $oSetvalue=_IEFormElementSetValue($oInput,$File_Path&$File_Name)
                       
                        _IEAction($oButton,"click")
                        MsgBox(0,"",$File_Path&$File_Name,1)
                    Case "Baseline" or "Others"
                        WinWaitActive($WMP_Title)
                        OpenFile($File_Path,$File_Name)
                EndSwitch
                Sleep(1000)
            EndIf
           
            ; Check error messages;
            Sleep(1000)
            Error_W_Check()
            Screen_Capture_Save_to_File()
            Sleep(2000)
            FileWrite($TestResultFiles[1], $TestCase_ID & " is executed, see " & "screenshot saved under " & $TestResult_File_Snapshot & @CRLF & @CRLF)
        ExitRelaunchWMP()
        Next
    EndFunc
       
    Func bRunScriptClick()
       
        ExecTC()

    EndFunc   ;==>bRunScriptClick

    Func TestConsoleFormClose()
        ;Note: at this point @GUI_CTRLID would equal $GUI_EVENT_CLOSE,
        ;@GUI_WINHANDLE will be either $mainwindow or $dummywindow
        If @GUI_WinHandle = $TestConsoleForm. Then
            ;MsgBox(0, "Exiting", "Exiting...",1)
            ;ExitOpt("GUIOnEventMode", 1)
            Exit
        EndIf
    EndFunc   ;==>TestConsoleFormClose

    Func iSelectDataFileChange()

        $Test_Data_File = _GUICtrlEdit_GetText($iSelectDataFile)
        Return $Test_Data_File
    EndFunc   ;==>iSelectDataFileChange

    Func SelectDataFileClick()

    EndFunc   ;==>SelectDataFileClick

    Func TestConsoleFormMaximize()

    EndFunc   ;==>TestConsoleFormMaximize
    Func TestConsoleFormMinimize()

    EndFunc   ;==>TestConsoleFormMinimize
    Func TestConsoleFormRestore()

    EndFunc   ;==>TestConsoleFormRestore


    Func RepPlayStopButton()
        Run($Test_Scripts_Path & "RepeatPlayStop.exe")
    EndFunc   ;==>RepPlayStopButton


    From Windows Media Player standalone

    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <file.au3>
    #include <common.au3>
    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #include <GuiEdit.au3>
    #include <date.au3>
    #include <ScreenCapture.au3>
    #include <IE.au3>

    ; Define global parameters;
    ; Set Global Values
    $Network_Path="\Test Projects\WMP Plugin\Version 1.2\Test Data\"
    $Test_Scripts_Path=$Network_Path&"Test Scripts\"
    $Local_Path="C:\temp\WMP Plugin\"
    dim $TestResultFiles[3]
    $VIQ_Page_URL="http://192.168.1.2:9091//.htm"
    $WMP_Title = "Windows Media Player" ; Windows Media Player Main Screen Title
    $VIQ_Page_Title = "VIQPLUGIN ACTIVEX Test"

    Opt("GUIOnEventMode", 1)
    #Region ### START Koda GUI section ### Form=\wmp plugin\version 1.2\test data\test scripts\form1.kxf
    $TestConsoleForm. = GUICreate("Test Console", 633, 454, 190, 111)
    GUISetOnEvent($GUI_EVENT_CLOSE, "TestConsoleFormClose")
    GUISetOnEvent($GUI_EVENT_MINIMIZE, "TestConsoleFormMinimize")
    GUISetOnEvent($GUI_EVENT_MAXIMIZE, "TestConsoleFormMaximize")
    GUISetOnEvent($GUI_EVENT_RESTORE, "TestConsoleFormRestore")
    $bSelectDataFile = GUICtrlCreateButton("Browse", 440, 120, 75, 25, 0)
    GUICtrlSetOnEvent(-1, "bSelectDataFileClick")
    $SelectDataFile = GUICtrlCreateLabel("Select test data file:", 16, 120, 97, 17)
    GUICtrlSetOnEvent(-1, "SelectDataFileClick")
    Global $iSelectDataFile = GUICtrlCreateInput("iSelectDataFile", 208, 120, 209, 21)
    GUICtrlSetOnEvent(-1, "iSelectDataFileChange")

    $bRunScript. = GUICtrlCreateButton("Run", 208, 216, 75, 25, 0)
    GUICtrlSetOnEvent(-1, "bRunScriptClick")
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                Exit
            Case $bSelectDataFile
               
        EndSwitch
    WEnd

    Func bSelectDataFileClick()
        $var = FileOpenDialog("Select a file", $Network_Path, "All (*.*)")
        ;Global $Test_Data_File
        _GUICtrlEdit_SetText($iSelectDataFile, $var)

    EndFunc   ;==>bSelectDataFileClick

    Func GetTestType()
        Global $sTestType
       
        if StringInStr($Test_Data_File, "Baseline") Then
            $sTestType= "Baseline"
        elseif StringInStr($Test_Data_File, "Web") Then
            $sTestType= "Web"
        Elseif StringInStr($Test_Data_File, "Others") Then
            $sTestType= "Others"
        EndIf
        return $sTestType
    EndFunc

    Func CreateTestResultFile($TestCase_ID,$File_Name,$CurrentDT)
       
        $sTestType=GetTestType()   
       
        $TestResult_Dir_Name = $Network_Path & "Test Results\" & $sTestType&"_" & $CurrentDT & "\"
        $TestResult_File = $TestResult_Dir_Name&$sTestType&"_" & $CurrentDT & ".txt";
        $Url_List_File = $Network_Path & "_WMP_URL_List-"&$sTestType&"_" & $CurrentDT & ".txt";
           
        DirCreate($TestResult_Dir_Name)
        DirCreate($Local_Path)
       
    ;~     ; Copy files to local path if they do not exist
    ;~         If Not FileExists($Local_Path & $File_Name) Then
    ;~             If $Codec == "Mpeg4" Then
    ;~                 FileCopy($Network_Path & "Mpeg4 Files\" & $File_Name, $Local_Path)
    ;~             ElseIf $Codec == "H.264" Then
    ;~                 FileCopy($Network_Path & "H.264 Files\" & $File_Name, $Local_Path)
    ;~             ElseIf $Codec == "Playlist" Then
    ;~                 FileCopy($Network_Path & "Playlist\" & $File_Name, $Local_Path)
    ;~             EndIf
    ;~             If $Codec == "External" Then
    ;~                 FileCopy($Network_Path & "External .mp4 files\" & $File_Name, $Local_Path)
    ;~             EndIf
    ;~         EndIf
           
            ; Create Test Result File
           
            If Not FileExists($TestResult_File) Then
               
                FileChangeDir($TestResult_Dir_Name)
                _FileCreate($TestResult_File)
                ;FileWrite($TestResult_File,"OS:"&$OS&@CRLF)
                FileWrite($TestResult_File, "Windows Media Player:" & $WMP_CurVersion & @CRLF)
                ;FileWrite($TestResult_File,"Web Browser:"&$Browser&@CRLF&@CRLF)
            EndIf
           
            WinActivate($WMP_Title)
           
            FileWrite($TestResult_File, "executing Test Case " & $TestCase_ID & " on " & $CurrentDT & @CRLF & @CRLF)
           
            $TestResultFiles[1]=$TestResult_File
            $TestResultFiles[0]=$TestResult_Dir_Name
            $TestResultFiles[2]=$Url_List_File
           
            Return $TestResultFiles
    EndFunc  

    Func OpenFile($File_Path,$File_Name)
        Send("^o")
        WinWaitActive("Open")
        $File_To_Enter = StringReplace($File_Path & $File_Name, "+", "{+}")
        ControlSend("Open", "", "[CLASS:Edit; INSTANCE:1]", $File_To_Enter)
        ControlClick("Open", "", "&Open")
        MsgBox(0, "Open File", $File_To_Enter, 5)
    EndFunc

    Func OpenURL($Url,$File_Name)
        Send("^u")
        WinWaitActive("Open URL")
        $URL_To_Enter = StringReplace($Url & $File_Name, "+", "{+}")
        ControlSend("Open URL", "", "[CLASS:Edit; INSTANCE:1]", $URL_To_Enter)
        ControlClick("Open URL", "Enter the URL", "OK")
        MsgBox(0, "Open URL", $URL_To_Enter, 5)
    EndFunc

    Func ExecTC()
       
        $sTestType=GetTestType()
       
        if $sTestType=="Web" Then
            ;Launch the web page;
                $page = _IECreate($VIQ_Page_URL)
                Send("{ENTER}")
                _IELoadWait($page)
        Else
            Run("C:\Program Files\Windows Media Player\wmplayer.exe");Launch Windows Media Player
        EndIf   
           
        ; Check if data file exists
        Dim $aRecords
        If Not _FileReadToArray($Test_Data_File, $aRecords) Then
            MsgBox(4096, "Error", " Error reading file to Array. Error:" & @error)
            Exit
        EndIf
       
        ; Get Current Date Time
        Global $CurrentDT = Get_Current_DT()
    ;~     $TestData_Line_Array = StringSplit(FileReadLine($Test_Data_File, 16), @TAB)
    ;~         $TestCase_ID = $TestData_Line_Array[1]
    ;~         MsgBox(0,"",$TestCase_ID)
        ; Read from test data file and execute test cases
        For $Line_Num = 2 To _FileCountLines($Test_Data_File)
            ;for $Line_Num = 16 To 17
            $TestData_Line_Array = StringSplit(FileReadLine($Test_Data_File, $Line_Num), @TAB)
            ;MsgBox(0,"",$TestData_Line_Array)
            $TestCase_ID = $TestData_Line_Array[1]
            $File_Path = $TestData_Line_Array[2]
            $File_Name = $TestData_Line_Array[3]
            $Url = $TestData_Line_Array[4]
            ;$Codec = $TestData_Line_Array[5]
            ;MsgBox(0,"",$TestCase_ID&$File_Path&$File_Name&$Url&$Codec)
            ;MsgBox(0,"",$TestCase_ID)
            $TestResultFiles=CreateTestResultFile($TestCase_ID,$File_Name,$CurrentDT)
           
            ; Open File or Open URL
            If ($File_Path == "" And $Url <> "") Then
                FileWrite($TestResultFiles[2], $TestCase_ID & ":  " & $Url & $File_Name & @CRLF & @CRLF)
                FileWrite($TestResultFiles[1], "URL is " & $Url & $File_Name & @CRLF & @CRLF)
                Switch $sTestType
                    case "Web"
                        WinActivate($VIQ_Page_Title&" - Microsoft Internet Explorer")
                        $oInput=_IEGetObjByName($page,"inputURL")
                        $oSetvalue=_IEFormElementSetValue($oInput,$url&$File_Name)
                        $oButton=_IEGetObjByName($page,"BtnPlay")
                        _IEAction($oButton,"click")
                        MsgBox(0,"",$url&$File_Name,1)       
                    Case "Baseline" or "Others"
                        WinWaitActive($WMP_Title)
                        OpenURL($Url,$File_Name)
                EndSwitch
                Sleep(5000)
               
            ElseIf ($File_Path <> "" And $Url == "") Then
                FileWrite($TestResultFiles[2], $TestCase_ID & ":  " & $File_Path & $File_Name & @CRLF & @CRLF)
                FileWrite($TestResultFiles[1], "URL is " & $File_Path & $File_Name & @CRLF & @CRLF)
                Switch $sTestType
                    case "Web"
                        WinActivate($VIQ_Page_URL&" - Microsoft Internet Explorer")
                        $oInput=_IEGetObjByName($page,"inputURL")
                        $oSetvalue=_IEFormElementSetValue($oInput,$File_Path&$File_Name)
                        $oButton=_IEGetObjByName($page,"BtnPlay")
                        _IEAction($oButton,"click")
                        MsgBox(0,"",$File_Path&$File_Name,1)
                    Case "Baseline" or "Others"
                        WinWaitActive($WMP_Title)
                        OpenFile($File_Path,$File_Name)
                EndSwitch
                Sleep(1000)
            EndIf
           
            ; Check error messages;
            Sleep(1000)
            Error_W_Check()
            Screen_Capture_Save_to_File()
            Sleep(2000)
            FileWrite($TestResultFiles[1], $TestCase_ID & " is executed, see " & "screenshot saved under " & $TestResult_File_Snapshot & @CRLF & @CRLF)
        Next
    EndFunc
       
    Func bRunScriptClick()
       
        ExecTC()

    EndFunc   ;==>bRunScriptClick

    Func TestConsoleFormClose()
        ;Note: at this point @GUI_CTRLID would equal $GUI_EVENT_CLOSE,
        ;@GUI_WINHANDLE will be either $mainwindow or $dummywindow
        If @GUI_WinHandle = $TestConsoleForm. Then
            ;MsgBox(0, "Exiting", "Exiting...",1)
            ;ExitOpt("GUIOnEventMode", 1)
            Exit
        EndIf
    EndFunc   ;==>TestConsoleFormClose

    Func iSelectDataFileChange()

        $Test_Data_File = _GUICtrlEdit_GetText($iSelectDataFile)
        Return $Test_Data_File
    EndFunc   ;==>iSelectDataFileChange

    Func SelectDataFileClick()

    EndFunc   ;==>SelectDataFileClick

    Func TestConsoleFormMaximize()

    EndFunc   ;==>TestConsoleFormMaximize
    Func TestConsoleFormMinimize()

    EndFunc   ;==>TestConsoleFormMinimize
    Func TestConsoleFormRestore()

    EndFunc   ;==>TestConsoleFormRestore


    Func RepPlayStopButton()
        Run($Test_Scripts_Path & "RepeatPlayStop.exe")
    EndFunc   ;==>RepPlayStopButton


  • how to monitor remote computer's performance counters

    2009-09-23 13:51:47

    Before monitoring, Make sure you are within the Administrators group on the remote computer;
    Start Remote Registry service on the remote computer; That is it!

    To monitor, simply go to Perfmon | Add Counter |, enter the remote computer's ip addr, then its performance counters will be retrieved for selection.

    More details please refer to http://support.microsoft.com/kb/922775

  • Installation Test 的注册表项检查 - 测试漏洞之四

    2008-12-11 15:17:34

    还是Media Player plugin的项目,这次问题出在installation上。

    客户反映,在某些机器上无法play stream,在有些机器上却可以。

    重现问题花了不少脑筋,因为在我们的测试机上都没此问题。最终是客户用Regmon记录了注册表项的变动,提醒了我scheme项下的一个参数导致的问题。程序的安装没有创建该scheme,只是在media player运行时会提醒用户是否要 yes always 允许播放。之所以在某些机器上可以播放,是因为用户在之前的某次操作中已经创建了该值。

    其实在最早期开始测试时,我看到并report了那个media player的warning message,当时只是从usability的角度看的问题,希望developer可以捕捉到此消息并在程序中Say YES ALWAYS. 但是我并没有意识到或深入研究过此消息对程序的其他影响,所以由于developer难以捕捉到该消息,最终同意close the defect。

    总结一下,未能捕捉到此bug的根本原因:对media player处理各file type以及customized protocol的方式流程没有熟悉,即测试没有做到深入了解所测对象。

    以后遇到类似installation issue 需要偶多注意注册表项处理了。也对regmon工具有了亲密接触,不错的工具。
  • Load Large amount of data - 测试漏洞之三

    2008-12-04 10:48:29

    项目背景:在黑莓手机上开发某软件实现voip, 其中涉及到Address book中的contacts, 可以选择任意contact通过该软件拨打电话,并记录call log, call log中要记录通话人的名字和电话之类的。

    程序在每次启动时会根据call log中的电话去address book中查找通话人的姓名等。

    问题是如何发现的呢?自然不是我发现的,因为我疏忽了

    是在交付给客户后,我们老板要回美国,借用我们的黑莓手机,刷刷刷的往手机里导入了1000多条contacts。然后我们的程序启不来了。。。

    丢脸呢,直接给老板找出漏洞了,呵呵。其实也是程序架构的问题,如果我早点发现问题就好了。

    这也是暴露了我在performance/stress/load test 上的薄弱,要加强了~~

  • Memory Leak - 测试漏洞之二

    2008-12-04 10:32:29

    PC Resource的监控一直是我的软肋,已经有两个项目在客户处被反应memory leak,丢脸啊55。

    项目1:还是前面那个windows media player 插件的项目,客户写了一段代码,反复播放和停止streaming, 发现部分内存不释放,memroy usage 不断上升。

    当时看到问题反馈时,特后悔,为啥我就没想到呢,very typical scenario,实在不应该。而且该项目我都用Autoit自动化测试了, 虽然立即写了段脚本,复现了问题,并加入regression test了,还是有些自责,呵呵

    不过也因此学会了使用perfmon, 添加counter log, 记录并分析运行一段时间后各指标的走向。看的越多也发现自己的无知,对各指标的分析也有些beyond myself,不是科班出身又曾懒得看枯燥的计算机书,呵呵,所以对computer basics的系统学习不得不早点抓起来了。

  • CurrentDirectory Issue - 测试漏洞之一

    2008-12-04 10:06:31

    这是前端时间做的某项目交接后客户返回的一个问题。

    项目简介:开发一个windows media player的插件,可以播放mp4文件以及客户要求的其他stream。

    问题出在:每次open mp4 file后,程序会将current directory(OpenDir Registry)更改为程序的安装路径。

    复现程序有些tricky,之前测试时没有考虑该scenario,以后遇到类似OPEN,SAVE AS 之类的情况要记着了。

    具体的复现步骤:

    1. Open and play a .mp4 file
    2. From file menu select Open again. Then Press Cancel on the Open dialog
    3. From file menu select Open once again. Noticed that the directory list is changed to the application's installation root. Normally this should be the last accessed directory.

    比较疑惑的一点是:该问题只在某些测试机上出现,有的测试机上却很OK, 没有想通会是什么环境问题导致,有朋友清楚的请留言请教了哦

Open Toolbar