Make documentation about solidity unit testing more readable

pull/1/head
Icegotcha Fantasoxy 5 years ago committed by Kotchakorn Wongwisutigul
parent bd20420670
commit 8dd5485396
  1. BIN
      docs/images/a-plug.png
  2. BIN
      docs/images/a-unit-testing-feature.png
  3. BIN
      docs/images/a-unit-testing-from-pm.png
  4. BIN
      docs/images/a-unit-testing-run-result.png
  5. BIN
      docs/images/a-unit-testing1.png
  6. BIN
      docs/images/a-user-testing-icon.png
  7. 54
      docs/unittesting.md

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

@ -1,38 +1,46 @@
Unit Testing
============
Click the "double check" icon to get to the unit testing plugin. If you don't see this icon, go to the plugin manager and load up the unit testing plugin.
Click the
![double check](images/a-user-testing-icon.png)
icon to get to the "Solidity Unit Testing" plugin. If you don't see this icon, go to the plugin manager (by click the ![plug](images/a-plug.png) icon) and load up the unit testing plugin.
![](images/a-unit-testing1.png)
![](images/a-unit-testing-from-pm.png)
Generate test File
![](images/a-unit-testing-feature.png)
Generating Test File
------------------
Click the button "Generate test file" to create a new solidity file in the current folder.
This create a new solidity file suffixed with `_test`.
This file contains the minimum you need for running unit testing.
This create a new solidity file in the current folder suffixed with `_test`.
This file contains the minimun you need for running unit testing.
Running Tests
------------------
Run Tests
---------
Click the button "Run tests" to executes all tests whose box has been checked below (by default all). The execution is run in a separate environment and the result is displayed below.
This executes all tests whose box has been checked below (by default all). The execution is run in a separate environment and the result is displayed below.
![](images/a-unit-testing-run-result.png)
Here is a list of functions and their supported types that you can use to write your testcases:
| Available functions | Supported types |
| ------------- | ------------- |
| `Assert.ok()` | `bool` |
| `Assert.equal()` | `uint`, `int`, `bool`, `address`, `bytes32`, `string` |
| `Assert.notEqual()` | `uint`, `int`, `bool`, `address`, `bytes32`, `string` |
| `Assert.greaterThan()` | `uint`, `int` |
| `Assert.lesserThan()` | `uint`, `int` |
see [https://github.com/ethereum/remix/blob/master/remix-tests/tests/examples_4/SafeMath_test.sol](https://github.com/ethereum/remix/blob/master/remix-tests/tests/examples_4/SafeMath_test.sol) for some code sample
```eval_rst
+ -----------------------+--------------------------------------------------------+
| Available functions | Supported types |
+========================+========================================================+
| `Assert.ok()` | `bool` |
+------------------------+--------------------------------------------------------+
| `Assert.equal()` | `uint`, `int`, `bool`, `address`, `bytes32`, `string` |
+------------------------+--------------------------------------------------------+
| `Assert.notEqual()` | `uint`, `int`, `bool`, `address`, `bytes32`, `string` |
+------------------------+--------------------------------------------------------+
| `Assert.greaterThan()` | `uint`, `int` |
+------------------------+--------------------------------------------------------+
| `Assert.lesserThan()` | `uint`, `int` |
+------------------------+--------------------------------------------------------+
```
Click [here](https://github.com/ethereum/remix/blob/master/remix-tests/tests/examples_4/SafeMath_test.sol) for a test file example
Continuous integration
----------------------

Loading…
Cancel
Save