Skip to content

Test using Core's test cases #58

Closed

Description

@tcharding

Currently we have only limited test coverage. And for the RPC methods that are tested we only test a subset of things e.g.,

  • We don't test all optional fields
  • We don't ensure all fields are non-default e.g., they may be being filled in by serde and not actually deserialized.

An idea, courtesy of @stevenroose, is to grab the tests from Core used for testing the RPC code and then try to parse all of those.

Activity

  1. GideonBature commented on Mar 29, 2025

    @GideonBature
    Contributor

    The idea is great, as it will help us ensure that:

    • most if not all optional fields are tested.
    • prevents issues where fields might not be correctly deserialised but still seem to work due to default values.
    • we will be certain that it follows correctly Bitcoin Core's RPC Specification.

    We can Start the implementation, I will be like to take on the task if it's okay.

  2. tcharding commented on Apr 3, 2025

    @tcharding
    MemberAuthor

    Go wild.

  3. jamillambert commented on Sep 10, 2025

    @jamillambert
    Collaborator

    I think this issue is now dead? We have a pretty thorough test suite now and I don't want to go down this route personally.

  4. tcharding commented on Sep 10, 2025

    @tcharding
    MemberAuthor

    This is still an idea I'd like to pursue. What it means is we currently typically have a single test, this issue describes getting test vectors from Core i.e., having a whole bunch of tests for each method instead of 1.

  5. jamillambert commented on Sep 12, 2025

    @jamillambert
    Collaborator

    I'm still not convinced. I think the effort should go into other improvements in the tests that check if the structs in this crate are correct, e.g. #137, #291 and #365.

    Using test vectors from Core might be a way to do this in some RPCs, but I just think that the main reason to test all RPCs with a range of inputs using the test vectors is to test the functionality of core.

    For this crate we really only have 3 cases we care about, the returned field is empty, valid, or there's an error.

  6. tcharding commented on Sep 14, 2025

    @tcharding
    MemberAuthor

    I just think that the main reason to test all RPCs with a range of inputs using the test vectors is to test the functionality of core.

    You are correct. However there is a reason I think its worth doing .Its a quick and easy (hopefully) way to get a bunch of different things out of Core without having to make up RPC calls ourselves. In particular, to get good coverage for a method requires understanding exactly when and why Core returns what ever it does. And this requires a bunch of thought, where as just using all the test vectors we can do it mechanically with no thought into why the exact data is returned.

  7. jamillambert commented on Sep 15, 2025

    @jamillambert
    Collaborator

    I agree that all makes sense and you've now convinced me, assuming the test vectors do have cases for both returning and not returning all optional fields.

  8. tcharding commented on Sep 16, 2025

    @tcharding
    MemberAuthor

    Yeah, I haven't looked at them yet.

  9. satsfy commented on May 12, 2026

    @satsfy
    Contributor

    to get good coverage for a method requires understanding exactly when and why Core returns whatever it does

    Agreed. I'm working on this issue, copying from core's functional tests. I think we should use them to append existing tests (I'm not planning on making them a separate folder or labeling where they came from in core).

    One concern I have is: our tests only wrap around core and need only to produce a sufficient coverage of response shapes. It can get really noisy porting all of them in their original state because core tests restart nodes, check error messages, test CLI behavior, etc. See this test:

    assert_raises_rpc_error(-1, 'getchaintxstats', self.nodes[0].getchaintxstats, 0, '', 0)

    Corepc doesn't need it.

    What would you specifically want to stay? What should be dropped for being excessively noisy? I imagine keeping the specific RPC call setup + field assertions so more optional fields get exercised.

    EDIT: I'm making them as constrained as possible without being brittle.

  10. added a commit that references this issue on May 26, 2026
    c01eb4f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions