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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:31:44+00:00 2026-05-25T02:31:44+00:00

I’m working with a legacy application that makes some use of the well-known/dreaded data

  • 0

I’m working with a legacy application that makes some use of the well-known/dreaded data modeling pattern known as EAV. This has made choosing a data generation strategy to use during unit testing of the DAL difficult. Why? Because, in addition to the normal Fk/Pk constraints between tables (which we are using when possible), there are additional relationships/constraints that only the application layer is aware of and enforces.

According to this article, the easiest data tests to write and maintain are those that rely on an externally defined and static data set. However, it seems that attempting to create a dataset that incorporates the relationships already modeled in my application layer “by hand”, would be a DRY violation and a major PITA too boot. On the other hand, using my application layer to generate test data feels even more distasteful as that violates unit testings’ prime directive (isolation) since regression in the application layer can cause my DAL layer to throw bogus failures.

For this reason, I’m leaning towards the static dataset option, that is unless others who have had to deal with unit testing an EAV model can chime in with alternatives.

Many thanks.

  • 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-25T02:31:45+00:00Added an answer on May 25, 2026 at 2:31 am

    If the DAL is not responsible for enforcing certain application rules in the data store, then there is no need to ensure that the test data conforms to those higher-level rules. The unit test need only verify that the DAL enforces the rules that are its responsibility — presumably things like staying within the database constraints, data types, etc. The data need only conform to the preconditions of the DAL itself to constitute a valid test case. The higher level rules will be checked within the application layer’s unit test in which the DAL will be stubbed or mocked out. Under these assumptions, either a static dataset or one generated using trivial code will likely be adequate for the DAL tests.

    It may well be that the “legacy” nature of the application makes it difficult if not impossible to unit test the application and DAL layers separately. In effect, the two layers collectively would be a single (if complex) “unit”. In this case, it would be acceptable (or perhaps “tolerable” is the right word) to generate the test data using the application layer as a matter of expediency. Such generation would, in effect, constitute yet more test cases for the conglomerate “unit”. DAL failures due to application layer regressions should be investigated as candidate bugs in one, the other or both layers. Any time spent attempting to pry these two layers apart into separate units would likely pay dividends in the long run.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace

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.