Skip to content

Unit Testing

Research

  • What is Unit Testing? Why YOU Should Learn It + Easy to Understand Examples - YouTube
  • Unix Philosophy
    • Applications need to be able to be made modular so that they can be tested
  • Write awesome tests by Jeroen Mols - YouTube
  • Why do we write tests
    • Proof of workignm code
    • Safeguard that code keeps on working
    • Documentation
    • Enables refactoring
    • Release faster
    • Easiest for of testing
    • TO RUN THEM
  • Tests are production code
  • Requirements
    • CI
  • Rules
    1. Run really fast
    2. Safety net against regression
    3. Detect bugs early and cheaply
    4. Rapid feedback loop is required
    5. Run tests on every change
    6. Small and Focussed
    7. Only a few lines of code
    8. Clear structure: Assert / Act / Arrange
    9. Only one failing test for each bug
    10. Test name indicates the problem
    11. 100% Reliable
    12. Drop everything to fix failure
    13. Reason must be obvious
    14. Failures should be rare
    15. Correlation with modified code
    16. "Magical rerun" drives developers mad
    17. Lose of trust in safety net
    18. Don't trust the tests you write in the first place, why you write test (meme)
    19. 100% App Coverage
    20. Does not mean the app is bug free
    21. UI Inconsistencies
    22. Interaction between classes
    23. Interaction with external services
    24. DOES NOT MEAN ANYTHING
    25. Not even a good idea
    26. Just a tool to gamify your work
    27. TDD(Test Driven Development)
    28. Write tests before you write your code
    29. Does not matter if you do this or not but tests before code has some advantages
    30. Bare minimum code to fail or pass
    31. Pick up work with a failing test
    32. D for TDD
    33. Development
    34. Design
    35. Divide and conquer
    36. DOcumentation
    37. Devops
    38. Determination
    39. Dream
    40. Tests help sustain development rather rather than having code mania slowing down development
    41. You have to maintain the tests with the feature
    42. https://youtu.be/F8Gc8Nwf0yk?t=1556