Skip to content

Provide extractors to work with raw cookie data #144

@nitrocode

Description

@nitrocode

I'm trying to do the following

  1. Run login test to grab the SESSION_ID cookie
  2. Run actual test using SESSION_ID cookie

Here is my YAML


---
- config:
    - testset: "Testing login..."

# This works
- test:
    - group: "Quickstart"
    - name: "Login"
    - url: "/api/v1/users/process-login"
    - method: "POST"
    - body: 'username=qa@testing.com&password=qa'
    - headers: {'Content-Type': 'application/x-www-form-urlencoded'}

# This does not because it doesn't use the cookie obtained in the previous test
- test:
    - group: "Quickstart"
    - name: "Get data"
    - url: "/api/v1/search"
    - method: "GET"
    - body: 'type=contacts'
    - headers: {'Content-Type': 'application/json'}

Is there a way I can write an extractor that will extract the cookie from the first test and push it into the second test?

I got the underlying curl commands to work:

loginurl="http://localhost:8888/api/v1/users/process-login"
# create cookie
curl -c mycookie "$loginurl" -d "username=qa@testing.com" -d "password=qa" --referer "$loginurl"
# use cookie
curl -b mycookie "http://localhost:8888/api/v1/search?type=contacts"

I could do this all in curl but I'd much rather use your YAML abstraction layer. Any advice on how to make my YAML connect to my API like I was able to using curl's cookie I/O?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions