Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Upcoming SlideShare
What to Upload to SlideShare
What to Upload to SlideShare
Loading in …3
×
1 of 36

Testing Superpowers: Using CLion to Add Tests Easily

0

Share

Download to read offline

Slides from today's webinar on easily adding tests using CLion.
More info: https://claremacrae.co.uk/blog/2021/02/clion-webinar-code-and-slides

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all

Testing Superpowers: Using CLion to Add Tests Easily

  1. 1. Testing Superpowers: Using CLion to Add Tests Easily Clare Macrae, 16 February 2021 @ClareMacraeUK clare@claremacrae.co.uk
  2. 2. Topics Testing with Catch2 Testing with Approval Tests Using Code Coverage Improving the tests CLion testing tips (if time) 2
  3. 3. Introduction 3
  4. 4. Previously, on JetBrains Webinars… “Before we start refactoring, we want to add tests” “The tests are green, so we can start refactoring” “What if we don’t have tests?” “It’s a pre-requisite for any refactoring” 4
  5. 5. What if we don’t have tests?
  6. 6. Goals Add tests for untested code, quickly and safely 01 Show the power of Approval Tests to get good coverage quickly & explore the code 02 Use Code Coverage tools in CLion to guide your testing 03 6
  7. 7. Let’s look at the code 7
  8. 8. Catch2 string test 8
  9. 9. What happened? Testing multi-line strings in code is hard! Listen to the PAIN! 9
  10. 10. First Approval Test 10
  11. 11. Approval Tests allow you to verify a chunk of output (such as a file) in one operation as opposed to writing test assertions for each element 11
  12. 12. Approval Tests overview 12 The Power of Approval Tests: Simple to use File naming and creation See failures Updating expected output It just works! Roll your own?
  13. 13. Objects, Images, Sound? 13
  14. 14. Dates, Times, GUIDs? 14
  15. 15.  “I have some problems with the line endings” 15
  16. 16. Scrubber Namer Writer Comparator Pass Fail Reporter Customisation Points 16
  17. 17. github.com/approvals/ApprovalTests.cpp 17
  18. 18. Any Questions? 18
  19. 19. Code Coverage 19
  20. 20. CLion  Auto-creates configuration – Amazing! 20
  21. 21. 21
  22. 22. 22
  23. 23. C/C++ Coverage Plugin 23
  24. 24. What next (for me?)  (Learn to) Set up plugin on my Windows VM  Add this to Jay Bazuzi’s ‘machine-setup’ repo  Contribute to Plugin docs 24
  25. 25. Any Questions? 25
  26. 26. ❌ Production Data 26
  27. 27. Formatting and readability  Fake it ‘til you make it! 27
  28. 28. CLion Testing Tips 28
  29. 29. What tests to run? 29
  30. 30. Know the Test Runner Tab 30
  31. 31. Tidy Run/Debug Configurations 31
  32. 32. Know your Icons 32
  33. 33. Conclusions 33
  34. 34. Thanks! JetBrains for CLion! Markus Böck C/C++ Coverage Plugin 34
  35. 35. Tactics 35 ASSUME TESTS ARE POSSIBLE LISTEN TO THE PAIN COVERAGE IS TO HELP YOU
  36. 36. Any Questions? 36

×