xk6-udp
A k6 extension for sending data to UDP port
Build
To build a k6
binary with this plugin, first ensure you have the prerequisites:
Then:
- Install
xk6
:
go install go.k6.io/xk6/cmd/xk6@latest
- Build the binary:
xk6 build master \
--with github.com/dhruvit96/xk6-udp
Example
import udp from 'k6/x/udp';
import { check } from 'k6';
const conn = udp.connect('host:port');
export default function () {
udp.write(conn, 'Say Hello');
let res = String.fromCharCode(...udp.read(conn, 1024))
check (res, {
'verify ag tag': (res) => res.includes('Hello')
});
}