C# Selenium Monitor and kill higher CPU usage processes

Viewed 26

The stack that I am using is C# and Specflow and I am running the tests on multiple threads.I have some automation tests on web application. I am executing them headless on remote Linux machine.

I've noticed that some of the tests on one of the features is adding way higher CPU usage than the tests for the other features(up to 100%). The same thing is happening when executing the tests manually. I've noticed that if I kill the Google Chrome process with highest CPU usage, the execution continues without problem.

Is there a way, that I can monitor the CPU usage during test execution and automatically kill the process with highest usage?

If the monitoring during execution is possible, I was thinking to either wait for 100% CPU usage and kill the process with the highest usage or wait for Google Chrome process to exceed for example 40-50% CPU usage and then kill it.

0 Answers
Related