Results 1 to 7 of 7
  1. #1

    Close all windows by SilkTest

    Hello friends,

    Overnight Silk runs ~10k test cases and sometimes Silk encountering problem to close some dialogs (for example MicrosoftWord Save(Yes\No) dialog).

    I have an idea to create some kind of appstate that will CLOSE(not kill) any not expected dialogs.
    Do somebody had same problem? I would be very happy if you can share how you have solved this problem.

    Thank you for any suggestions. [img]/images/graemlins/confused.gif[/img]
    Only a few know that millions are composed of zeros.

  2. #2

    Re: Close all windows by SilkTest


    assuming you are using 4Test, there is a group of options dedicated to closing dialog (Options > Agent > Close).

    Using those options, you can adapt the things Silk Test is trying to handle unexpected dialogs, although that is limited to when the base state is executed (so before or after a test).

  3. #3

    Re: Close all windows by SilkTest

    I had similar issues when using Microsoft Excel, my resolution was to check for processes that were running, and kill Microsoft Excel.

    You can create a macro in Word, call the key combination which will automatically call the appropriate macro to save and close down Word gracefully.

  4. #4

    Re: Close all windows by SilkTest

    10k test cases is a big overnight run, are you doing this through a single invocation of Silktest? If so, I'd consider partitioning the run so that you're releasing machine resources from time to time.

    And particularly if you're continually invoking and closing MS applications.


  5. #5

    Re: Close all windows by SilkTest

    Hi again,

    I found that EnumWindows and EnumChildWindows of user32.dll can help me to get actual opened windows.

    Can somebody assist me, how I can register these two functions in Silk?

    Only a few know that millions are composed of zeros.

  6. #6

    Re: Close all windows by SilkTest

    It would be something like:

    <font class="small">Code:</font><hr /><pre>[-] dll "user32.dll"
    [ ] BOOL EnumWindows(WNDENUMPROC lpEnumFunc, LPARAM lParam)
    [ ] BOOL EnumChildWindows(HWND hWndParent, WNDENUMPROC lpEnumFunc, LPARAM lParam)
    [-] testcase Test1() appstate none
    [ ] EnumWindows(one, two)</pre><hr />

  7. #7

    Re: Close all windows by SilkTest

    I don't know if this much help because this is written in TestPartner or VBA. Maybe it can be converted. Somebody else at our company wrote it. I use it, to check that I don't have to many copies of Java running (&gt; 2). You maybe could tweak it to stop everything but Silk Test and Windows?

    Public Function KillJavaw()

    ' : Terminates a process. First checking to see if it is running or not.
    ' : Uses WMI (Windows Management Instrumentation) to query all running processes
    ' : then terminates ALL instances of the specified process
    ' : held in the variable strTerminateThis.
    ' :
    ' : ***WARNING: This will terminate a specified running process,use with caution!.
    ' : ***Terminating certain processes can effect the running of Windows and/or
    ' : ***running applications.
    Dim strTerminateThis As String 'The variable to hold the process to terminate
    Dim objWMIcimv2 As Object
    Dim objProcess As Object
    Dim objList As Object
    Dim intError As Integer

    strTerminateThis = "javaw.exe" 'Process to terminate,
    'change notepad.exe to the process you want to terminate

    Set objWMIcimv2 = GetObject("winmgmts:" _
    &amp; "{impersonationLevel=impersonate}!\\.\root\cim v2") 'Connect to CIMV2 Namespace

    Set objList = objWMIcimv2.ExecQuery _
    ("select * from win32_process where name='" &amp; strTerminateThis &amp; "'") 'Find the process to terminate

    If objList.count = 0 Then 'If 0 then process isn't running
    'MsgBox strTerminateThis &amp; " is NOT running." &amp; vbCr &amp; vbCr _
    &amp; "Exiting procedure.", vbCritical, "Unable to continue"
    Set objWMIcimv2 = Nothing
    Set objList = Nothing
    Set objProcess = Nothing
    Exit Function
    ElseIf objList.count &gt; 2 Then
    For Each objProcess In objList

    intError = objProcess.Terminate 'Terminates a process and all of its threads.
    'Return value is 0 for success. Any other number is an error.
    If intError &lt;&gt; 0 Then
    MsgBox "ERROR: Unable to terminate that process.", vbCritical, "Aborting"
    Exit Function
    End If
    'ALL instances of specified process (strTerminateThis) has been terminated
    'Call MsgBox("ALL instances of process " &amp; strTerminateThis &amp; " has been successfully terminated.", _
    vbInformation, "Process Terminated")

    ' Set objWMIcimv2 = Nothing
    ' Set objList = Nothing
    ' Set objProcess = Nothing
    ' Exit Sub

    'Case vbCancel
    'NOT OK to continue with the termination, abort
    Set objWMIcimv2 = Nothing
    Set objList = Nothing
    Set objProcess = Nothing
    ' End Function
    ' End Select
    End If

    End Function



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
BetaSoft Inc.
All times are GMT -8. The time now is 04:00 PM.

Copyright BetaSoft Inc.