How to Insert or Add Transactions in K6 or.js Script

Hi Team,

Kindly help me How to Insert or Add Transaction Names in K6 Or.js Script

Thanks in advance!!

Regards,
Pench

Hi @Pench !

Welcome to community forums! :wave:

Could you please elaborate, what transaction names are?

Cheers!

Hi @olegbespalov ,

Transactions are used to measure the response time. For example, to measure the time that a user takes to login to an application, the associated events can be put into a transaction.

I want to see the response time on each and every request.

I’m just discovering the xk6-browser, I’ve run a few scripts with it and I’m curious if it’s possible to define our own transaction start and end points based on the property of the chosen object (as is the case with LoadRunner /Jmeter for example).

Here’s an example of what I mean: I’m buying an item and I want to start a transaction immediately before I click the “Submit Order” button. I check the page, and stop the transaction when the text “Your order has been submitted” appears on the screen.

I can guess that you can gain the benefits of the Tags and Groups.

Let me know if that helps,
Cheers!

First off, welcome. You obviously come from a LoadRunner/jmeter background.

Secondly, having come from a similar background I would strongly advise you try to drop that altogether. Forget the past and embrace the future :slight_smile: as the tools are vastly different and if you keep trying to correlate functionality from one to the other you will get very frustrated very fast. The good news is that k6 is a powerful tool and while you may not be able to accomplish some things in a manner quite as easily as before, you will have complete control over every aspect of your test down to the smallest detail.

And lastly, olegbespalov is correct. Tags and Groups will get you what you are looking for. Groups especially where ‘transactions’ are concerned.

Hope that all helps!!!