Skip to Content
Serverless computing in Azure with .NET
book

Serverless computing in Azure with .NET

by Sasha Rosenbaum
August 2017
Intermediate to advanced
468 pages
12h 5m
English
Packt Publishing
Content preview from Serverless computing in Azure with .NET

Unit test best practices

While unit testing best practices are somewhat subjective, there are a number of the following standards most engineers agree upon:

  • Test only one code unit at a time
  • Mock out all the external components and dependencies
  • Make each test independent of the others
  • Avoid situations where tests must run in a specific order, or are otherwise interdependent
  • Have one, and only one test to verify each behavior. It is counter-productive to have multiple test failures indicate the same defect.
  • Only make one logical assertion per test. The assertion should, specifically, verify the expected behavior under test, not any additional observations about the code behavior
  • Name unit tests clearly and consistently
  • Avoid unnecessary preconditions ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Azure Serverless Computing

Mastering Azure Serverless Computing

Lorenzo Barbieri, Massimo Bonanni
Implementing Azure: Putting Modern DevOps to Use

Implementing Azure: Putting Modern DevOps to Use

Florian Klaffenbach, Oliver Michalski, Markus Klein, Mohamed Wali

Publisher Resources

ISBN: 9781787288393Supplemental Content