A chaincode can be tested locally, without installing it on OBP. There are two ways to test chaincode: using mock shim and using REST endpoints.
Testing chaincode
Testing chaincode using the shim
Let's see how to test the earlier chaincode developed locally in the Go language. Before that, here are some key points to note:
- Install the Go language locally on your machine.
- This test filename should take this form: <Go file name>_test.go.
For example: if the chaincode name is education.go, then this test filename should be education_test.go.
- Keep both files in the same folder.
- Set GOPATH to the folder.
- Install the dependent packages used in the chaincode if they can't be found.
For example: go get github...