Skip to content
This repository has been archived by the owner on Nov 23, 2021. It is now read-only.

K6 not running all the apis in a file #64

Closed
PoojaKokilXor opened this issue Jul 30, 2020 · 1 comment
Closed

K6 not running all the apis in a file #64

PoojaKokilXor opened this issue Jul 30, 2020 · 1 comment

Comments

@PoojaKokilXor
Copy link

PoojaKokilXor commented Jul 30, 2020

I have generated a script file by using openAPIgenerator but while running it through K6, its skipping some APIs. It is not giving any error. Can you suggest me a way to find out why it is skipping that and how can I debug it?
Example API:

import http from "k6/http";
import { group, check, sleep } from "k6";

const BASE_URL = "http://host:port";
// Sleep duration between successive requests.
// You might want to edit the value of this variable or remove calls to the sleep function on the script.
const SLEEP_DURATION = 0.1;
let body = "";

        let file = {"file": http.file(open("D:/test/file.yaml", "b"), "file.yaml")};
let authorization = "";

export default function() {
      group("/api/v1/upload-file", () => {
        let userId = 2;
        let url = BASE_URL + `/api/v1/upload-file`;
        // Request No. 1
        // TODO: edit the parameters of the request body.

        let params = {headers: {"Content-Type": "multipart/form-data", "Authorization": `${authorization}`, "Accept": "*/*"}};
        let request = http.post(url, file, params);
        check(request, {
            "OK": (r) => r.status === 200
        });
        sleep(SLEEP_DURATION);
    });
}
@na--
Copy link
Member

na-- commented Jul 30, 2020

This question seems better suited for the community forum. In any case, you can debug your scripts with console.log() and dumping parts of the HTTP Response object, or maybe by running k6 with --http-debug.

Edit: the script you posted seems fine to me, at a quick glance...

@na-- na-- closed this as completed Jul 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants