Skip to content

Commit 4c6fa72

Browse files
committed
Updated docs frontpage
1 parent 8271c21 commit 4c6fa72

3 files changed

Lines changed: 56 additions & 14 deletions

File tree

docs/docs/index.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
# Introductions
2-
3-
Before you start writing your first test, it is highly recommended that you go read the [Getting started](/docs/getting-started.html) page, which will explain the difference between testing normal classes and Blazor/Razor components.
1+
# Getting started with bUnit

docs/index.md

Lines changed: 54 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,64 @@
1-
[![GitHub stars](https://img.shields.io/github/stars/egil/bunit?style=flat-square)](https://github.com/egil/bunit)
1+
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/egil/bunit/CI?logo=github&style=flat-square)](https://github.com/egil/bunit/actions?query=workflow%3ACI)
22
[![GitHub tag (latest SemVer pre-release)](https://img.shields.io/github/v/tag/egil/bunit?include_prereleases&logo=github&style=flat-square)](https://github.com/egil/bunit/releases)
33
[![Nuget](https://img.shields.io/nuget/dt/bunit?logo=nuget&style=flat-square)](https://www.nuget.org/packages/bunit/)
4-
[![Gitter](https://img.shields.io/gitter/room/egil/bunit?logo=gitter&style=flat-square)](https://gitter.im/egil/bunit?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
5-
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/egil/bunit/CI?logo=github&style=flat-square)](https://github.com/egil/bunit/actions?query=workflow%3ACI)
64
[![Issues Open](https://img.shields.io/github/issues/egil/bunit.svg?style=flat-square&logo=github)](https://github.com/egil/bunit/issues)
5+
[![Gitter](https://img.shields.io/gitter/room/egil/bunit?logo=gitter&style=flat-square)](https://gitter.im/egil/bunit?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
6+
7+
# bUnit - a testing library for Blazor components
8+
9+
**bUnit** is a testing library for Blazor Components. You can:
10+
11+
- Setup and define components under tests in C# or Razor syntax
12+
- Verify outcome using semantic HTML diffing/comparison logic
13+
- Interact with and inspect components
14+
- Trigger event handlers
15+
- Provide cascading values
16+
- Inject services
17+
- Mock `IJsRuntime`
18+
- Perform snapshot testing
19+
20+
The library builds on top of existing unit testing frameworks such as xUnit, which runs the Blazor components tests, just as any normal unit test.
21+
22+
The library's goal is to make it easy to write _comprehensive, stable unit tests_ for Blazor Components/Razor Components.
23+
24+
For example, to test the [`Counter.razor`](https://github.com/egil/bunit/blob/master/sample/src/Pages/Counter.razor) component that is part of the Blazor "file-new-project" project, you can do the following, using bUnit and xUnit:
25+
26+
```csharp
27+
[Fact]
28+
public void CounterShouldIncrementWhenClicked()
29+
{
30+
// Arrange: render the Counter.razor component
31+
var cut = RenderComponent<Counter>();
32+
33+
// Act: find and click the <button> element to increment
34+
// the counter in the <p> element
35+
cut.Find("button").Click();
36+
37+
// Assert: first find the <p> element, then verify its content
38+
cut.Find("p").MarkupMatches("<p>Current count: 1</p>");
39+
}
40+
```
41+
42+
**Go to [Documentation](/docs) to learn more.**
43+
44+
## Milestones to v1.0.0
745

8-
# bUnit - a testing library for Blazor Components
46+
These are the current goals that should be reached before v1.0.0 is ready:
947

10-
**bUnit**, previously known as **Blazor Components Testing Library**, is a unit testing library for Blazor Components. You can easily define components under test in C# or Razor syntax, and verify outcome using semantic HTML diffing/comparison logic. You can interact with and inspect components, trigger event handlers, provide cascading values, inject services, mock IJsRuntime, and perform snapshot testing.
48+
- **Stabilize the APIs**, such that they work equally well with both xUnit, Nunit, and MSTest as the underlying test framework. The general goals is to make it easy and obvious for developers to create the tests they needed, and fall into the pit of success.
49+
- **Get the Razor-based testing to stable**, e.g. make the discovery and running of tests defined in .razor files stable and efficient. This includes adding support for Nunit and MSTest as test runners.
50+
- **Improve the documentation**. Currently there are a list of "How to" guides planned in the [Update Docs](https://github.com/egil/bunit/issues?q=is%3Aopen+is%3Aissue+milestone%3A%22updated+docs%22) milestone.
51+
- **Join the .NET Foundation.**. This project is too large for one person to be the owner and be the sole maintainer of, so the plan is to apply for membership as soon as possible, most likely close to or after v1.0.0 ships, and get the needed support and guidance to ensure the project long term.
1152

12-
This library's goal is to make it easy to write _comprehensive, stable unit tests_ for Blazor Components/Razor Components. To see how, go to the [Documentation pages](/docs).
53+
In the post v1.0.0 to v1.0.x time frame, focus will be on improving performance. Especially the spin-up time of about one second would be nice to get reduced.
1354

14-
To browse the source code and provide feedback, head to https://github.com/egil/bunit/.
55+
## Contributors
1556

16-
### Contributors
57+
Shout outs and a big thank you [to all the contributors](https://github.com/egil/bunit/graphs/contributors) to the library, both those that raise issues, provide input to issues, and those who send pull requests.
1758

18-
Shout outs and a big thank you to the contributors to this library. Here they are, in alphabetically:
59+
**Want to help out? You can help in a number of ways:**
1960

20-
- [Michael J Conrad (@Siphonophora)](https://github.com/Siphonophora)
21-
- [Rastislav Novotný (@duracellko)](https://github.com/duracellko)
61+
- Provide feedback and input through [issues](https://github.com/egil/bunit/issues), [Twitter](https://twitter.com/egilhansen) or [bUnit Gitter chat room](https://gitter.im/egil/bunit).
62+
- Help build the library, just pick an issue and submit pull-requests.
63+
- Help write documentation.
64+
- Create blog posts, presentations or video tutorials. If you do, I will be happy to showcase them in the related section on this site.

src/bunit.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".items", ".items", "{A5D7B6
88
.editorconfig = .editorconfig
99
..\CHANGELOG.md = ..\CHANGELOG.md
1010
Directory.Build.props = Directory.Build.props
11+
..\global.json = ..\global.json
1112
..\README.md = ..\README.md
1213
EndProjectSection
1314
EndProject

0 commit comments

Comments
 (0)