DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
  1. DZone
  2. Testing, Deployment, and Maintenance
  3. Testing, Tools, and Frameworks
  4. ALM Dos and Don'ts: Unit Tests

ALM Dos and Don'ts: Unit Tests

Unit testing is an important part of application lifecycle management. Here's how to write maintainable tests to ensure that your production code is running as planned.

Michele Ferracin user avatar by
Michele Ferracin
·
Aug. 21, 18 · Opinion
Like (1)
Save
Tweet
Share
5.08K Views

Join the DZone community and get the full member experience.

Join For Free

Do: Write independent tests. Any given behavior should be specified in one and only one test.

Don't: Write big and monolithic tests that verify many behaviors.

A unit test is a runnable piece of code that verifies that another piece of code (called production code) does what it is supposed to do.

A unit test has many characteristics, and one of the most important is that a single unit test must verify one and only one thing. If a unit test specifies more than one behavior, things become harder to maintain. Once a test fails, it has to be easy to understand what is going wrong and which section of our production code is behaving badly.

As a best practice, we make each test independent of all the others. Any given behavior should be specified in one and only one test. Otherwise, if you change that behavior later, you'll have to change multiple tests.

unit test Application lifecycle management

Published at DZone with permission of Michele Ferracin, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • How to Cut the Release Inspection Time From 4 Days to 4 Hours
  • What Is Policy-as-Code? An Introduction to Open Policy Agent
  • Efficiently Computing Permissions at Scale: Our Engineering Approach
  • Explaining: MVP vs. PoC vs. Prototype

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: