How to sync UFT with mainframe job execution
I am working on a script to automate mainframe test senario,
The senario contains several steps
after few initial step , it need to execute a mainframe job and then move to next screen to verify result and exit mainframe.
My am struggling in making uft wait till the job execution complete (as the job execution does not take definite time every time the job execution time varies ) so I cant use wait statement with specific time to hold UFT and UFT should execute the next step in the script only when the job exection completes.
thanks for your help
If some job is being executed, then the mainframe exe should consume the CPU cycles. You can check for CPU usage and wait until the app not consumes any CPU.
SystemMonitor.GetValue("exe name","% Processor Time")
Inbuilt option from UFT you can try to know the CPU usage. If >0, it's busy doing something.
Also you can access the same using WMI. Refer this blog I got it from google.
All the thoughts here are mine not related to my employer nor anyone.
Test Automation Ecstasy
The mainframe job should (and must) have an upper limit to be executed, right?
Why not implement a loop in your automation where you every fifth minute checks whether the job has been completed or not. This do of course assume that the mainframe job triggers a specific status that you can verify on in your second page.
Your loop will then only:
- Pass if the mainframe job is completed and the correct status is appropriate
- Fail if the mainframe job has not been completed yet (or failed) and your upper limit has been exceeded.