Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

However, GINT based test or automation scripts normally use a separate CLI action per testcase and therefore there is no session affinity unless some additional work is done. Here is what to add to the script to enable this. Basically, all you need to do is login and use the session token provide in subsequent actions.

These examples require Release 2.8 or higher.

Example - Jira

Code Block
languagegroovy
...
includeTool << GintForJira
...
def info = gint.getServerInfoWithVerify()  // verify server is available, otherwise end test
...
gint.add(
    action: 'login', description: 'Get a login token for session affinity and change the default jira command generator to use it',
    neededBy: true, // make sure this testcase runs before any other testcase
    finalClosure: { testcase ->
        def parameters = gint.getCmdGeneratorParameters() + [cli: helper.getParameterValueWithExtendedLookup('cli') + ' --login ' + testcase.outData[0]]
        gint.setCmdGenerator(gint.getGintCmdGenerator().getGenerator('confluenceMacro', parameters))
    },
)

// Clean-up the session at the end
target(name: 'final', description: 'Run this last', prehook: [], posthook: []) {
    helper.runCmd(cmd: gint.getCmd(action: 'logout')) // getCmd uses the jira command generator 
}

...