What about checking if the process is by using a CustomKeyword ?

In your Keyword:

@Keyword
boolean processIsRunning(String processName) {

    def sout = new StringBuilder(), serr = new StringBuilder()
    def cmd = 'tasklist /FI "IMAGENAME eq ' + processName + '"'
    def proc = cmd.execute()
    proc.consumeProcessOutput(sout, serr)
    proc.waitForOrKill(1000)

    if(sout.indexOf(processName) < 0)
        return false;
    else
        return true;
}

In your TestCase (Script mode):

boolean process = CustomKeywords.'main.CheckProcess.processIsRunning'('explorer.exe')

if (process)
   KeywordUtil.markPassed("Process is running")
else
   KeywordUtil.markFailed("Process not running, test failed")



Source link https://sqa.stackexchange.com/questions/33898/is-there-a-way-to--if-an---is-running-from--

LEAVE A REPLY

Please enter your comment!
Please enter your name here