• JackbyDev@programming.dev
    link
    fedilink
    English
    arrow-up
    15
    ·
    14 hours ago

    Yes, I actually do. It’s a behavioral driven testing framework. I love the idea of it but hate working with it because everyone uses it improperly.

    What the steps in a scenario should look like:

    Given a user has a bank accout
    And the account has a balance of $10
    When the user attempts to withdraw $20
    Then the transaction should fail
    

    How everyone I’ve worked with uses it:

    Given the system is setup
    Given the user TESTUSER1
    Given load TESTDATA1
    When the user sends a request
        ACTION | AMOUNT
        WITHDRAW | 20.0
    The the response should be 400
        STATUS | MESSAGE
        Failure | Not enough funds
    
      • JackbyDev@programming.dev
        link
        fedilink
        English
        arrow-up
        1
        ·
        edit-2
        1 hour ago

        On that same page is Gherkin which is what both examples are. (I may have gotten the syntax slightly wrong.) Cucumber uses Gherkin. I forget which is which exactly. Maybe Cucumber is the code that reads Gherkin and executes step definitions.

        For whatever reason, people try to make a small number of extremely flexible step definitions which leads to scenarios that don’t actually read as business requirements. (Which is the entire point in the first place.)

        Given a user has a bank accout
        And the account has a balance of $10
        When the user attempts to withdraw $20
        Then the transaction should fail
        And the account should have a balance of $20
        
        Given a user has a bank accout
        And the account has a balance of $10
        When the user attempts to withdraw $5
        Then the transaction should succeed
        And the account should have a balance of $5
        
        Given a user has a bank accout
        And the account has a balance of $10
        When the user attempts to deposit $5
        Then the transaction should succeed
        And the account should have a balance of $15
        

        Doing something like this is more elegant. The steps definitions would be

        • a user has a bank account performs setup tasks to load a test user into the system.
        • the account has a balance of X would either load the account with that much or just make an initial deposit.
        • the user attempts to withdraw X/the user attempts to deposit X would both perform those actions. If it’s a web API they’d be HTTP requests.
        • then the transaction should X would check HTTP status code. You could make this two separate step definitions or have logic based on the word. Two separate step definitions is probably better.
        • the account should have a balance of X checks the balance in the account.
    • sugar_in_your_tea@sh.itjust.works
      link
      fedilink
      arrow-up
      1
      ·
      6 hours ago

      Maybe that’s why I hate using it, or maybe I just hate testing frameworks that do more than run tests. Here’s what I want from a testing framework:

      • run tests in classes or modules
      • report output with some configurable name (javadoc comment, Python Docstring, etc)
      • some way to parameterize tests with different inputs
      • organized output that shows what failed
      • if it’s an integration test, keep track of failures over time

      Our QA uses cucumber and it works for them, so I only whine when I need to deal with it.

  • moopet@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    11
    ·
    1 day ago

    This is one of those things where if I was to say, “no, but I know celery”, people would think I was being silly.

    • sugar_in_your_tea@sh.itjust.works
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      6 hours ago

      Well yeah, cucumber is a Ruby/Java/etc testing framework and celery is a Python async task queue framework. Know what job you’re applying for, silly.

      😁

    • JakenVeina@lemm.ee
      link
      fedilink
      English
      arrow-up
      5
      ·
      edit-2
      18 hours ago

      And here I thought the fact that it’s spelled “Cucumber” and not “qcmbr” was the giveaway that it’s a joke.

    • AnUnusualRelic@lemmy.world
      link
      fedilink
      arrow-up
      5
      arrow-down
      1
      ·
      edit-2
      1 day ago

      At the rate those things get spewed out, you can use pretty much any dictionary word and it’ll be the name of some kind of software tool. Probably in javascript.

    • Drewmeister@lemmynsfw.com
      link
      fedilink
      English
      arrow-up
      34
      ·
      2 days ago

      Yeah, we use gherkin, which is a variety of cucumber. Programmers name things weird. Java is a coffee bean and C is just a letter; they’ve just gotten big enough that people recognize them now.

      • UnderpantsWeevil@lemmy.world
        link
        fedilink
        English
        arrow-up
        7
        ·
        2 days ago

        C is just a letter

        It’s the successor to B, which was derived from BCPL (“Basic Combined Programming Language”)

        Incidentally, C++ is a reference to how integer values are iterated in C. And then C# is a pithy take on C++ wherein you’ve stacked two rows of plus signs on top of each other.

        There’s often some rhyme or reason to these names.

        • JokeDeity@lemm.ee
          link
          fedilink
          arrow-up
          1
          ·
          9 hours ago

          I found this interesting, was there an A?

          Proceeds to go look it up while still hoping for your knowledge

      • Shoe@lemm.ee
        link
        fedilink
        arrow-up
        4
        ·
        2 days ago

        Have always personally seen Gherkin being used with Cucumber, as I believe that they’re two parts of the same whole, but I’m happy to be corrected if wrong :).

        My understanding is that Gherkin is the syntax used to write the scenarios / acceptance criteria, whilst Cucumber is the tool that interprets said scenarios and executes them as automated tests.

    • sugar_in_your_tea@sh.itjust.works
      link
      fedilink
      arrow-up
      2
      ·
      6 hours ago

      I disagree. I’m a full-stack engineer, and every time I interact with our QA test suite in cucumber, I break out in hives. I hate keeping the gherkin feature file up to date with the test code, why so much complexity?

      • THCDenton@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        5 hours ago

        Ah. Yeah to be fair I’ve only used it on personal projects. I’ve never had to use it at work. Maybe I’d change my tune after that experience

        • sugar_in_your_tea@sh.itjust.works
          link
          fedilink
          arrow-up
          2
          ·
          5 hours ago

          Or maybe we just use it poorly. It doesn’t help that we use perhaps my least favorite language for testing: Java. I’ve written tons of integration tests, but we just used Python and unittest with some plugins to make output nicer, and it was pleasant enough.

  • qwestjest78@lemmy.ca
    link
    fedilink
    arrow-up
    20
    arrow-down
    1
    ·
    2 days ago

    It’s a terrible time right now. I’ve applied for over 100 roles this year and only got 3 interviews. Interviews went well, but you never move on. Likely they had someone in mind for the position already.

    I think I’m close to reaching out to one of those temp agencies and try to find a year contract somewhere with the hope I end up getting a permanent offer somewhere.

    I have 10 years experience in operations and finished a BBA a year ago and it has not amounted in any new opportunities sadly.

      • LeninOnAPrayer@lemm.ee
        link
        fedilink
        English
        arrow-up
        1
        ·
        edit-2
        2 days ago

        Yeah but then they add all these new requirements to be considered “experienced”. Every company really wants you to know Cucumber++ but only to spent all your time converting old legacy Cucumber code. It’s going to be an awful job to take.

        And some of them don’t even know that CucumberScript is an entirely different language. No one would ever use CucumberScript in the Backend. It’s clearly a frontend only language. But nope. They keep trying to ask you if you have experience with Cucumber++ or CucumberScript for backend work. These recruiters have no idea what they are even asking you. You clearly should be using Eggplant. It’s the only thing that will work longterm as your backend requirements expand.