Skip to content

Commit

Permalink
docs: update testing.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Romakita authored Sep 25, 2023
1 parent 57dff8e commit 4362481
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion docs/docs/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ PlatformTest API provides an `invoke` method to create a new instance of your co
:::

## Test your Rest API

### Installation

To test your API, I recommend you to use the [`supertest`](https://github.com/visionmedia/supertest) module.
Expand Down Expand Up @@ -249,6 +248,20 @@ which Platform
your server must be executed for integration test.
:::

## Pros / Cons

::: warning
Use `PlatformTest.boostrap()` is not recommended in Jest environment.
This method is practical for carrying out some integration tests but consumes a lot of resources which can lead to a significant slowdown in your tests or even cause timeouts.

It's better to write your tests using Cucumber and test your Rest applications in a container.
:::

::: tip Note
There is no performance issue as long as you use `PlatformTest.create()` to perform your tests,
But it's not possible with this method to do an integration test with the server (Express or Koa). You can only test your controller and the services injected into it.
:::

### Stub a service method

When you're testing your API, you have sometimes to stub a method of a service.
Expand Down

0 comments on commit 4362481

Please sign in to comment.