citrusframework / citrusframework/yaks

Pet Store V3 addPet test - Values not equal for header element 'Content-Type', expected 'application/xml' but was 'application/json''

Open
#318 1 comment 0 reactions 0 assignees View on GitHub
help wanted question
Dominant language
Java
Stars
90
Forks
28
PR merge metrics
No merged PRs in 30d

Description

Steps to reproduce:

1. Go here as a reproducible K8s sandbox: https://katacoda.com/javajon/courses/kubernetes-applications/nginx

2. Install yaks CLI:
```
curl -Ls https://github.com/citrusframework/yaks/releases/download/v0.4.0/yaks-0.4.0-linux-64bit.tar.gz | \
tar -xzvf - -C /usr/local/bin ./yaks
```

3. Install operator: 'yaks install'

4. Add this file with `vim addpet.feature`:

```
Feature: Petstore API V3

Background:
Given OpenAPI specification: https://petstore3.swagger.io/api/v3/openapi.json/
Given URL: https://petstore3.swagger.io/

Scenario: addPet
When invoke operation: addPet
Then verify operation result: 200 OK
```

5. Run test: `yaks test addpet.feature`

Notice in the output:

```
kubectl get tests
NAME PHASE TOTAL PASSED FAILED SKIPPED ERRORS
ap Failed 1 1 ["'addPet' (ap.feature:7) failed with 'Validation failed: Values not equal for header element 'Content-Type', expected 'application/xml' but was 'application/json''"]
```
I'm getting this with getPetById too.

Wouldn't yaks/citrus during the `When invoke operation: addPet` be choosing a content type from the specification and setting the same expected content-type during the `Then verify result:`?

Is my setting of the 2 Background.Givens incorrect?

I'm not seeing ideas in the documentation/example that I should be doing anything different. I don't understand what is missing or perhaps this is a bug?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the failure with the provided addpet.feature, the Petstore V3 OpenAPI specification, and `yaks test addpet.feature`. Inspect how `When invoke operation: addPet` and `Then verify operation result: 200 OK` determine Content-Type; done means the test uses the specification's expected media type consistently or clearly documents the required setup.

Written by the indexing model from the issue text.

Assessment

Tech stack
kubernetes, openapi
Domain
api, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.