-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: Is there a plan to provide mentioned unsupported-features
?
#29
Comments
The documented "unsupported" features were taken over from the original repo. With regards to brining support for these features, it depends on the needs of the community and the feasibility within K6. For example: Feel free to share missing features and use-cases, so we can discuss if they could fit postman-to-k6 conversion. |
sure thanks. At the moment, having |
I'm currently in the process of slowly creating a proof of concept for using postman-to-k6 for our QA team. Ideally we would need the |
@Kpizzle The pre-request scripts are supported, but the "pm.sendRequest" would be more difficult, since this concept does not really exist in the K6 concepts. As a work-around I do it like so:
A simplified example of a packages.json contains the steps mentioned: {
"name": "api-k6",
"version": "1.0.0",
"description": "API - K6 testing suite",
"scripts": {
"generate:k6:api:oauth:token": "node api.pipeline.env.js",
"generate:k6:api:pipeline": "postman-to-k6 api.postman.json --output k6-script.js --environment api.pipeline.env.json ",
"test:k6:api": "k6 run k6-script.js",
"generate:k6:report": "node utils/generateReport.js"
},
"dependencies": {
"@apideck/postman-to-k6": "^1.8.3",
"axios": "^0.24.0",
"dotenv": "^9.0.2",
"k6-html-reporter": "^1.0.5",
"k6-to-junit": "^1.0.3"
}
} Example of the const fs = require('fs');
const path = require('path');
const request = require('axios');
const dotenv = require('dotenv');
dotenv.config({path: __dirname + '/.env'});
if (!process.env.OAUTH_ACCESS_TOKEN_URL) {
console.log('No ENV variables or .env file found.')
process.exit(1)
}
const currentTime = new Date().getTime();
const requestOptions = {
url: process.env.OAUTH_ACCESS_TOKEN_URL,
method: 'POST',
headers: {"Content-Type": "application/json"},
data: JSON.stringify({
"client_id": process.env.OAUTH_CLIENT_ID,
"client_secret": process.env.OAUTH_CLIENT_SECRET,
"audience": process.env.OAUTH_AUDIENCE,
'account_id': process.env.OAUTH_ACCOUNT_ID,
"grant_type": "client_credentials"
})
};
request(requestOptions)
.then(function (res) {
const resBody = res.data
let postmanEnv = {
"id": "7796f73b-b0d8-4b1a-98c8-9951304740b8",
"name": "api-PIPELINE",
"values": [
{
"key": "baseUrl",
"value": process.env.BASEURL,
"enabled": true
},
{
"key": "oauth_access_token",
"value": resBody.access_token,
"enabled": true
},
{
"key": "oauth_access_token_expires",
"value": resBody.expires_in,
"enabled": true
},
{
"key": "oauth_access_token_url",
"value": process.env.OAUTH_ACCESS_TOKEN_URL,
"enabled": true
},
{
"key": "oauth_grant_type",
"value": "client_credentials",
"enabled": true
},
{
"key": "oauth_client_id",
"value": process.env.OAUTH_CLIENT_ID,
"enabled": true
},
{
"key": "oauth_client_secret",
"value": process.env.OAUTH_CLIENT_SECRET,
"enabled": true
},
{
"key": "oauth_audience",
"value": "https://audience.example",
"enabled": true
},
{
"key": "oauth_account_id",
"value": process.env.OAUTH_ACCOUNT_ID,
"enabled": true
},
{
"key": "oauth_base_url",
"value": process.env.OAUTH_BASE_URL,
"enabled": true
}
]
};
let postmanEnvOutput = JSON.stringify(postmanEnv, null, 2);
let currentFile = path.basename(__filename);
let postmanEnvFile = currentFile.substring(0, currentFile.length - 3);
fs.writeFileSync(__dirname + '/' + postmanEnvFile + '.json', postmanEnvOutput, 'utf8');
console.log('Auth0 access token updated');
})
.catch(function (err) {
// handle error
console.log(`POST ${process.env.OAUTH_ACCESS_TOKEN_URL} failure`, err.message)
process.exit(1)
}) so locally or in my CI/CD I use the following sequence: npm run generate:k6:api:oauth:token && npm run generate:k6:api:pipeline
npm run test:k6:api |
FYI: I have collected your question in the "discussions" section for future reference. |
Awesome @thim81 thanks very much! I'll have a deep-dive into this and continue the conversation in the discussion section. |
Is there any news or plans to support We rely a lot on validating response headers so this feature would be super useful for me and my team. |
I can investigate to see what is needed to bring the support. Could you share an example of what you would do with the pm.response.headers.*? |
hi @kgrozdanovski, Thanks to a contribution from @aegrey, postman-to-k6 supports 2 header methods: pm.response.headers.all() & pm.response.headers.get(). These are part of the v1.9.0 release. |
As per https://github.com/apideck-libraries/postman-to-k6#unsupported-features, some features are not supported (although this
pm.response.to.have.status(200);
worked for us!) which creates some blockers in converting our already written postman scripts to k6 scripts.Is there a plan to provide for those features? Until these are provided, any other workarounds for these missing features?
Thanks for maintaining this friendly fork!
The text was updated successfully, but these errors were encountered: