Artwork

Content provided by Peter Fisher. All podcast content including episodes, graphics, and podcast descriptions are uploaded and provided directly by Peter Fisher or their podcast platform partner. If you believe someone is using your copyrighted work without your permission, you can follow the process outlined here https://player.fm/legal.
Player FM - Podcast App
Go offline with the Player FM app!

142 - 6 Ways to improve your code tests

39:09
 
Share
 

Manage episode 317514406 series 2674787
Content provided by Peter Fisher. All podcast content including episodes, graphics, and podcast descriptions are uploaded and provided directly by Peter Fisher or their podcast platform partner. If you believe someone is using your copyrighted work without your permission, you can follow the process outlined here https://player.fm/legal.

Change log:

  • All the code notes for Docker for beginners course has been written. This is available on GitHub
  • I’ve started work on transcribing that course. This will take a long time.
  • I’ve fixed issues on howtocodewell.net regarding signup, forgotten password and other minor fixes
  • I’ve added the functionality to lock and unlock courses. This will turn them into private or public courses that require enrolment

6 ways to improve your testing

1) Automate as much as you can

  • Use CI pipelines
  • Run these locally even if your’e not committing any changes
  • Include other code auditing tools such as phpstan or phpmd

2) Statics are evil

  • There is no way to test a static method that calls another static method

3) Having many mocks is an indication of bad code design

4) Use tests to help refactor you code

  • If a unit of work cannot be easily tested then it usually means the code is not designed well
  • Break up your tests into smaller chunks
  • Tests can highlight micro and minor refactors
  • Refactor your code and then re test
  • Try and do this in a TDD fashion

5) Avoid flaky tests

  • Clean up state
  • Check for bottle necks which could cause timeouts
  • Mock external services or dependancies
  • Look into potential memory leaks

6) Re think what testing means to you

  • Testing is a contractual agreement between the programmer and the code
  • Testing is documentation - Gherkin, Acceptance Criteria, Business requirements
  • Testing is boundary setting which helps with focus
  • Testing is future proofing

Watch the show on YouTube

Contact me and let me know your thoughts or get something read out on air.

My web development courses

➡️ Learn How to build a JavaScript Tip Calculator

➡️ Learn JavaScript arrays

➡️ Learn PHP arrays

➡️ Learn Python

✉️ Get my weekly newsletter

⏰ My current live coding schedule (Times are BST)

Thursdays 20:00 = Live Podcast YouTube

Sundays 14:30 - Live coding on Twitch

  continue reading

201 episodes

Artwork

142 - 6 Ways to improve your code tests

How To Code Well

122 subscribers

published

iconShare
 
Manage episode 317514406 series 2674787
Content provided by Peter Fisher. All podcast content including episodes, graphics, and podcast descriptions are uploaded and provided directly by Peter Fisher or their podcast platform partner. If you believe someone is using your copyrighted work without your permission, you can follow the process outlined here https://player.fm/legal.

Change log:

  • All the code notes for Docker for beginners course has been written. This is available on GitHub
  • I’ve started work on transcribing that course. This will take a long time.
  • I’ve fixed issues on howtocodewell.net regarding signup, forgotten password and other minor fixes
  • I’ve added the functionality to lock and unlock courses. This will turn them into private or public courses that require enrolment

6 ways to improve your testing

1) Automate as much as you can

  • Use CI pipelines
  • Run these locally even if your’e not committing any changes
  • Include other code auditing tools such as phpstan or phpmd

2) Statics are evil

  • There is no way to test a static method that calls another static method

3) Having many mocks is an indication of bad code design

4) Use tests to help refactor you code

  • If a unit of work cannot be easily tested then it usually means the code is not designed well
  • Break up your tests into smaller chunks
  • Tests can highlight micro and minor refactors
  • Refactor your code and then re test
  • Try and do this in a TDD fashion

5) Avoid flaky tests

  • Clean up state
  • Check for bottle necks which could cause timeouts
  • Mock external services or dependancies
  • Look into potential memory leaks

6) Re think what testing means to you

  • Testing is a contractual agreement between the programmer and the code
  • Testing is documentation - Gherkin, Acceptance Criteria, Business requirements
  • Testing is boundary setting which helps with focus
  • Testing is future proofing

Watch the show on YouTube

Contact me and let me know your thoughts or get something read out on air.

My web development courses

➡️ Learn How to build a JavaScript Tip Calculator

➡️ Learn JavaScript arrays

➡️ Learn PHP arrays

➡️ Learn Python

✉️ Get my weekly newsletter

⏰ My current live coding schedule (Times are BST)

Thursdays 20:00 = Live Podcast YouTube

Sundays 14:30 - Live coding on Twitch

  continue reading

201 episodes

All episodes

×
 
Loading …

Welcome to Player FM!

Player FM is scanning the web for high-quality podcasts for you to enjoy right now. It's the best podcast app and works on Android, iPhone, and the web. Signup to sync subscriptions across devices.

 

Quick Reference Guide