WebTau persona defines a user of your system with a context associated with that user. Example of context: authentication credentials, browser, custom config parameters. scenario('context example') { Alice { step("do something in context of Alice") { customAction() } } Bob { step("do same thing in context of Bob") { customAction() } } } Alice and Bob execute the same action. Within the action we can access who is the current persona and what is the payload of the persona. def customAction() { def id = Persona.currentPersona.id def authId = Persona.currentPersona.payload.authId // from persona payload def email = cfg.email // from persona associated config override step("custom action", [authId: authId, email: email]) { println "authenticating $id" } }
Persona is defined with persona . Persona can be created in place or in centralized place package personas import static org.testingisdocumenting.webtau.WebTauCore.persona class Personas { public static def Alice = persona("Alice", [authId: "alice-user-id"]) public static def Bob = persona("Bob", [authId: "bob-user-id"]) } Per persona config section let you define or override any config value, including timeouts, browser preferences, etc email = "default@email.send" customValue = 100 personas { Alice { email = "alice@email.send" customValue = 105 } Bob { email = "bob@email.send" customValue = 110 } } Snippet from above example to show how to access config values and payload def authId = Persona.currentPersona.payload.authId // from persona payload def email = cfg.email // from persona associated config override