Forum Discussion

pwang's avatar
pwang
Occasional Contributor
2 years ago

How could disable dialog box show when finished running testing case with TestExecute

Hi,

 

I just run some testing case from Jenkins using TestExecute. but I have a problem,

If the project have be finished, there will be a confirm dialog box appears , Probably because of I added Some Test app dynamically, changed some of the files in Original Project.

The trouble is if i don't close the dialog box manually , I see the jenkins cannot be  stopped. 

 

I am not sure if i could handle this problem In the following script??  Does anyone have a good idea

...

IF ERRORLEVEL 1001 GOTO NotEnoughDiskSpace
IF ERRORLEVEL 1000 GOTO AnotherInstance
IF ERRORLEVEL 127 GOTO DamagedInstall
IF ERRORLEVEL 4 GOTO Timeout
IF ERRORLEVEL 3 GOTO CannotRun
IF ERRORLEVEL 2 GOTO Errors
IF ERRORLEVEL 1 GOTO Warnings
IF ERRORLEVEL 0 GOTO Success
IF ERRORLEVEL -1 GOTO LicenseFailed

...

 

  • Look at TestExecute Command Line to see which parameter(s) can disable dialogs.

     

    The automation should not be making any changes to either of its files in the project while running. I suggest you correct this.

     

    The ErrorLevel are TC Exit Codes, which I don't think will cover your confirmation dialog. 

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    Look at TestExecute Command Line to see which parameter(s) can disable dialogs.

     

    The automation should not be making any changes to either of its files in the project while running. I suggest you correct this.

     

    The ErrorLevel are TC Exit Codes, which I don't think will cover your confirmation dialog. 

    • pwang's avatar
      pwang
      Occasional Contributor

      Thanks rraghvani,

       

      If so , i think i need another way to deal with this problem.

       

      Thanks,Peng

  • pwang's avatar
    pwang
    Occasional Contributor

    Hi rraghvani,

     

    I just write a py script as Polling monitoring , i think it could kill this dialog when i met it,

    It seems work for me so far ğŸ˜€

     

    import win32gui,win32api,win32con
    import time

    wdname = ['Confirm']
    hWndChildList = []

    def CheckHwnd():
    hwnd = 0
    for k in range(len(wdname)):
    _tp = win32gui.FindWindow(None, wdname[k])
    hwnd = _tp + hwnd
    return hwnd

    def Get_Child_Windows(parent):
    if not parent:
    return
    hWndChildList = []
    win32gui.EnumChildWindows(parent, lambda hWnd, param: param.append(hWnd), hWndChildList)
    return hWndChildList


    def Get_Parent_Hwnd(wdname):
    hwnd = 0
    for k in range(len(wdname)):
    _tp = win32gui.FindWindow(None, wdname[k])
    hwnd = _tp + hwnd
    return hwnd


    if __name__ == '__main__':

    wflag = True

    while wflag:
    time.sleep(3)
    if CheckHwnd() == 0:
    wflag = True
    print("watch dog working...")
    continue
    else:
    wflag = False
    break

    hWndChildList = Get_Child_Windows(Get_Parent_Hwnd(wdname))
    BtnNoHW = hWndChildList[-4]

    BtnNotitle = win32gui.GetWindowText(BtnNoHW)
    Btnclassname = win32gui.GetClassName(BtnNoHW)
    win32api.SendMessage(BtnNoHW, win32con.BM_CLICK, 0, 0)
    time.sleep(3)

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    If it works for you, that's fine. But ideally, I see no reasons to make any changes to the existing project files when running the automation.

    • pwang's avatar
      pwang
      Occasional Contributor

      yes , you are right , but It maybe a little special for our project,  to Simplify handling some caching problem for Testing. I need to new add test app when run the project. this cause the project files will be changed when integrated  with jenkins using TestExecute. 

       

      At least that's my problem right now, Maybe i  have some wrong undestanding for some configuration with Jenkins

       

      i also don't want to handle this problem in other ways, i will review the project and user guide , to find if we have another better way to fix it.

       

      Thanks,Peng