Module Context

Context

The context class lets you share instances of objects across different tests. For example, if we made an instance of the worker class in a suite, as above, other tests would not be able to see it. An instance of the context class has a set() and a get() method, to both add or fetch objects from the context. An example can be seen below:

const Worker = this.require('common/worker');
this.suite.context.set({
worker: new Worker(DEVICE_TYPE_SLUG, this.getLogger()), // Add an instance of worker to context
});
await this.context.get().worker.flash() // Flash the DUT with the worker instance from context

The context can be used to share anything between tests - device uuids, app names and so on.

Index

Classes