❌Big mistake many programmers make: Assuming your code works without testing. Because you think you only made a "small" change and nothing can go wrong. But here's the thing about bugs: you NEVER expect them. Bug == Wrong assumptions. Test in the real world, not in your head.
Coding Beauty’s Post
More Relevant Posts
-
I regret that we didn't use the term "microtest" when writing this, even though neither Brett, nor Jeff, nor I knew that term back then. It was always about microtesting. Also, the T has always (only) stood for Timely. Anyone claiming otherwise is wrong. Unit Tests Are FIRST: Fast, Isolated, Repeatable, Self-Verifying, and Timely
To view or add a comment, sign in
-
Great .. Unit tests are FIRST
I regret that we didn't use the term "microtest" when writing this, even though neither Brett, nor Jeff, nor I knew that term back then. It was always about microtesting. Also, the T has always (only) stood for Timely. Anyone claiming otherwise is wrong. Unit Tests Are FIRST: Fast, Isolated, Repeatable, Self-Verifying, and Timely
Unit Tests Are FIRST: Fast, Isolated, Repeatable, Self-Verifying, and Timely
medium.com
To view or add a comment, sign in
-
Testing full feature coverage is a myth. Here's an example: To test features A, B & C you need to test all combinations of them. That's 6 cases when there is only 3 features. But if you have just 10 features there are 3.6 million cases! And that's just testing one case of each feature. Suppose, you cover only 3 different cases of each feature. That's ~2.6x10^32 different cases So clearly you can't cover all the cases. But we don't need to. We only need to cover enough cases to give us confidence that they all work correctly. The more we understand the code the more confident we become about its behaviour. When we don't understand the code, we believe the code could do anything and therefore have very low confidence that it is likely to work correctly. You want to know that everything works correctly? Understand the code. Write cases that will test the boundaries of your knowledge. Trying to cover every case is a fools errand.
To view or add a comment, sign in
-
I have been writing more tests this past month. Truth bomb: Tests pass because they don't fail. When testing, ask: “Does my code do what I expect it to, given realistic inputs?”. Good test suites are thorough but realistic.
To view or add a comment, sign in
-
Code coverage tells you nothing about the quality of your tests It literally tells you the ratio between the number of lines executed by tests vs. the number of all lines Just because a line of code is executed, it doesn't mean any behavior is verified e.g., You can achieve 100% coverage by executing all the methods (and paths inside them) while never asserting anything You can read it like this: - low coverage -> "My code is NOT thoroughly tested" - high coverage -> "Most of my code is executed by tests. If I make sure tests are valuable my code will be thoroughly tested"
To view or add a comment, sign in
-
Reminder!! 👊🏼 clear explanation about what #codecoverage is and isn’t !!
Code coverage tells you nothing about the quality of your tests It literally tells you the ratio between the number of lines executed by tests vs. the number of all lines Just because a line of code is executed, it doesn't mean any behavior is verified e.g., You can achieve 100% coverage by executing all the methods (and paths inside them) while never asserting anything You can read it like this: - low coverage -> "My code is NOT thoroughly tested" - high coverage -> "Most of my code is executed by tests. If I make sure tests are valuable my code will be thoroughly tested"
To view or add a comment, sign in
-
My bulletproof approach for fixing bugs for unknown codebases with little test coverage: 1. Write tests to cover the existing implementation 2. Write a test to reproduce the bug 3. Start fixing and refactoring efforts 4. Re-run all tests 5. Integrate the changes with confidence
To view or add a comment, sign in
-
A high code coverage tells you only that 1 problem out of many is gone. All the other problems may still stay around unsolved. e.g. the quality of the checks, checking important things. Or that some bugs cannot be found just by automation.
Code coverage tells you nothing about the quality of your tests It literally tells you the ratio between the number of lines executed by tests vs. the number of all lines Just because a line of code is executed, it doesn't mean any behavior is verified e.g., You can achieve 100% coverage by executing all the methods (and paths inside them) while never asserting anything You can read it like this: - low coverage -> "My code is NOT thoroughly tested" - high coverage -> "Most of my code is executed by tests. If I make sure tests are valuable my code will be thoroughly tested"
To view or add a comment, sign in
-
I hate beta releases of my applications. It gives you a false sense of completion. Everything you have built starts breaking even after extensive testing. What do you learn out of it?! Writing better test cases.
To view or add a comment, sign in
-
How does test execution affect code efficiency and coverage? UnderstandingTestExecution: How does a test execute? Hey there! 💬 So, you're delving into the world of unit testing and stumbled upon a question about test execution - interesting stuff, right? Let's break it down! The Two Test Examples 📚 In the examples provided, we see two different approaches to testing a method that checks if a string is long or not. It's a great way to showcase efficient testing practices. First Example: In the first snippet, the test only covers t... Read more: https://lnkd.in/gUXU3_tc
To view or add a comment, sign in
29 followers