Skip to content

Commit 519460a

Browse files
denyeartnickgaski
authored andcommitted
[FAB-3575] Add unit test instructions to docs
- Add make unit-test info - Add test coverage info - Fix link Change-Id: Ie73a566c867372067353e8f595c09e7c8b634b66 Signed-off-by: David Enyeart <[email protected]> Signed-off-by: Nick Gaski <[email protected]>
1 parent 1dfdee5 commit 519460a

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

docs/source/dev-setup/build.rst

+10
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ Use the following sequence to run all unit tests
2121
cd $GOPATH/src/github.com/hyperledger/fabric
2222
make unit-test
2323

24+
To run a subset of tests, set the TEST_PKGS environment variable.
25+
Specify a list of packages (separated by space), for example:
26+
27+
::
28+
29+
export TEST_PKGS="github.com/hyperledger/fabric/core/ledger/..."
30+
make unit-test
31+
2432
To run a specific test use the ``-run RE`` flag where RE is a regular
2533
expression that matches the test case name. To run tests with verbose
2634
output use the ``-v`` flag. For example, to run the ``TestGetFoo`` test
@@ -31,6 +39,8 @@ call/excecute
3139

3240
go test -v -run=TestGetFoo
3341

42+
43+
3444
Running Node.js Unit Tests
3545
~~~~~~~~~~~~~~~~~~~~~~~~~~
3646

docs/source/testing.rst

+24
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,30 @@
11
Testing
22
=======
33

4+
Unit test
5+
~~~~~~~~~
6+
See :doc:`building the fabric <dev-setup/build>` for unit testing instructions.
7+
8+
See `Unit test coverage reports <https://jenkins.hyperledger.org/view/fabric/job/fabric-merge-x86_64/>`__
9+
10+
To see coverage for a package and all sub-packages, execute the test with the ``-cover`` switch:
11+
12+
::
13+
14+
go test ./... -cover
15+
16+
To see exactly which lines are not covered for a package, generate an html report with source
17+
code annotated by coverage:
18+
19+
::
20+
21+
go test -coverprofile=coverage.out
22+
go tool cover -html=coverage.out -o coverage.html
23+
24+
25+
System test
26+
~~~~~~~~~~~
27+
428
[WIP] ...coming soon
529

630
This topic is intended to contain recommended test scenarios, as well as

0 commit comments

Comments
 (0)