Develop unit tests using GitHub Copilot
In this lab, you will learn how to use GitHub Copilot to generate comprehensive unit tests for your code. Writing tests is crucial for maintaining code quality, but it can be time-consuming. GitHub Copilot can help you generate thorough test cases quickly, including edge cases you might not have considered.
You will learn how to:
- Use the Chat view and Agent to create a new test class.
- Use the Chat view and Agent mode to create unit tests.
This lab takes approximately 25-35 minutes to complete.
Before you start
To complete the lab, you need:
- A GitHub user account with access to GitHub Copilot.
- Basic understanding of unit testing concepts.
- Familiarity with a testing framework (e.g., Jest, pytest, JUnit).
- A web browser with access to the internet.
Complete the exercise on Microsoft Learn
In this exercise, you'll learn to develop unit tests using GitHub Copilot.
Note: This exercise demonstrates how AI can help you write comprehensive tests more efficiently.
The exercise consists of the following activities:
-
Start a web browser and navigate to the exercise page: https://microsoftlearning.github.io/mslearn-github-copilot-dev/Instructions/Labs/LAB_AK_04_develop_unit_tests_xunit.html
-
Follow the instructions provided in the exercise to complete all challenges.
-
Work through each step, using GitHub Copilot to generate comprehensive unit tests.
-
When you finish, return to the module for a knowledge check and completion badge.
What you've learned
After completing this exercise, you should be able to:
- Use the Chat view and Agent to create a new test class.
- Use the Chat view and Agent mode to create unit tests.
Congratulations! You've completed the unit testing exercise!