Artwork

内容由Peter Fisher提供。所有播客内容(包括剧集、图形和播客描述)均由 Peter Fisher 或其播客平台合作伙伴直接上传和提供。如果您认为有人在未经您许可的情况下使用您的受版权保护的作品,您可以按照此处概述的流程进行操作https://zh.player.fm/legal
Player FM -播客应用
使用Player FM应用程序离线!

142 - 6 Ways to improve your code tests

39:09
 
分享
 

Manage episode 317514406 series 2674787
内容由Peter Fisher提供。所有播客内容(包括剧集、图形和播客描述)均由 Peter Fisher 或其播客平台合作伙伴直接上传和提供。如果您认为有人在未经您许可的情况下使用您的受版权保护的作品,您可以按照此处概述的流程进行操作https://zh.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集单集

Artwork

142 - 6 Ways to improve your code tests

How To Code Well

123 subscribers

published

icon分享
 
Manage episode 317514406 series 2674787
内容由Peter Fisher提供。所有播客内容(包括剧集、图形和播客描述)均由 Peter Fisher 或其播客平台合作伙伴直接上传和提供。如果您认为有人在未经您许可的情况下使用您的受版权保护的作品,您可以按照此处概述的流程进行操作https://zh.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集单集

所有剧集

×
 
Loading …

欢迎使用Player FM

Player FM正在网上搜索高质量的播客,以便您现在享受。它是最好的播客应用程序,适用于安卓、iPhone和网络。注册以跨设备同步订阅。

 

快速参考指南