cloud, testing

Product Excellence Best Practices

What are the components that help teams to build quality into their outcomes?

The main goal is to create a baseline that developers could follow and be in a quality level that is well defined and measurable. The main parts to focus on are:

  1. Testing
  2. Code reviews
  3. Static analysis
  4. Health monitoring: availability, resilience, etc’.


Why you wish to invest in it?

  1. It should be FAST and easy – The tests should run fast in order to encourage developers to use them constantly during the development process. Later, in your CI/CD system that automation of tests (small ones) should run as fast as possible (minutes not hours) so you can move quickly to the next phase. It’s worth to mention that you don’t need to run ALL the tests here. Some part of tests (smoke tests or other term you like) should give you enough confidence to move forward with the pull request or the merge of the change into your main branch.
  2. Stable – The test doesn’t break often. You wish to minimize the false-positive ratio as much as you can. This is why you need ‘small’ tests that are encapsulated and give you a clear sign on what is working (or not).
  3. Easy to read, maintain, run and understand.
  4. Catches Bugs! When a test fails it’s most probably a bug. You wish to avoid ‘flaky’ tests as it’s one of the productivity breakers.
  5. Automated – If you are running tests in a manual phase it’s ok for the ‘last mile’ but not for all the other important cases. You CI/CD system should run your test each time a change it being made to the codebase.

How to improve your tests?

  1. Have a good coverage of your code: a) ~70% with unit tests which are ‘small’ tests that run fast and encapsulated. It might be that the right number for your needs is higher, so go for it. The idea here is to think about the ROI and make sure the tests are helpful. b) 20% for integration tests c) 10% for UI (or end-to-end) tests.
  2. ROI – A good coverage to effort ratio.
  3. Make sure you have: a) Unit tests b) Integration tests c) Functional tests / End-to-end tests d) Performance test
  4. It’s all automated and part of your build process.
  5. You can also divide the world of ‘test type’ to S/M/L.
  6. When you have an issue with production → You creating a test to cover it in the future.
  7. Learn from your (and others!) history. Build a process of debriefing after each time something happened (or almost happened) and create a test that covers this case for the future.
  8. You can test in production but think carefully if it’s the right thing to do for your specific case. Can you use Mocks, Stubs?

Code Reviews

Code review is a process that extremely helpful to improve developers and catch critical bugs or ‘logic complexity’ that will explode in the future. If there is only one thing you wish to take from these ideas – take this one and create a process of code review around each change in your code.

Benefits of a code review process

  • Accidental errors (e.g., typos) as well as structural errors (e.g., dead code, logic or algorithm bugs, performance or architecture concerns) are often much easier to spot for critical reviewers.
  • Legible code is more reusable, bug-free, and future-proof.
  • Committers are motivated by the notion of a viewer who will look over the change request: the committer tends to clean up loose ends, consolidate TODOs, and improve the commit.
  • Sharing knowledge: Reviewers may possess knowledge about programming techniques or the code base that can help improve or consolidate the change.
  • Consistency in a code base makes code easier to read and understand.

Static Analysis

This is one of the easiest things to start with. If you have a system around continues integration there are many options (=plug-ins) to use tools for static analysis. Why you wish to do it? Low Effort → High ROI

More benefits form using static analysis tools

  1. Helps identify potential software issues during development.
  2. Helps to detect code that needs: simplification, readability, testability etc’.
  3. It also improves communication in the development team and helps to produce high quality code.

What are the (main) options?

  1. You can use a SAAS option like Sonarsource
  2. SpotBugs – part of your build/dev process.
  3. Many other options to use linting extensions/plug-in so you will catch many issues during development time.

Few suggestions for FrontEnd Developers

  1. Mountebank – Mocking over the wire
  2. – Solving visual testing across design, development, and deployment.
  3. – UI testing with ML.
  4. Jest – unit and integration tests and TestCafe for UI tests.
  5. A testing structureMocha (Full tutorial), Jasmine, Jest, Cucumber
  6. Provide assertions functionsChai, Jasmine, Jest, Unexpected
  7. Generate, display, and watch test results – Mocha, Jasmine, Jest, Karma
  8. Generate and compare snapshots of component and data structures to make sure changes from previous runs are intended – Jest, Ava
  9. Provide mocks, spies, and stubsSinon, Jasmine, enzyme, Jest, testdouble
  10. Generate code coverage reports – Istanbul, Jest, Blanket
  11. Katalon Studio – a full IDE for UI tests.
  12. Provide a browser or browser-like environment with a control on their scenarios execution – Protractor, Nightwatch, Phantom, Casper

Last but not least, it’s useful to remember that in order to have quality you should not focus on the tools and frameworks but about the culture and the people. As Jeff said in the past:

“High standards are contagious. Bring a new person onto a high standards team, and they’ll quickly adapt. The opposite is also true.”


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s