Question on http.get

What’s your goal with testing? http.get() alone will only load the URL specified. However, if you are looking to test a user journey on a website, you may want to use the HAR-to-k6 converter to capture the additional requests. When using the converter you’ll notice that the main HTML is generally put into it’s own get, then additional assets are placed into a http.batch(). This results in that test emulating browser behavior from a request standpoint (requests in a batch are made in parallel up to limits specified in the batch/batchPerHost options). If you are using the LoadImpact cloud, we also have a chrome extension to aid in turning browser sessions → tests scripts. In short, it basically creates and converts a HAR file for you. I see many users use either option to create a “base script” when testing user journeys in web apps and websites, then they add additional logic to handle dynamic tokens, parameterize data, etc.

One last important thing to note, k6 (and LoadImpact) will never execute client side code nor render anything. We make requests and receive full responses. Going back to the above, CSS gets loaded, but not rendered. JS gets loaded, but not executed.

1 Like