New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test Case: Add include magic comment #58

Merged
merged 2 commits into from Oct 25, 2018

Conversation

Projects
None yet
1 participant
@tisba
Copy link
Member

tisba commented Oct 17, 2018

With this PR you can now do simple client-side includes. This is a prototype and has to be seen as a first approach to make test cases more modular.

Given a test case like this:

definition.setTarget("testapp.loadtest.party");

definition.setArrivalPhases([{
    duration: 5 * 60,
    rate: 50,
    max_users: 2000
  },
]);

//#include ./session_base.js

//#include /Users/basti/Documents/src/golang/src/github.com/stormforger/cli/testdata/cases/includes/helpers.js

function otherHelpers() {
  // ...
}

using test-case update or test-case create commands, will yield in a case like this:

definition.setTarget("testapp.loadtest.party");

definition.setArrivalPhases([{
    duration: 5 * 60,
    rate: 50,
    max_users: 2000
  },
]);


// == start include (testdata/cases/includes/session_base.js)
definition.session("base", function (session) {
  session.get("/users/configuration", {
    gzip: true,
    tag: "user_configuration",
    headers: {
      "Accept": "application/json",
      "X-DemoApp-Token": session.matchedValue("authenticationToken"),
    },
  });

  session.wait(2, {
    random: true
  });
});
// == end include (testdata/cases/includes/session_base.js)

// == start include (/Users/basti/Documents/src/golang/src/github.com/stormforger/cli/testdata/cases/includes/helpers.js)
function helper1() {
  // ...
}

function helper2() {
  // ...
}
// == end include (/Users/basti/Documents/src/golang/src/github.com/stormforger/cli/testdata/cases/includes/helpers.js)

function otherHelpers() {
  // ...
}

@tisba tisba force-pushed the client-side-includes branch 2 times, most recently from 4f52034 to 7fa7dd9 Oct 17, 2018

@tisba tisba force-pushed the client-side-includes branch from 7fa7dd9 to 619e294 Oct 17, 2018

@tisba tisba merged commit 47720be into master Oct 25, 2018

1 check passed

continuous-integration/travis-ci/push The Travis CI build passed
Details

@tisba tisba deleted the client-side-includes branch Oct 25, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment