Github Copilot: A Practical Overview with k6

Yusuf Tayman
Dec 27, 2021 · 3 min read

What is the Github-Copilot?

Basically, Copilot is a cloud service. The cloud service is a code prediction engine powered by OpenAI Codex, a language model trained on billions of code.

Also, you need to know that Codex is a code _synthesizer_, not a search engine.

How does Github-Copilot work?

Copilot editor extension sends your comments and code to the GitHub Copilot service, which then uses OpenAI Codex to synthesize and suggest code. it actually works by reading through all the open-source code on the GitHub repos and then collecting the data and trying to find the best possible code related to it!

You can think of the Github co-pilot as your pair programming friend. Copilot only offers you the codes it has seen before or the code samples you use in your project.

Overview Github-Copilot x k6

First of all, we need to specify options for the load test, for example, how many minutes will we create a load. You can see in the example below how we can quickly create this test without knowing it.

In the example below, you can see how we created a simple get request with copilot with the JSON placeholder fake API.
While creating this load test, we have also performed our status code control by using the k6 check method. The main reason we use k6 is that it provides support with a lightweight language such as javascript.

Now let’s use the k6 group feature, you could use groups to organize multiple requests and different scenarios. I want to group POSTS and COMMENTS endpoints, what we need to do is very simple.

Conclusion

As a result, while you can write load tests very quickly with k6, with GitHub-Copilot this speed is very high and you can manage your time better. Let’s not forget that Copilot, our pair programming friend, will never take our job, don’t believe in such things, we just know how to use it effectively. 🤓

Geek Culture

Proud to geek out. Follow to join our +1.5M monthly readers.