Skip to content
Igor Gursky edited this page Sep 26, 2016 · 3 revisions

Cukes-REST supports external plugins to be added to your QA setup.

First, you have to create a class, that implements "CukesRestPlugin" interface, overriding Before and After execution stages. This was you can perfectly choose a stage to inject your custom code to.

Example for custom authentication mechanism:

public class CustomCukesRestPlugin implements CukesRestPlugin {

@Override
public void beforeAllTests() {
   //custom logic goes here
}

@Override
public void afterAllTests() {
}

@Override
public void beforeScenario() {
    //retrieve new access token
}

@Override
public void afterScenario() {
    //clean previous tokens
}

@Override
public void afterRequest() {
    //custom response logging etc.
}

@Override
public void beforeRequest() {
   //apply some custom request/global settings
}
Clone this wiki locally