Skip to content

Commit

Permalink
Merge pull request #8467 from Mikaka27/michal/common_test/docs
Browse files Browse the repository at this point in the history
Michal/common test/docs
  • Loading branch information
Mikaka27 committed May 8, 2024
2 parents 4a7e685 + 090c5e6 commit d15e18e
Show file tree
Hide file tree
Showing 14 changed files with 206 additions and 268 deletions.
6 changes: 3 additions & 3 deletions lib/common_test/doc/guides/cover_chapter.md
Expand Up @@ -167,8 +167,8 @@ When using a cover specification in the testing of an OTP application itself,
there is a special incl_app directive that includes the applications modules for
the cover compilation.

```text
{incl_app, AppName, Cover:: overview | details}.
```erlang
{incl_app, AppName, Cover :: overview | details}.
```

> #### Note {: .info }
Expand Down Expand Up @@ -220,7 +220,7 @@ comes in handy.

If instead the cover specification for `s2` is like the following:

```erlang
```text
s2.cover:
{cross,[{s1,[m1]}]}.
```
Expand Down
38 changes: 28 additions & 10 deletions lib/common_test/doc/guides/run_test_chapter.md
Expand Up @@ -424,40 +424,50 @@ groups() ->
The following executes two tests, one for all cases and all subgroups under
`top1`, and one for all under `top2`:

```erlang
```text
$ ct_run -suite "x_SUITE" -group all
```
```erlang
1> ct:run_test([{suite,"x_SUITE"}, {group,all}]).
```

Using `-group top1 top2`, or `{group,[top1,top2]}` gives the same result.

The following executes one test for all cases and subgroups under `top1`:

```erlang
```text
$ ct_run -suite "x_SUITE" -group top1
```
```erlang
1> ct:run_test([{suite,"x_SUITE"}, {group,[top1]}]).
```

The following runs a test executing `tc12` in `top1` and any subgroup under
`top1` where it can be found (`sub11` and `sub121`):

```erlang
```text
$ ct_run -suite "x_SUITE" -group top1 -case tc12
```
```erlang
1> ct:run_test([{suite,"x_SUITE"}, {group,[top1]}, {testcase,[tc12]}]).
```

The following executes `tc12` _only_ in group `top1`:

```erlang
```text
$ ct_run -suite "x_SUITE" -group [top1] -case tc12
```
```erlang
1> ct:run_test([{suite,"x_SUITE"}, {group,[[top1]]}, {testcase,[tc12]}]).
```

The following searches `top1` and all its subgroups for `tc16` resulting in that
this test case executes in group `sub121`:

```erlang
```text
$ ct_run -suite "x_SUITE" -group top1 -case tc16
```
```erlang
1> ct:run_test([{suite,"x_SUITE"}, {group,[top1]}, {testcase,[tc16]}]).
```

Expand All @@ -467,34 +477,42 @@ result in this example.
The following executes two tests, one including all cases and subgroups under
`sub12`, and one with _only_ the test cases in `sub12`:

```erlang
```text
$ ct_run -suite "x_SUITE" -group sub12 [sub12]
```
```erlang
1> ct:run_test([{suite,"x_SUITE"}, {group,[sub12,[sub12]]}]).
```

In the following example, `Common Test` finds and executes two tests, one for
the path from `top2` to `sub2X2` through `sub21`, and one from `top2` to
`sub2X2` through `sub22`:

```erlang
```text
$ ct_run -suite "x_SUITE" -group sub2X2
```
```erlang
1> ct:run_test([{suite,"x_SUITE"}, {group,[sub2X2]}]).
```

In the following example, by specifying the unique path
`top2 -> sub21 -> sub2X2`, only one test is executed. The second possible path,
from `top2` to `sub2X2` (from the former example) is discarded:

```erlang
```text
$ ct_run -suite "x_SUITE" -group [sub21,sub2X2]
```
```erlang
1> ct:run_test([{suite,"x_SUITE"}, {group,[[sub21,sub2X2]]}]).
```

The following executes only the test cases for `sub22` and in reverse order
compared to the group definition:

```erlang
```text
$ ct_run -suite "x_SUITE" -group [sub22] -case tc22 tc21
```
```erlang
1> ct:run_test([{suite,"x_SUITE"}, {group,[[sub22]]}, {testcase,[tc22,tc21]}]).
```

Expand Down Expand Up @@ -1080,7 +1098,7 @@ tag (or tags) in `Tags`.

For example, in the test specification:

```text
```erlang
...
{label, my_server_smoke_test}.
{config, "../../my_server_setup.cfg"}.
Expand Down
2 changes: 1 addition & 1 deletion lib/common_test/doc/guides/write_test_chapter.md
Expand Up @@ -943,7 +943,7 @@ the following is printed:
Note that the category argument is not required in order to only specify the
importance of a printout. Example:

```text
```erlang
ct:pal(?LOW_IMPORTANCE, "Info report: ~p", [Info])
```

Expand Down

0 comments on commit d15e18e

Please sign in to comment.