Skip to content

Commit

Permalink
docs: update writing tests for et make test; add an mp4
Browse files Browse the repository at this point in the history
  • Loading branch information
danceratopz committed Nov 25, 2024
1 parent 3c1ea14 commit d187ef7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
Binary file added docs/writing_tests/img/et_make_test.mp4
Binary file not shown.
19 changes: 18 additions & 1 deletion docs/writing_tests/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
# Writing Tests

The best way to get started is to use one of the existing test modules for inspiration. A good simple example is [tests.berlin.eip2930_access_list.test_acl.test_access_list](../tests/berlin/eip2930_access_list/test_acl/test_access_list.md).
The easiest way to get started is to use the interactive CLI:

```console
uv run et make test
```

and modify the generated test module to suit your needs.

<figure class="video_container">
<video controls="true" allowfullscreen="true">
<source src="./img/et_make_test.mp4" type="video/mp4">
</video>
</figure>

For help deciding which test format to select, see [Types of Tests](./types_of_tests.md), in particular [Deciding on a Test Type](./types_of_tests.md#deciding-on-a-test-type). Otherwise, some simple test case examples to get started with are:

- [tests.berlin.eip2930_access_list.test_acl.test_access_list](../tests/berlin/eip2930_access_list/test_acl/test_access_list.md).
- [tests.istanbul.eip1344_chainid.test_chainid.test_chainid](../tests/istanbul/eip1344_chainid/test_chainid/test_chainid.md).

Please check that your code adheres to the repo's [Coding Standards](./code_standards.md) and read the other pages in this section for more background and an explanation of how to implement state transition and blockchain tests.
2 changes: 2 additions & 0 deletions docs/writing_tests/types_of_tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,5 @@ def test_blob_type_tx_pre_fork(
Whenever possible, use `state_test` to examine individual transactions. This method is more straightforward and less prone to external influences that can occur during block building.

This provides more targeted testing since it does not invoke the client's block-building machinery. This reduces the risk of encountering false positives, particularly in exception scenarios (e.g., see issue [#343: "Zero max_fee_per_blob_gas test is ineffective"](https://github.com/ethereum/execution-spec-tests/issues/343)).

Moreover, the `fill` command automatically additionally generates a `blockchain_test` for every `state_test` by wrapping the `state_test`'s transaction in a block.

0 comments on commit d187ef7

Please sign in to comment.