I want to run my tests in parallel, but some of my feature files require the server to be in different (incompatible) states. This is because the server behaves differently when it is in different states, and I want to be able to cover all of these behaviors.

My first thought on how to resolve this was to set up two instances of the server and set maxInstances: 2 in my wdio.conf file. For this to work, however, I would need to be able to tell which of the two instances each test was being run in so that I could have the test connect to the correct instance of the server. Is there some way to tell which thread is currently active?

1 Answer 1


Have you tried build in 'process' module:

var process = require('process'); 

if (process.pid) {
  console.log('This process is your pid ' + process.pid);

Add this to before suite or test step

  • I haven't had a chance to try this because of other surprise work coming up, but doesn't everything run in the same process on the Node end? Commented Jan 29, 2021 at 3:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.