
co.poynt.postman.js.PostmanJsVariables Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of postman-runner Show documentation
Show all versions of postman-runner Show documentation
A module to run a POSTMAN collections.
The newest version!
package co.poynt.postman.js;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.mozilla.javascript.Context;
import org.mozilla.javascript.NativeArray;
import org.mozilla.javascript.NativeObject;
import org.mozilla.javascript.Scriptable;
import org.mozilla.javascript.ScriptableObject;
import co.poynt.postman.model.PostmanEnvValue;
import co.poynt.postman.model.PostmanEnvironment;
import co.poynt.postman.runner.PostmanHttpResponse;
public class PostmanJsVariables {
// ============================================================
// The members of this class are equivalent to the POSTMAN
// global variables available inside a POSTMAN test script.
// As defined here http://www.getpostman.com/docs/jetpacks_writing_tests
public Object responseBody;
public NativeArray responseHeaders;
public Object responseTime;
public NativeObject responseCode;
public Object iteration;
public Object postman;
public NativeObject environment;
public NativeObject tests;
public NativeObject preRequestScript;
// ============================================================
private Context ctx;
private Scriptable scope;
private PostmanEnvironment env;
public PostmanJsVariables(Context ctx, Scriptable scope, PostmanEnvironment env) {
this.ctx = ctx;
this.scope = scope;
this.env = env;
}
public void prepare(PostmanHttpResponse httpResponse) {
this.prepareJsVariables(httpResponse);
this.injectJsVariablesToScope();
}
private void prepareJsVariables(PostmanHttpResponse httpResponse) {
this.responseCode = new NativeObject();
if (httpResponse != null) {
List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy