Forum Discussion

TestQA1's avatar
TestQA1
Frequent Contributor
2 years ago
Solved

How to display ERRORLEVEL value in test execute run

Hi,

 

I'm running tests with Test Execute and use echo to display any info. on the console.

I have some conditions for ERRORLEVEL in bat files. But, I am not able to display ERRORLEVEL value using echo ERRORLEVEL, this is to check the value and apply a required action if that error happens.

 

Example code:

 

TestExecute.exe "C:\Work\SmartBear\TestExecute\Projects\My\MySuite.pjs" /r /p:MyProj

echo ERRORLEVEL

if ERRORLEVEL 4 (goto Block1)
if ERRORLEVEL 3 (goto Block2)

 

I know the codes provided by Smart Bear website, but there's something missing in the code, my test run stops so that means the ERRORLEVEL is not 3 or 4. Please note that I have disabled/unchecked 'Show Notification when exception occurs' option in Test Complete properties thinking I wouldn't need to manually press OK on exception dialog while test execute is running.

 

Thanks

3 Replies

    • TestQA1's avatar
      TestQA1
      Frequent Contributor

      Hi rraghvani 

      I have a similar code, but I need to display the value of ERRORLEVEL that test execute gives when the error occurs.

      In the code you have shared, the condition compares the errorlevel to a value we give. What if I want to echo the errorlevel value itself such as 1001, 1000 etc. Or am I missing something in understanding?

       

      Thanks!