Correction of the functional test in Bitcoin: “Jsonrpcexception: the method is not found”
Bitcoin functional tests are essential to ensure the correctness of blockchain and wallets. Sometimes, however, these tests fail with a mysterious error message, Jsonrpcexpicectice: the method is not found (-32601)
. This article passes through three general functional tests that have not succeeded in the “Test_runner.py” file and we provide solutions to solve the problem.
Test 1: Test_coins
The tests of tests test_coins" if the coins are created correctly. It is waiting for a specific method method in the block chain with the right input parameters.
solution
Make sure that the method is created is implemented in the 'Blockchain.py' file and pass the required topics (coinme
, `Quantity
, Pubkey
) to the call of the planned method:
`Python
Blockchain.py
Def Createcoin (Coinme, Quantity, Pubkey):
…
`
Make sure this implementation meets test expectations.
Test 2: Test_coinsgettransance
Testtest_coinsgetraSationto check if the coin shop will be performed correctly. He is waiting for a specific method method in the block chain with the right entrance parameters.
solution
Verify that the fileGettrasationMethod
Blockchain.pycorresponds to the envisaged signature of the activity:
Python
Blockchain.py
Def Gettransation (ID):
…
`
Make sure this implementation meets test expectations. If the solution does not solve the problem, make sure that the method call is correct and transmits the required topics.
Test 3: Test_bytes
Test teststest_bytesif the syllables are sent correctly via json -rpc. He is waiting for a specific method method in the block chain with the right entrance parameters.
solution
Make sure the filesenndbytesmethodis blockchain.py
corresponds to the envisaged signature of the action:
`Python
Blockchain.py
Def Sendbytes (ID, Data):
…
`
Make sure this implementation meets test expectations. If the solution does not solve the problem, verify that the invitation of the method is correct and transmits the required topics.
Additional tips
- Make sure all the tests are running before trying to repair thetest_runner.py test file.
- Use the correction of the error or print clauses to control variables and action calls during the test.
- Take the control and recording of errors in testing the problems.
Following these steps, you should be able to identify and solve a problem that causes “Jsonrpcexctices: the method not found” in functional bitcoin tests.