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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:34:56+00:00 2026-05-13T17:34:56+00:00

Looking for some practical advice here and any experiences people have had in a

  • 0

Looking for some practical advice here and any experiences people have had in a similar situation.

We use a BDD/TDD sytle methodology for building our software (quite a large/complex application) The end result is.. behavioral specifications (Given/When/Then style) derived from business requirements, unit tests that reflect these and code that reflects the requirements of tests.

However, recently our test department has started running integration tests, and understandably they want to use our (already passing) business logic code to set up and tear down test state (rather than having to deal directly with a database) as they are mainly concerned with testing via the UI of the application and do not want to spend all day wrangling databases.

The problem is, some of the Entity Repositories do not have delete methods as there has been no business requirement expressed for these yet. Many have Archive/Reinstate/backup etc. (and may have delete pending on the backlog).

So now we have a test dept. requirement for deletion (but one which conflicts with business user stories)

So…. My question is… if I were to add methods specifically for the test department… what’t the best way of handling these. I understand that this is generally considered bad practice in “TDD Utopia” but realistically, how have you dealt with this kind of conflict?

The first thoughts I have had are either use naming…

void TestOnly_Delete(Guid id){} 

…attributes…

[TestOnly]
void Delete(Guid id){}

… or compiler directives…

#if TESTBUILD
void Delete(Guid id){}
#endif

So at a minimum, developers can know not to call TestOnly methods and at a maximum, test methods are not deployed in production builds.

… or just cheat and add a user story to manage it that way 😉

Any experience or advice gratefully appreciated?

Thanks in advance.

  • 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-13T17:34:57+00:00Added an answer on May 13, 2026 at 5:34 pm

    Your first concern should be does adding this functionality enhance or deteriorate the current API? A typical scenario in TDD is that a class member is (initially) only required for testability reason, yet it conforms to all normal API design guidelines, so it does no harm (and often subsequently turn out to be a valuable addition in production code as well).

    When this is true, then by all means just add it if you can do so easily.

    Sometimes, however, the reverse is the case. In this case, you must resist the urge to add the member. However, often you can follow the Open/Closed Principle and open up your API so that others would be able to add the desired functionality. Testability is really just another word for the Open/Closed Principle.

    In your case, the simplest solution might simply be to ensure that the classes in question are unsealed and then ask the Test Department to derive from those classes and implement the functionality themselves. If they don’t have this capability, then you can do it for them, while still keeping the sub-classes test-only.

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

Sidebar

Related Questions

I'm looking for a practical application to use a genetic algorithm for. Some things
Looking for some direction here as I'm running into some migration problems. We have
We're looking for some advice on our StarTeam configuration. We have a project that
Looking for some advice on the best way to implement localization along with client
I'm looking for some best practice advice on enumerations and retrieving an associated string
I’m looking for some advice. I recently wrapped up a project where I inherited
Looking for some general advice and tips about using cancan on our latest rails3
I'm looking to introduce some database denormalization to a heavily normalized system. I have
I am posing this question looking for practical advice on how to design a
I am looking for a PHP book that introduces some real world practical techniques.

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.