BDD vs. Traditional Frameworks: A Comedy 😂 Act 1: The Skeptics: "BDD? Gherkin? More work for no reason! I'd rather wrestle a kraken than write in plain English!" Act 2: The BDD Evangelist: "Hold on, my friends! BDD is like a well-organized toolbox, not a kraken's lair. Let me show you the light!" Act 3: Separation Anxiety (Solved): "With BDD, test cases and code are like a happily divorced couple – living separate lives but still getting the job done. No more Frankenstein test methods!" Act 4: Reusability Rhapsody: "Steps are like LEGOs – build once, use everywhere! Traditional frameworks? More like a jigsaw puzzle with missing pieces." Act 5: Hooks – The Heroes of the Hour: "Logging, cleanup? BDD's hooks swoop in like ninjas and handle it all behind the scenes. No more code clutter!" Act 6: Onboarding Nirvana: "Newbies, rejoice! BDD specs are your onboarding manual. Learn the features, copy the steps, become a testing superstar in no time!"
Hoang (Eugene) Nguyen’s Post
More Relevant Posts
-
Just wrote a new piece on Behavior-Driven Development (BDD). If you've ever wondered what BDD is all about, or if you're just looking for a fresh perspective, give it a read. It's a walk through of the concept, minus the jargon. I would love to hear what you think. #BDD 🔗 [https://lnkd.in/dUFM9rsm]
To view or add a comment, sign in
-
Lead SDET | Seasoned Automation QA Expert | Selenium WebDriver & API Automation Specialist | Desktop Automation with WinAppDriver | MS AI 900 Certified | YouTube Creator with 3.3K+ Subscribers | Git lab Pipelines expert
𝗜𝗥𝗲𝘁𝗿𝘆𝗔𝗻𝗮𝗹𝘆𝘇𝗲𝗿: Listener of 𝗧𝗲𝘀𝘁𝗡𝗴 𝘂𝘀𝗲𝗱 𝘁𝗼 𝗿𝗲-𝗮𝘁𝘁𝗲𝗺𝗽𝘁 failed test cases for a certain number of times. it is an Interface having one 𝗿𝗲𝘁𝗿𝘆 𝗺𝗲𝘁𝗵𝗼𝗱 , so we need one concrete class to implement this Interface and as a result need to implement 𝗿𝗲𝘁𝗿𝘆 method, owing to which we can achieve 𝗥𝗲 𝗲𝘅𝗲𝗰𝘂𝘁𝗶𝗼𝗻 of test cases on the fly. This is 𝗵𝗲𝗹𝗽𝗳𝘂𝗹 in cases where the 𝗲𝗻𝘃𝗶𝗿𝗼𝗻𝗺𝗲𝗻𝘁 𝗶𝘀 𝗳𝗹𝗮𝗸𝘆 but note this is an organization's choice whether they want to execute test cases against a flaky environment. Can we use 𝗜𝗿𝗲𝘁𝗿𝘆𝗮𝗻𝗮𝗹𝘆𝘇𝗲𝗿 𝗶𝗻 𝗕𝗗𝗗 𝗖𝘂𝗰𝘂𝗺𝗯𝗲𝗿? Answer is 𝗬𝗲𝘀. If we are using 𝗕𝗗𝗗 𝗰𝘂𝗰𝘂𝗺𝗯𝗲𝗿 𝘄𝗶𝘁𝗵 𝗧𝗲𝘀𝘁𝗡𝗴. Let us dive deep in to practical demonstration https://lnkd.in/dxvUaSv6 If you want to 𝗹𝗲𝗮𝗿𝗻 𝗕𝗗𝗗 𝗖𝘂𝗰𝘂𝗺𝗯𝗲𝗿 𝗳𝗿𝗼𝗺 𝘀𝗰𝗿𝗮𝘁𝗰𝗵, 𝗰𝗵𝗲𝗰𝗸𝗼𝘂𝘁 𝘁𝗵𝗲 𝗳𝗼𝗹𝗹𝗼𝘄𝗶𝗻𝗴 𝗽𝗹𝗮𝘆𝗹𝗶𝘀𝘁: Mastering BDD from Scratch || For Absolute beginners: https://lnkd.in/dWFQbf2g Follow us on Following channels for regular updates 𝗬𝗼𝘂𝘁𝘂𝗯𝗲:https://lnkd.in/gmPT55FY 𝗪𝗵𝗮𝘁𝘀𝗔𝗽𝗽: https://lnkd.in/gVqWAwg3 𝗧𝗲𝗹𝗲𝗴𝗿𝗮𝗺: https://lnkd.in/gjyMJwdD Regards PrinceAutomationDestination
To view or add a comment, sign in
-
"TDD is writing the tests first" is a terrible phrase. We need to do something about that. You don't write "the tests" first. That is a plural, and often when it is expressed that way people imagine the same tests that they would have written after the code was completed. That's all wrong. You write one test, then implement enough code to pass that test, then refactor the existing code and test(s) if necessary, and then maybe commit or integrate before you get too much divergence from the main branch. You don't write "the tests" first. You write a test first. The test you write isn't a test of the code you haven't written. It is a test of what you want the code to do (that it doesn't do yet). It's a whole different mindset over writing tests to get coverage for existing code. I lack the imagination and genius to write all of the test-last tests before writing the code. I have no idea how anyone would do that. But I have ample skill and knowledge to write a test for what I want to happen before I write the code that makes it happen. Do I want to throw an exception on bad input? Cool - here's a specific bad input, and here's the expected exception. We can do this for a lot of kinds of bad inputs, but we'll take it one kind of badness at a time. Do I want it to count the words in a sentence? Sure, here's a sentence and here is the dictionary of words to counts. I can give it a lot of specific sentences to test it's counting prowess, but only one at at a time. This is, sadly, not what people imagine when they hear "In TDD you write the tests first" -- they picture something that is much harder, much less likely, and much less applicable. You'd think that in 29 years we'd have at least gotten this idea into the hive mind, but the field keeps growing (and filling with misinformation) faster than we can teach it.
To view or add a comment, sign in
-
Having enough skill and knowledge to write one test does not accumulate into having enough skill and knowledge to write the program. That's a very appealing fallacy that accounts for the popularity of the method. You mean I can write a non-trivial program without learning how to do a data structure decomposition or a case based analysis. No you can't. But TDD makes you think you can. Writing the tests (plural) first is actually better because your mind plays tricks on what your sense of a correct result is once you start seeing some tests results. I believe the term for this is confirmation bias. It's not a TDD/Test Last dichotomy. You write as many tests as you can think of up front - if for no other reason but to validate that you know what the heck you are supposed to be doing before you start writing any code. Lastly a very simple example of how you can write the wrong code and still get the test to pass. The requirement involves flipping a shape vertically, you code it by flipping the shape horizontally if you test that code with a circle, rectangle or square the test will pass but the code is wrong.
"TDD is writing the tests first" is a terrible phrase. We need to do something about that. You don't write "the tests" first. That is a plural, and often when it is expressed that way people imagine the same tests that they would have written after the code was completed. That's all wrong. You write one test, then implement enough code to pass that test, then refactor the existing code and test(s) if necessary, and then maybe commit or integrate before you get too much divergence from the main branch. You don't write "the tests" first. You write a test first. The test you write isn't a test of the code you haven't written. It is a test of what you want the code to do (that it doesn't do yet). It's a whole different mindset over writing tests to get coverage for existing code. I lack the imagination and genius to write all of the test-last tests before writing the code. I have no idea how anyone would do that. But I have ample skill and knowledge to write a test for what I want to happen before I write the code that makes it happen. Do I want to throw an exception on bad input? Cool - here's a specific bad input, and here's the expected exception. We can do this for a lot of kinds of bad inputs, but we'll take it one kind of badness at a time. Do I want it to count the words in a sentence? Sure, here's a sentence and here is the dictionary of words to counts. I can give it a lot of specific sentences to test it's counting prowess, but only one at at a time. This is, sadly, not what people imagine when they hear "In TDD you write the tests first" -- they picture something that is much harder, much less likely, and much less applicable. You'd think that in 29 years we'd have at least gotten this idea into the hive mind, but the field keeps growing (and filling with misinformation) faster than we can teach it.
To view or add a comment, sign in
-
One of the other misconceptions to be wary of: Test Driven Development is not about how a tester will test the code, let alone make the tester (QA) ready before dev ends. Test Driven development is a form of "development" - where the developer thinks in terms of testing first before thinking about the implementation. TDD is for the devs not QAs! #TDD #TestDrivenDecelopment #GoodCoding #SoftwareEngineering
"TDD is writing the tests first" is a terrible phrase. We need to do something about that. You don't write "the tests" first. That is a plural, and often when it is expressed that way people imagine the same tests that they would have written after the code was completed. That's all wrong. You write one test, then implement enough code to pass that test, then refactor the existing code and test(s) if necessary, and then maybe commit or integrate before you get too much divergence from the main branch. You don't write "the tests" first. You write a test first. The test you write isn't a test of the code you haven't written. It is a test of what you want the code to do (that it doesn't do yet). It's a whole different mindset over writing tests to get coverage for existing code. I lack the imagination and genius to write all of the test-last tests before writing the code. I have no idea how anyone would do that. But I have ample skill and knowledge to write a test for what I want to happen before I write the code that makes it happen. Do I want to throw an exception on bad input? Cool - here's a specific bad input, and here's the expected exception. We can do this for a lot of kinds of bad inputs, but we'll take it one kind of badness at a time. Do I want it to count the words in a sentence? Sure, here's a sentence and here is the dictionary of words to counts. I can give it a lot of specific sentences to test it's counting prowess, but only one at at a time. This is, sadly, not what people imagine when they hear "In TDD you write the tests first" -- they picture something that is much harder, much less likely, and much less applicable. You'd think that in 29 years we'd have at least gotten this idea into the hive mind, but the field keeps growing (and filling with misinformation) faster than we can teach it.
To view or add a comment, sign in
-
Two stories highlight the importance of proper unit testing in web applications, emphasizing the need for a greater focus on functional and integration tests. One company boasted a 97%+ test coverage. However, upon my arrival, I noticed their Scrum Board was filled with high-priority bug stories caused by non-functioning visual elements and issues in API service communication. Despite the comprehensive implementation tests—covering every single method and declaration line—the projects failed because the integration aspect was neglected. Another company was developing a significant amount of feature work, but the lead and senior engineers were reluctant to write any tests. They prioritized speed and were uncertain if the features would go live. They argued that writing tests was a waste of time since "they don't catch any bugs," and claimed that unit tests would be written later, once the feature was confirmed for release. Naturally, the unit tests were never written. The issue was that they did not realize implementation testing yields more fragile tests that are harder to write and change due to complex setup and teardowns.
If you're used to writing tests in a traditional "unit" style where your tests are mock-heavy and test implementation details, it's no wonder you probably think TDD doesn't work well. TDD works beautifully when tests are written against behaviours and not implementation details. Your tests will actually help you make changes over time in this scenario. When your tests test internals and are very mock-heavy, TDD becomes slow and painful, as does testing in general. If every time you refactor internals you have to change loads of tests, and your tests are a pain to maintain, it might be time to reconsider how you're writing them. I don't even use the term "unit" day to day because I think tests written this way cause nothing but harm. Test against behaviour all the way through the stack and your tests will help you.
To view or add a comment, sign in
-
If you're used to writing tests in a traditional "unit" style where your tests are mock-heavy and test implementation details, it's no wonder you probably think TDD doesn't work well. TDD works beautifully when tests are written against behaviours and not implementation details. Your tests will actually help you make changes over time in this scenario. When your tests test internals and are very mock-heavy, TDD becomes slow and painful, as does testing in general. If every time you refactor internals you have to change loads of tests, and your tests are a pain to maintain, it might be time to reconsider how you're writing them. I don't even use the term "unit" day to day because I think tests written this way cause nothing but harm. Test against behaviour all the way through the stack and your tests will help you.
To view or add a comment, sign in
-
Mocks were actually invented to be able to focus on behaviour not on implementation details. But if you mock 3rd party APIs, you're going to have a lot of problems with mocks. So don't do it! Only mock types that you own!
If you're used to writing tests in a traditional "unit" style where your tests are mock-heavy and test implementation details, it's no wonder you probably think TDD doesn't work well. TDD works beautifully when tests are written against behaviours and not implementation details. Your tests will actually help you make changes over time in this scenario. When your tests test internals and are very mock-heavy, TDD becomes slow and painful, as does testing in general. If every time you refactor internals you have to change loads of tests, and your tests are a pain to maintain, it might be time to reconsider how you're writing them. I don't even use the term "unit" day to day because I think tests written this way cause nothing but harm. Test against behaviour all the way through the stack and your tests will help you.
To view or add a comment, sign in
-
Cucumber: Cucumber is a popular Behavior-Driven Development (BDD) framework that uses Gherkin, a human-readable language, to describe software behavior. It integrates well with DDT practices.
To view or add a comment, sign in
-
Lead SDET | Seasoned Automation QA Expert | Selenium WebDriver & API Automation Specialist | Desktop Automation with WinAppDriver | MS AI 900 Certified | YouTube Creator with 3.3K+ Subscribers | Git lab Pipelines expert
𝗜𝗥𝗲𝘁𝗿𝘆𝗔𝗻𝗮𝗹𝘆𝘇𝗲𝗿: Listener of 𝗧𝗲𝘀𝘁𝗡𝗴 𝘂𝘀𝗲𝗱 𝘁𝗼 𝗿𝗲-𝗮𝘁𝘁𝗲𝗺𝗽𝘁 failed test cases for a certain number of times. it is an Interface having one 𝗿𝗲𝘁𝗿𝘆 𝗺𝗲𝘁𝗵𝗼𝗱 , so we need one concrete class to implement this Interface and as a result need to implement 𝗿𝗲𝘁𝗿𝘆 method, owing to which we can achieve 𝗥𝗲 𝗲𝘅𝗲𝗰𝘂𝘁𝗶𝗼𝗻 of test cases on the fly. This is 𝗵𝗲𝗹𝗽𝗳𝘂𝗹 in cases where the 𝗲𝗻𝘃𝗶𝗿𝗼𝗻𝗺𝗲𝗻𝘁 𝗶𝘀 𝗳𝗹𝗮𝗸𝘆 but note this is an organization's choice whether they want to execute test cases against a flaky environment. Can we use 𝗜𝗿𝗲𝘁𝗿𝘆𝗮𝗻𝗮𝗹𝘆𝘇𝗲𝗿 𝗶𝗻 𝗕𝗗𝗗 𝗖𝘂𝗰𝘂𝗺𝗯𝗲𝗿? Answer is 𝗬𝗲𝘀. If we are using 𝗕𝗗𝗗 𝗰𝘂𝗰𝘂𝗺𝗯𝗲𝗿 𝘄𝗶𝘁𝗵 𝗧𝗲𝘀𝘁𝗡𝗴. Let us dive deep in to practical demonstration https://lnkd.in/dxvUaSv6 If you want to 𝗹𝗲𝗮𝗿𝗻 𝗕𝗗𝗗 𝗖𝘂𝗰𝘂𝗺𝗯𝗲𝗿 𝗳𝗿𝗼𝗺 𝘀𝗰𝗿𝗮𝘁𝗰𝗵, 𝗰𝗵𝗲𝗰𝗸𝗼𝘂𝘁 𝘁𝗵𝗲 𝗳𝗼𝗹𝗹𝗼𝘄𝗶𝗻𝗴 𝗽𝗹𝗮𝘆𝗹𝗶𝘀𝘁: Mastering BDD from Scratch || For Absolute beginners: https://lnkd.in/dWFQbf2g Follow us on Following channels for regular updates 𝗬𝗼𝘂𝘁𝘂𝗯𝗲:https://lnkd.in/gmPT55FY 𝗪𝗵𝗮𝘁𝘀𝗔𝗽𝗽: https://lnkd.in/gVqWAwg3 𝗧𝗲𝗹𝗲𝗴𝗿𝗮𝗺: https://lnkd.in/gjyMJwdD Regards PrinceAutomationDestination
Lecture19: Rerun Failed Test Cases BDD Cucumber|| IRetryAnalyzer
https://www.youtube.com/
To view or add a comment, sign in
The secret of life is to live every moment
1wLEGO steps and ninja hooks? I'm sold! BDD, here I come! Kraken be gone!