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:
example
constWorker=this.require('common/worker');this.suite.context.set({ worker: newWorker(DEVICE_TYPE_SLUG, this.getLogger()), // Add an instance of worker to context});awaitthis.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.
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 aget()
method, to both add or fetch objects from the context. An example can be seen below:The context can be used to share anything between tests - device uuids, app names and so on.