Open Adrian-2705 opened 1 month ago
Hi @Adrian-2705
That is indeed not the desired behaviour. Would it be possible to share your postman collection so we can use it for debugging the conversion?
I ll look into it when back from vacation.
Hello @thim81 , I've attached the Postman collection for you to look over. testing k6.postman_collection.json Hopefully, you guys manage to fix the issue, or at least give me a pointer to where I am doing something wrong on my end. I've depleted all of my thoughts on how to fix the code and make it work.
hi @Adrian-2705
The reason it is using "string" values, is because in your Postman request you wrapped the Postman variables in "" which makes them strings.
If you remove the "" around your variables, Postman and K6 will handle them as Number values.
Postman
K6 Script
K6 Request Execution
Hello @thim81, I've tested what you showed me. I have the following results:
hi @Adrian-2705
The goal of the postman-to-k6 converter is that it generates the correct K6 scripts.
When doing the investigation, I used your Postman collection and made the elements unquoted, which led to the expected K6 scripts. So I'm surprised that you still ran into issues.
If you have more info to share, on what you had to correct so that I can review any changes in the postman-to-k6 converter?
Hi @thim81 I understand the purpose of postman-to-k6, and it should generate the correct scripts, but believe me, I still got the same result, issue in k6. I will do some digging to see if I can change anything else in my Postman test and not break it, and test the conversion to k6. I will share what I find tomorrow.
It might be helpfull for your debugging to trigger k6 with --http-debug="full"
example => k6 run k6/marvel.k6.js --http-debug="full"
Will use it, thank you
hi @Adrian-2705
Did you find anything that explains the behaviour or were able to reproduce or overcome it?
Hi @thim81 , Sorry for the delay, I've been testing, and trying different approaches, but I get the same result. This is the debug: `k6 run possible-fix.js --http-debug="full"
/\ |‾‾| /‾‾/ /‾‾/
/\ / \ | |/ / / /
/ \/ \ | ( / ‾‾\
/ \ | |\ \ | (‾) | / __ \ || __\ ___/ .io
execution: local
script: possible-fix.js
output: -
scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. graceful stop):
* default: 1 iterations for each of 1 VUs (maxDuration: 10m0s, gracefulStop: 30s)
INFO[0000] Request: POST /event/ HTTP/1.1 Host: localhost:5000 User-Agent: k6/0.53.0 (https://k6.io/) Content-Length: 167 Authorization: Basic aW5zcGlydXM6amU0cW9zM3cwMDc= Content-Type: application/x-www-form-urlencoded Accept-Encoding: gzip
event_data=map%5Bdocument_id%3A81890+validation_request_id%3A545851+validation_status%3Avalidated%5D&event_timestamp=1724861529&event_type=document.validation.response group= iter=0 request_id=cfa91ce2-1536-44dd-5c77-8934a4de151b scenario=default source=http-debug vu=1 INFO[0000] Response: HTTP/1.1 422 Unprocessable Entity Content-Length: 38 Access-Control-Allow-Origin: * Connection: keep-alive Content-Type: application/json; charset=utf-8 Date: Wed, 28 Aug 2024 16:12:09 GMT Etag: W/"26-ax897zOYepat8NqDEV12s361pqA" Keep-Alive: timeout=5 X-Powered-By: Express
{"errors":["Invalid event timestamp"]} group= iter=0 request_id=cfa91ce2-1536-44dd-5c77-8934a4de151b scenario=default source=http-debug vu=1 `
Hope it helps, Also I've change the pre-request-scripts from Postman.
As I said, I've managed to write the code manually for what I am testing without the convertion. It would've been a time saver if it worked. Please let me know what else I can provide to help fixing this issue.
Hi all! I have an issue with a converted test from Postman to k6. In Postman I am sending a payload body that has a number as a value, and the test passes, but the converted test in k6, sends the value as a string and the test fails. The issue here is that it needs to be a number, not a string, for the test to pass.