mercredi 24 avril 2019

Manually create JUnit Result object

For one use-case, I trigger tests on an external cloud service which requires the upload of our entire test suite. I still want this process to be encapsulated into a JUnit runner, so I trigger the tests like this (on my local machine/our own infrastructure):

@Override
public void run(RunNotifier notifier) {
  if (someCondition) {
    new DelegateRunner().run(notifier);
  } else {
    super.run(notifier);
  }
}

The DelegateRunner then calls a third-party service which triggers the tests on the cloud. How can I map the results I receive from this service back to my local JUnit execution?

RunNotifier offers methods like fireTestFinished or fireTestFailure but I'm not sure how to build the objects (Result, Description, Failure) these methods take as parameters.

I suspect I need to make use of test listeners but I couldn't figure out the details.

Aucun commentaire:

Enregistrer un commentaire