Hi Team,
I have running my some of api test using k6, and there we push output in influx db v2 using GitHub - grafana/xk6-output-influxdb: k6 extension to output real-time test metrics to an InfluxDB 2.x database..
K6_INFLUXDB_ORGANIZATION=“” K6_INFLUXDB_TOKEN=“” ./k6 run -o xk6-influxdb=https://ip:8088/k6_performance script.js
Now I am trying to add a browser test in same suite using xk6-browser .i.e. both browser and api test together in a single file like -
import { chromium } from 'k6/x/browser';
import { check } from 'k6';
import http from 'k6/http';
export const options = {
scenarios: {
browser: {
executor: 'constant-vus',
exec: 'browser',
vus: 1,
duration: '10s',
},
news: {
executor: 'constant-vus',
exec: 'news',
vus: 20,
duration: '1m',
},
},
};
export function browser() {
const browser = chromium.launch({ headless: false });
const page = browser.newPage();
page
.goto('https://test.k6.io/browser.php', { waitUntil: 'networkidle' })
.then(() => {
page.locator('#checkbox1').check();
check(page, {
'checkbox is checked': (p) =>
p.locator('#checkbox-info-display').textContent() === 'Thanks for checking the box',
});
})
.finally(() => {
page.close();
browser.close();
});
}
export function news() {
const res = http.get('https://test.k6.io/news.php');
check(res, {
'status is 200': (r) => r.status === 200,
});
}
and to run this I am using
xk6-browser run script.js
but since I am using below command to push my results in influx db
K6_INFLUXDB_ORGANIZATION="" K6_INFLUXDB_TOKEN="" ./k6 run -o xk6-influxdb=https://ip:8088/k6_performance script.js
So I thought to replace
./k6 run with xk6-browser run
and my command looks like
K6_INFLUXDB_ORGANIZATION="" K6_INFLUXDB_TOKEN="" ./xk6-browser run -o xk6-influxdb=https://ip:8088/k6_performance script.js
But i am getting error as -
type not supported …invalid output type ‘xk6-influxdb’, , available types are: cloud, csv, experimental-prometheus-rw, influxdb, json, statsd
and if I am using “influxdb” in place of “xk6-influxdb” then getting error as influxdb v2 not supported
Any suggestions ?