choreo 0.13.0

DSL for BDD type testing.
Documentation
feature "HTTP GET then PUT workflow using httpbin"

settings {
    timeout_seconds = 30
    stop_on_failure = true
}

background {
    Web set_header "User-Agent" "choreo-test-runner/1.0"
    #Web set_header "Accept" "application/json"
    Web set_cookie "session_id" "abc123"
}

actors: Web

var FORM_DATA = "custname=test&custtel=1234567&custemail=test%40example.com&size=small&topping=cheese&delivery=11%3A15&comments=test"

scenario "POST data via httpbin REST API" {

    test GetInitialData "retrieve the current state of a resource" {
        given:
            # No preconditions needed
            Test can_start
            Web set_header "Accept" "application/json"
        when:
            Web http_get "https://httpbin.io/json"
        then:
            Web response_status_is 200
            Web response_body_contains "slideshow"
            Web json_body has_path "/slideshow/title"
    }

    test UpdateDataWithPut "update the resource with new data" {
        given:
            Test has_succeeded GetInitialData
            Web set_header "Content-Type" "application/json"
        when:
            Web http_put "https://httpbin.io/put" with_body "{\"updated\": true, \"timestamp\": \"2024-01-01\"}"
        then:
            Web response_status is_in [200, 204]
            Web response_body_contains "updated"
    }

    test PostRequestTest "Test POST request and response" {
        given:
            Test can_start
        when:
            Web set_header "Content-Type" "application/x-www-form-urlencoded"
            Web http_post "https://httpbin.io/post" with_body "${FORM_DATA}"
        then:
            Web response_status_is 200
    }

    test PatchWithFormDataTest "Test PATCH request with form data" {
        given:
            Test can_start
        when:
            Web set_header "Content-Type" "application/x-www-form-urlencoded"
            Web http_patch "https://httpbin.io/patch" with_body "key1=value1&key2=value2"
        then:
            Web response_status_is 200
            Web response_body_contains "form"
            Web json_body has_path "/form/key1"
            Web json_path at "/form/key1/0" equals "value1"
    }

    test DeleteTest "Test DELETE request" {
        given:
            Test can_start
        when:
            Web http_delete "https://httpbin.io/delete"
        then:
            Web response_status_is 200
            Web response_body_contains "delete"
            Web json_body has_path "/url"
            Web json_path at "/url" equals "http://httpbin.io/delete"
    }
}