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: docs/site/docs/getting-started/create-test-project.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,13 +5,13 @@ title: Creating a new bUnit Test Project
5
5
6
6
# Creating a new bUnit Test Project
7
7
8
-
To write tests, you need a place to put them - a test project. bUnit is not a unit test runner, so a general-purpose test framework, like xUnit, NUnit, or MSTest, is needed, in addition to bUnit, to write and run tests.
8
+
To write tests, you need a place to put them - a test project. bUnit is not a unit test runner, so a general-purpose test framework, like xUnit, NUnit, or MSTest, is needed in addition to bUnit, to write and run tests.
9
9
10
-
To use bUnit with xUnit, the easiest approached is using the bUnit project template described in the [Create a test project with bUnit template](#create-a-test-project-with-bunit-template) section further down the page. To create a test project manually in a general-purpose testing frameworks agnostic way, read the following section.
10
+
To use bUnit with xUnit, the easiest approached is to use the bUnit project template described in the [Create a test project with bUnit template](#create-a-test-project-with-bunit-template) section further down the page. To create a test project manually, in a general-purpose testing frameworks agnostic way, read the following section.
11
11
12
12
## Create a Test Project Manually
13
13
14
-
This section will take you through the steps listed below to manually create a project for testing Blazor components, that uses either of three general purpose test frameworks. Read the rest of the section to get the all the details. Skip any steps you have already previously completed, e.g. if you already have a test project.
14
+
This section will take you through the steps required to create a project for testing Blazor components using bUnit. Any of the three general purpose test frameworks shown in step 1 below can be used.
15
15
16
16
1. Create a new xUnit/NUnit/MSTest testing project
17
17
2. Add bUnit to the test project
@@ -44,11 +44,11 @@ dotnet new mstest -o <NAME OF TEST PROJECT>
44
44
45
45
***
46
46
47
-
where `-o <NAME OF PROJECT>`is used to name the test project.
47
+
where `-o <NAME OF PROJECT>`refers to the name of the test project.
48
48
49
49
**2. Add bUnit to the test project**
50
50
51
-
To add bUnit to the test project, change to the newly created test projects folder and then use the following command:
51
+
To add bUnit to the test project, change to the newly created test projects folder and use the following command:
The test projects setting needs to be set accordingly:
79
+
The test projects setting needs to be set to the following:
80
80
81
81
- the project's SDK to `Microsoft.NET.Sdk.Razor`
82
82
- set `RazorLangVersion` to `3.0`
@@ -99,14 +99,14 @@ To do so, change the first part of the test projects `.csproj` file to look like
99
99
100
100
**4. Add the test project to your solution**
101
101
102
-
If using Visual Studio, add the test project to your solution (`.sln`), and add a reference between the test project and project containing the components that should be tested:
102
+
If using Visual Studio, add the test project to your solution (`.sln`), and add a reference between the test project and project containing the components that are to be tested:
103
103
104
104
```dotnetcli
105
105
dotnet sln <NAME OF PROJECT>.sln add <NAME OF TEST PROJECT>
106
106
dotnet add <NAME OF COMPONENT PROJECT>.csproj reference <NAME OF TEST PROJECT>.csproj
107
107
```
108
108
109
-
The result should be a test project with a `.csproj` that looks like this (other packages than bUnit might have different version numbers):
109
+
The result should be a test project with a `.csproj` that looks like this (non bUnit packages may have different version numbers):
110
110
111
111
# [xUnit](#tab/xunit)
112
112
@@ -188,7 +188,7 @@ The result should be a test project with a `.csproj` that looks like this (other
188
188
189
189
## Create a Test Project with bUnit Template
190
190
191
-
To skip a few steps in the guide above, use the [bUnit test project template](https://www.nuget.org/packages/bunit.template/). The bUnit project template is only available for using with xUnit as the general-purpose testing framework, but that will change in the future.
191
+
To skip a few steps in the guide above, use the [bUnit test project template](https://www.nuget.org/packages/bunit.template/). The bUnit project template currently only works with the xUnit general-purpose testing framework, others framework will be supported in the future.
192
192
193
193
The steps are as follows:
194
194
@@ -229,4 +229,4 @@ dotnet add <NAME OF COMPONENT PROJECT>.csproj reference <NAME OF TEST PROJECT>.c
229
229
230
230
To start creating tests, continue reading the <xref:writing-csharp-tests> and <xref:writing-razor-tests> pages.
231
231
232
-
For addition tips and tricks that will make writing tests easier, see the <xref:misc-test-tips> page.
232
+
For addition tips and tricks that will make writing tests easier, see the <xref:misc-test-tips> page.
0 commit comments