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 6148683
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:19:19+00:00 2026-05-23T19:19:19+00:00

We use both (executable) specs and unit tests in some of our financial software.

  • 0

We use both (executable) specs and unit tests in some of our financial software. The specs cover business behavior, the unit tests cover code. We use other testing methods as well, such as automated integration tests, etc., but that’s not what I’m asking about here.

Sometimes I’ll be writing code which, by its very nature, I know is — and always will be — completely covered by a spec, because it is core business functionality. An example would be rounding rules.

In these times I’m conflicted between wanting to write unit tests anyway (because of a feeling that the business requirements could change, even when they seem, as in the case above, like something which will be an issue forever) and feeling like I’m wasting time writing “redundant” unit tests.

Has anyone found good rules of thumb for this?

  • 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. Editorial Team
    Editorial Team
    2026-05-23T19:19:21+00:00Added an answer on May 23, 2026 at 7:19 pm

    …Speed isn’t an issue in this case. The executable specs and the unit tests are both quite fast, and in fact run as one unit; the specs are wrapped in unit tests so that they all run together…

    As far as I understand above means that having unit tests in addition to executable specs won’t help in discovering bugs faster, correct?

    Well given that, the only rule of thumb that comes to mind is to look at it from the perspective of some future maintainer. You know, the guy who doesn’t know you, the guy who doesn’t share your current knowledge – some guy who just got your code to deal with. How to make life easier for that guy?

    Let’s see…

    • if I choose to write duplicate unit tests, this may confuse my imaginary future-maintainer. “Why oh why did this idiot wrote duplicate tests? What was he thinking about?”

    • if I decide to simply skip unit tests, this may be confusing, too. “Oh this isn’t covered by unit tests why could that be? Is it because it’s already covered by some executable spec or because someone just forgot to write a unit test here?”

    In both cases the problem seems to be that I failed to reveal my intent. I failed to express the reasons why I did it one or another way. Solution is, respectively, to find a way to express my intent. For this, I’d use an annotation or self-explaining code like

      assertTrue("missing unit test", BusinessKnowledge.okToRelyOnSpecTests());
      // make okToRelyOnSpecTests return false if you find it to be... well, false
    

    Whether to use annotation or code is probably a matter of personal preference. Or a matter of team habits/practices. Just be consistent and do not mix – following the same rule of thumb “not to confuse future maintainer”.

    We don’t want this guy to spend sleepless nights trying to figure hidden reasons why some parts are covered by annotations while other are served by code do we? 🙂

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

Sidebar

Related Questions

I don't know how to use both of them. So a sample code with
I'm trying to use jasmine-node for our testing of js files. We've written some
I have some scripts that I often use in both windows(cygwin) and linux, I'd
I have written some code that makes use of an open source library to
I use both ruby on rails and Java. I really enjoy using migrations when
I use both Firebird embedded and Firebird Server, and from time to time I
We use both Examdiff and Kdiff3 to view Mercurial changes. Just add this to
Is it possible to use both JScript and VBScript in the same HTA? Can
I would like to use both of these library on the same page but
I want to use both ContextLoaderListener (so that I can pass Spring Beans to

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.