You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: learn-pr/wwl-azure/develop-unit-tests-using-github-copilot-tools/7-knowledge-check.yml
+15-15Lines changed: 15 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -50,25 +50,25 @@ quiz:
50
50
- content: "To check if the function returns the expected output."
51
51
isCorrect: false
52
52
explanation: "Incorrect. Generating assertions for function input parameters is not primarily done to check the function's output."
53
-
- content: "What does the GitHub Copilot extension for Visual Studio Code provide when creating unit tests for specific conditions?"
53
+
- content: "What are the three built-in agents available in the Chat view for creating unit tests?"
54
54
choices:
55
-
- content: "It provides a user interface for manually writing tests."
55
+
- content: "Ask, Edit, and Agent."
56
56
isCorrect: false
57
-
explanation: "Incorrect. GitHub Copilot does not provide a user interface for writing tests. GitHub Copilot suggests completions and generates tests."
58
-
- content: "It automatically runs the tests and provides the results."
59
-
isCorrect: false
60
-
explanation: "Incorrect. GitHub Copilot does not run tests. GitHub Copilot helps generate them."
61
-
- content: "It suggests completions and generates tests based on the code context."
57
+
explanation: "Incorrect. Edit mode has been replaced. The three built-in agents available in the Chat view are Ask, Plan, and Agent."
58
+
- content: "Ask, Plan, and Agent."
62
59
isCorrect: true
63
-
explanation: "Correct. GitHub Copilot suggests completions and generates tests based on the code context."
64
-
- content: "What is the benefit of using GitHub Copilot for generating unit tests?"
60
+
explanation: "Correct. The Chat view provides three built-in agents: Ask for answering questions, Plan for creating structured implementation plans before writing code, and Agent for agentic coding workflows."
61
+
- content: "Plan, Debug, and Agent."
62
+
isCorrect: false
63
+
explanation: "Incorrect. Debug is not a built-in agent in the Chat view. The three built-in agents are Ask, Plan, and Agent."
64
+
- content: "What is the purpose of the Plan agent in the Chat view?"
65
65
choices:
66
-
- content: "It reduces the need for manual testing."
66
+
- content: "It automatically implements code changes across multiple files in the workspace."
67
67
isCorrect: false
68
-
explanation: "Incorrect. While GitHub Copilot helps generate unit tests, it does not eliminate the need for manual testing."
69
-
- content: "It can suggest a range of unit tests based on the code context, saving development time."
68
+
explanation: "Incorrect. The Plan agent does not make code changes. The Plan agent creates a structured implementation plan, which can then be handed off to the Agent for implementation."
69
+
- content: "It creates a structured, step-by-step implementation plan before writing any code."
70
70
isCorrect: true
71
-
explanation: "Correct. GitHub Copilot can suggest a range of unit tests based on the code context, which can save development time."
72
-
- content: "It automatically fixes bugs in the code."
71
+
explanation: "Correct. The Plan agent researches the task comprehensively, asks clarifying questions, and produces a step-by-step plan. Once the plan is reviewed and approved, it can be handed off to the Agent for implementation."
72
+
- content: "It runs tests and generates test reports for the project."
73
73
isCorrect: false
74
-
explanation: "Incorrect. GitHub Copilot does not fix bugs. GitHub Copilot helps generate unit tests."
74
+
explanation: "Incorrect. The Plan agent does not run tests or generate reports. The Plan agent creates a detailed implementation plan that can be handed off to the Agent for implementation."
Copy file name to clipboardExpand all lines: learn-pr/wwl-azure/develop-unit-tests-using-github-copilot-tools/includes/2-examine-github-copilot-support-unit-tests.md
+15-15Lines changed: 15 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,17 +7,17 @@ GitHub Copilot Chat uses your code's context and semantics to suggest assertions
7
7
8
8
## GitHub Copilot support for unit testing
9
9
10
-
Copilot can help with the following testing tasks:
10
+
GitHub Copilot can help with the following testing tasks:
11
11
12
12
- Set up testing frameworks: get help configuring the right testing framework and VS Code extensions for your project and language.
13
13
- Generate test code: create unit tests, integration tests, and end-to-end tests that cover your application code.
14
14
- Handle edge cases: generate comprehensive test suites to cover edge cases and error conditions.
15
15
- Fix failing tests: receive suggestions for fixing test failures.
16
-
- Maintain consistency: personalize Copilot to generate tests that follow your project's coding practices.
16
+
- Maintain consistency: personalize GitHub Copilot to generate tests that follow your project's coding practices.
17
17
18
18
### Set up your testing framework
19
19
20
-
To accelerate your testing workflow, Copilot can help set up the testing framework and VS Code extensions for your project. Copilot suggests appropriate testing frameworks based on your project type.
20
+
To accelerate your testing workflow, GitHub Copilot can help set up the testing framework and VS Code extensions for your project. GitHub Copilot suggests appropriate testing frameworks based on your project type.
21
21
22
22
1. Open the Chat view.
23
23
@@ -31,35 +31,35 @@ GitHub Copilot can help you write tests for your application code by generating
31
31
32
32
You can generate unit tests using the following GitHub Copilot tools:
33
33
34
-
-**Chat view**: Use the Chat view generate unit tests for a project, class, or method using Ask, Edit, or Agent mode.
34
+
-**Chat view**: Use the Chat view to generate unit tests for a project, class, or method using the Ask, Plan, or Agent.
35
35
-**Inline Chat**: Use Inline Chat to generate unit tests for selected classes or methods.
36
36
-**Smart actions**: Use the Generate Tests smart action to generate unit tests for selected code without writing a prompt.
37
37
-**Code line completions**: Use code line completions to suggest addition unit tests for an existing test case.
38
38
39
39
### Fix failing tests
40
40
41
-
Copilot integrates with the Test Explorer in Visual Studio Code and can help with fixing failing tests.
41
+
GitHub Copilot integrates with the Test Explorer in Visual Studio Code and can help with fixing failing tests.
42
42
43
43
1. In the Test Explorer, hover over a failing test.
44
44
45
45
1. Select the **Fix Test Failure** button (sparkle icon)
46
46
47
-
1. Review and apply Copilot's suggested fix.
47
+
1. Review and apply GitHub Copilot's suggested fix.
48
48
49
49
Alternatively, you can:
50
50
51
51
1. Open the Chat view.
52
52
53
53
1. Enter the `/fixTestFailure` slash command.
54
54
55
-
1. Follow Copilot's suggestions to fix the test
55
+
1. Follow GitHub Copilot's suggestions to fix the test
56
56
57
57
> [!TIP]
58
-
> Agent mode monitors the test output when running tests, and automatically attempts to fix and rerun failing tests.
58
+
> When using agents, the agent monitors the test output when running tests, and automatically attempts to fix and rerun failing tests.
59
59
60
60
### Maintain consistency
61
61
62
-
If your organization has specific testing requirements, you can customize how Copilot generates tests to ensure they meet your standards. You can personalize how Copilot generates tests by providing custom instructions. For example:
62
+
If your organization has specific testing requirements, you can customize how GitHub Copilot generates tests to ensure they meet your standards. You can personalize how GitHub Copilot generates tests by providing custom instructions. For example:
63
63
64
64
- Specify preferred testing frameworks
65
65
- Define naming conventions for tests
@@ -171,19 +171,19 @@ This process creates a new project and configures the test runner for the select
171
171
172
172
### Generate unit test cases using GitHub Copilot Chat
173
173
174
-
GitHub Copilot Chat can be used to help you write unit test cases for your test framework. Copilot Chat recognizes your test framework and coding style and generates matching code snippets. You can use Copilot Chat to complete the following tasks:
174
+
GitHub Copilot Chat can be used to help you write unit test cases for your test framework. GitHub Copilot Chat recognizes your test framework and coding style and generates matching code snippets. You can use GitHub Copilot Chat to complete the following tasks:
175
175
176
-
- Write unit test cases for your test framework based on the code open in the editor or the code snippet you highlight in the editor. Copilot identifies your test framework and coding style and generates matching code snippets.
176
+
- Write unit test cases for your test framework based on the code open in the editor or the code snippet you highlight in the editor. GitHub Copilot identifies your test framework and coding style and generates matching code snippets.
177
177
178
-
- Identify and write test cases for edge cases and boundary conditions that might be difficult to identify manually. For instance, Copilot can suggest test cases for error handling, null values, or unexpected input types.
178
+
- Identify and write test cases for edge cases and boundary conditions that might be difficult to identify manually. For instance, GitHub Copilot can suggest test cases for error handling, null values, or unexpected input types.
179
179
180
180
- Suggest assertions that ensure the function is working correctly, based on the code's context and semantics. For example, generate assertions to ensure that function input parameters are valid.
181
181
182
-
Consider the following scenarios when asking Copilot Chat to generate unit test cases:
182
+
Consider the following scenarios when asking GitHub Copilot Chat to generate unit test cases:
183
183
184
-
- If a single method is visible in full in the editor, you could ask Copilot Chat to generate a unit test for the method by typing `Write a unit test for the method in the #editor`.
184
+
- If a single method is visible in full in the editor, you could ask GitHub Copilot Chat to generate a unit test for the method by typing `Write a unit test for the method in the #editor`.
185
185
186
-
- If there are multiple methods visible or the intended method extends beyond what's visible in the editor, select the code you want to generate a unit test for, then ask Copilot: `#selection write a unit test for this code`.
186
+
- If there are multiple methods visible or the intended method extends beyond what's visible in the editor, select the code you want to generate a unit test for, then ask GitHub Copilot: `#selection write a unit test for the selected code`.
187
187
188
188
### Run and manage unit tests in Visual Studio Code
Copy file name to clipboardExpand all lines: learn-pr/wwl-azure/develop-unit-tests-using-github-copilot-tools/includes/3-create-unit-tests-generate-tests-smart-action.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ To generate unit tests for a file, follow these steps:
10
10
11
11
1. Open the file that contains the code you want to test.
12
12
13
-
1. Right-click inside the code editor, select **Copilot**, and then select **Generate Tests**.
13
+
1. Right-click inside the code editor, select **Generate Code**, and then select **Generate Tests**.
14
14
15
15
1. GitHub Copilot analyzes the code and generates unit tests for all functions and methods in the file.
16
16
@@ -44,7 +44,7 @@ To generate unit tests for a selection of code, follow these steps:
44
44
45
45
1. Select the code block that you want to test.
46
46
47
-
1. Right-click the selected code, select **Copilot**, and then select **Generate Tests**.
47
+
1. Right-click the selected code, select **Generate Code**, and then select **Generate Tests**.
48
48
49
49
1. GitHub Copilot analyzes the selected code and generates unit tests for the selected function or method.
Copy file name to clipboardExpand all lines: learn-pr/wwl-azure/develop-unit-tests-using-github-copilot-tools/includes/4-create-unit-tests-inline-chat.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ To create unit tests using Inline Chat, follow these steps:
20
20
21
21
You can make adjustments, such as changing the test names, modifying or removing test cases, or adding additional assertions.
22
22
23
-
The generated tests are displayed in the code editor. Copilot generates test code in an existing test file, or creates a new test file if one doesn't exist.
23
+
The generated tests are displayed in the code editor. GitHub Copilot generates test code in an existing test file, or creates a new test file if one doesn't exist.
24
24
25
25
1. Select **Accept** or **Close** to accept or discard the suggested unit tests.
0 commit comments