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
Updates documentation regarding the use of bUnit template for creating test projects that target xUnit, NUnit or MSTest testing framework.
refs: #129
Co-authored-by: Egil Hansen <egil@assimilated.dk>
Copy file name to clipboardExpand all lines: docs/site/docs/getting-started/create-test-project.md
+26-6Lines changed: 26 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,9 +5,9 @@ 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 in order 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 in order to write and run tests.
9
9
10
-
To use bUnit with xUnit, the easiest approach is to use the bUnit project template described in the [Create a test project with bUnit template](#creating-a-test-project-with-bunit-template) section further down the page. To create a test project manually and in a general-purpose testing frameworks agnostic way, read the following section.
10
+
To use bUnit, the easiest approach is to use the bUnit project template described in the [Create a test project with bUnit template](#creating-a-test-project-with-bunit-template) section further down the page. To create a test project manually and in a general-purpose testing frameworks agnostic way, read the following section.
The test projects setting needs to be set to the following:
60
+
The test projects setting needs to be set to the following:
61
61
62
62
- the project's SDK needs to be set to `Microsoft.NET.Sdk.Razor`
63
63
- set the `<TargetFramework>` to `net6.0`
@@ -176,7 +176,7 @@ The result should be a test project with a `.csproj` that looks like this (non b
176
176
177
177
## Creating a test project with bUnit template
178
178
179
-
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, but other frameworks will be supported in the future.
179
+
To skip a few steps in the guide above, use the [bUnit test project template](https://www.nuget.org/packages/bunit.template/).
180
180
181
181
The steps for creating a test project with the bUnit template are as follows:
182
182
@@ -198,11 +198,31 @@ dotnet new --install bunit.template::#{NBGV_NuGetPackageVersion}#
198
198
199
199
Use the following command to create a bUnit with xUnit test project:
200
200
201
+
# [xUnit](#tab/xunit)
202
+
201
203
```dotnetcli
202
-
dotnet new bunit -o <NAME OF TEST PROJECT>
204
+
dotnet new bunit --framework xunit -o <NAME OF TEST PROJECT>
203
205
```
204
206
205
-
The `-o` option in the `dotnet new` command above is used to specify the name of the test project.
207
+
# [NUnit](#tab/nunit)
208
+
209
+
```dotnetcli
210
+
dotnet new bunit --framework nunit -o <NAME OF TEST PROJECT>
211
+
```
212
+
213
+
# [MSTest](#tab/mstest)
214
+
215
+
```dotnetcli
216
+
dotnet new bunit --framework mstest -o <NAME OF TEST PROJECT>
217
+
```
218
+
219
+
***
220
+
221
+
The `--framework` option in the `dotnet new` command above is used to specify the unit testing framework used by the test project. If the `--framework` option is omitted, the default test framework `xunit` will be configured. Currently supported options are the following:
0 commit comments