Skip to content

Commit ee98dd4

Browse files
author
Travis Nickels
authored
Update automated tests readme (#1837)
1 parent b9b577c commit ee98dd4

File tree

1 file changed

+43
-6
lines changed

1 file changed

+43
-6
lines changed

README.md

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ Install the following dependencies if you don't have them installed yet.
3232

3333
Even though Visual Studio or Rider seem to be adequate IDEs for front-end development, they tend to be unreliable with the latest front-end frameworks, linting, and formatting.
3434
Because of that, we have [extra recommendations](/docs/frontend/frontend-ide.md) to help you succeed even more at front-end development.
35-
36-
#### Step 1 - run the Vue.js development server
35+
36+
#### Step 1 - run the Vue.js development server
3737

3838
Navigate to `ServicePulse\src\Frontend` and:
3939

@@ -46,6 +46,42 @@ If `npm run dev` fails with an error related to git submodules not being correct
4646

4747
After doing the above steps, navigate to the URL presented by the execution of the Vue.js application to see the ServicePulse application.
4848

49+
### Running automated tests
50+
51+
The frontend automated tests utilize Vitest as the testing framework and testing-library for testing utilities. Vitest provide two modes: `watch mode` in the development environment and `run mode` in the CI environment by default. `Watch mode` instantly re-runs relevant tests upon file save, providing immediate feedback during development.
52+
53+
Before running test, ensure you've set up the development server. Navigate to `ServicePulse\src\Frontend` and run `npm install` to install all the npm dependencies.
54+
55+
#### Running component tests
56+
57+
Navigate to `ServicePulse\src\Frontend` and run:
58+
59+
```console
60+
npm run test:component
61+
```
62+
63+
This command runs all the component test files `*.spcs.ts` in the directory `ServicePulse\src\Frontend\src` and its subdirectories. With `watch mode` enabled it allows for efficient test development, as only the relevant tests are re-run on file save.
64+
65+
#### Running application tests
66+
67+
Navigate to `ServicePulse\src\Frontend` and run:
68+
69+
```console
70+
npm run test:application
71+
```
72+
73+
Similar to component tests, this command runs all the application test files `*.spcs.ts` in the directory `ServicePulse\src\Frontend\test` and its subdirectories.
74+
75+
#### Running test coverage
76+
77+
Navigate to `ServicePulse\src\Frontend` and run:
78+
79+
```console
80+
npm run test:coverage
81+
```
82+
83+
This command generates a report indicating the percentage of statements, branches, function, and lines covered by tests. Additionally, it identifies uncovered line numbers.
84+
4985
### Provided npm scripts
5086

5187
#### Vue.js
@@ -55,10 +91,11 @@ After doing the above steps, navigate to the URL presented by the execution of t
5591
- `lint` - checks with eslint all vue, ts, and js files
5692
- `type-check` - runs TypeScript in no emit mode
5793

94+
#### Vitest
5895

59-
### Configuring automated tests
60-
61-
For information on running automated tests, please follow [ServicePulse.Host.Tests/Readme](https://github.com/Particular/ServicePulse/blob/master/src/ServicePulse.Host.Tests/README.md).
96+
- `test:application` - runs all the application tests located in the `Frontend/test` folder.
97+
- `test:component` - runs tests all the component tests located in the `Frontend/src` folder and any subdirectories.
98+
- `test:coverage` - runs the test coverage report on the files defined in `vitest.config.ts`
6299

63100
## Running from ServicePulse.Host.exe
64101

@@ -68,7 +105,7 @@ It is possible to run ServicePulse directly via `ServicePulse.Host.exe`.
68105

69106
ServicePulse.Host.exe depends on a self-hosted web server. A URL ACL reservation must be set up before the project can run. Either run Visual Studio with Administrative privileges or run the following command to add the required URL ACL reservation:
70107

71-
```
108+
```cmd
72109
add urlacl url=URL
73110
```
74111

0 commit comments

Comments
 (0)