Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^5: What to test in a new module

by stonecolddevin (Parson)
on Mar 11, 2023 at 19:25 UTC ( [id://11150928]=note: print w/replies, xml ) Need Help??


in reply to Re^4: What to test in a new module
in thread What to test in a new module

I agree up to the point that you're building to spec because someone said you need a certain endpoint just because they thought it feels good. I don't think everything gets done in design meetings and I think there needs to be some relatively well thought out code written before you say "ok here's our API spec".

Three thousand years of beautiful tradition, from Moses to Sandy Koufax, you're god damn right I'm living in the fucking past

Replies are listed 'Best First'.
Re^6: What to test in a new module
by LanX (Saint) on Mar 11, 2023 at 19:53 UTC
    I think there is a chicken-and-egg problem in this discussion and you all are talking about different layers of tests.

    When designing an API is beneficial to write demo usage code. Like the synopsis part in a CPAN module. These can be tested against proof of concepts. That's the nucleus of the project.

    When adjusting the spec you need to adjust those demos, hence code and test suite grow in the process.

    After those are sufficiently stable you start wiring the POCs into modules with more specific unit tests, for instanceto cover edge cases.

    But the tests you wrote while designing the API are already there.

    You may have decided to change the internal architecture in the middle and split the code into multiple dependend modules behind the API. Different modules will have different unit test suites.

    For me it's an iterative process, but this first layer of API tests will stay quite stable while the POCs will only be kept for historical reasons.

    These API tests are the first tiny eggs if you want...

    Cheers Rolf
    (addicted to the 𐍀𐌴𐍂𐌻 Programming Language :)
    Wikisyntax for the Monastery

      I guess I'm just not really a fan of throwaway tests. It sounds like like you're either assuming the demos are stable or are writing throwaway tests and don't mind the churn.

      Three thousand years of beautiful tradition, from Moses to Sandy Koufax, you're god damn right I'm living in the fucking past

        I'm not sure where you read that I was advocating throw away tests.

        My point was it's a top-down process with different layers of tests and POC.

        The API tests of the top layer are stable, the POCs less so.

        There is no point in starting a long endeavor without

        • clarifying the clients expectations
        • proving the feasibility

        This is best done with some demo code, and this can and should be tested. Written specifications are open for interpretations, tests let you sleep well.

        Since those tests define your API they can't easily be thrown away anymore unless your POCs were bad.

        Hope my perspective is clearer now.

        Cheers Rolf
        (addicted to the 𐍀𐌴𐍂𐌻 Programming Language :)
        Wikisyntax for the Monastery

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11150928]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (None)
    As of 2024-04-25 00:35 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found