Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 147711
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:49:45+00:00 2026-05-11T08:49:45+00:00

A Unit-Test should produce deterministic result be independent be valid … What other characteristics

  • 0

A Unit-Test should

  • produce deterministic result
  • be independent
  • be valid
  • …

What other characteristics should a test also have?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T08:49:46+00:00Added an answer on May 11, 2026 at 8:49 am

    Ah. My favorite subject 🙂 Where to start…

    According to xUnit test patterns by Gerard Meszaros (THE book to read about unit testing)

    • Tests should reduce risk, not introduce it.
    • Tests should be easy to run.
    • Tests should be easy to maintain as the system evolves around them

    Some things to make this easier:

    • Tests should only fail because of one reason. (Tests should only test one thing, avoid multiple asserts for example.)
    • There should only be one test that fails for that reason. (this keeps your testbase maintainable)
    • Minimize test dependencies (no dependencies on databases, files, ui etc.)

    Other things to look at:

    Naming
    Have a descriptive name. Tests-names should read like specifications. If your names get too long you’re probably testing too much.

    Structure
    Use AAA structure. This is the new fad for mocking frameworks, But I think it’s a good way to structure all your tests like this.

    Arrange your context
    Act, do the things that need to be tested
    Assert, assert what you want to check

    I usually divide my tests in three blocks of code. Knowing this pattern makes tests more readable.

    Mocks vs. Stubs
    When using a mocking framework always try to use stubs and state based testing before resorting to mocking.

    Stubs are objects that stand in for dependencies of the object you’re trying to test. You can program behaviour into them and they can get called in your tests. Mocks expand on that by letting you assert if they were called and how. Mocking is very powerfull but it lets you test implementation instead of pre and post-conditions of your code. This tends to make tests more brittle.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically I have two main questions: What exactly should you unit test? How do
What Makes a Good Unit Test? says that a test should test only one
In .NET should you place unit test projects in with the rest of the
I am wondering should I write unit test for everything. There are some classes
I want to create a unit test for integration testing. What class should I
I want that my unit tests to cover my POCO's. How should I test
I have to write the following unit test cases in testng: saveProductTest which would
To ensure coding standards I have a couple of unit test which uses reflection
I have the below class I want to unit test: public class MyClass {
I'm new to unit testing and have written the following test: /** * @expectedException

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.