Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Insider News
  4. You probably shouldn't mock the database

You probably shouldn't mock the database

Scheduled Pinned Locked Moved The Insider News
databasequestion
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kent Sharkey
    wrote on last edited by
    #1

    Dominik Braun[^]:

    To keep unit tests fast and isolated, the data access layer is often tested using a mock of the database. But are unit tests and mocks actually a good choice?

    It's trying the best it can

    M 1 Reply Last reply
    0
    • K Kent Sharkey

      Dominik Braun[^]:

      To keep unit tests fast and isolated, the data access layer is often tested using a mock of the database. But are unit tests and mocks actually a good choice?

      It's trying the best it can

      M Offline
      M Offline
      MarkTJohnson
      wrote on last edited by
      #2

      Quote:

      A real instance of the same database as used in production can be launched within an integration test, which significantly minimizes the differences between the testing and production environments.

      "To Dream the impossible Dream" I've been begging for this for years and been told no every time, to much PII. But then again we ONLY see some of the bugs with client data.

      I’ve given up trying to be calm. However, I am open to feeling slightly less agitated. I’m begging you for the benefit of everyone, don’t be STUPID.

      N 1 Reply Last reply
      0
      • M MarkTJohnson

        Quote:

        A real instance of the same database as used in production can be launched within an integration test, which significantly minimizes the differences between the testing and production environments.

        "To Dream the impossible Dream" I've been begging for this for years and been told no every time, to much PII. But then again we ONLY see some of the bugs with client data.

        I’ve given up trying to be calm. However, I am open to feeling slightly less agitated. I’m begging you for the benefit of everyone, don’t be STUPID.

        N Offline
        N Offline
        Nelek
        wrote on last edited by
        #3

        That's the advantage of small teams... In a previous job, I started a routinary process to backup the servers in images every 6 months periodically, the week before a rollout, the day before a rollout, the day after the rollout and a week after the rollout... Not only I could roll back if something didn't work fine, but I could get one of the backups running in a VirtualBox in an Offline PC and test with real data (not necessarily up-to-date, but still a complete real set) in a controlled environment. Being able to do my job correctly was more important for me (and my customer) than burocrats half a world away. So I just did as the quote says: "Better to ask for forgiveness than to ask for permission"

        M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you Rating helpful answers is nice, but saying thanks can be even nicer.

        R 1 Reply Last reply
        0
        • N Nelek

          That's the advantage of small teams... In a previous job, I started a routinary process to backup the servers in images every 6 months periodically, the week before a rollout, the day before a rollout, the day after the rollout and a week after the rollout... Not only I could roll back if something didn't work fine, but I could get one of the backups running in a VirtualBox in an Offline PC and test with real data (not necessarily up-to-date, but still a complete real set) in a controlled environment. Being able to do my job correctly was more important for me (and my customer) than burocrats half a world away. So I just did as the quote says: "Better to ask for forgiveness than to ask for permission"

          M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you Rating helpful answers is nice, but saying thanks can be even nicer.

          R Offline
          R Offline
          Rob Grainger
          wrote on last edited by
          #4

          That can be an issue under a data protection regime, where developers generally shouldn't have access to real data except in the context of resolving issues. In such environments, great care must be taken to scramble any data that may include personally identifiable information or commercial information.

          "If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.

          N 1 Reply Last reply
          0
          • R Rob Grainger

            That can be an issue under a data protection regime, where developers generally shouldn't have access to real data except in the context of resolving issues. In such environments, great care must be taken to scramble any data that may include personally identifiable information or commercial information.

            "If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.

            N Offline
            N Offline
            Nelek
            wrote on last edited by
            #5

            Rob Grainger wrote:

            shouldn't have access to real data except in the context of resolving issues

            And that's exactly the point. That many bugs or fixes can't be found without the real environment.

            Rob Grainger wrote:

            great care must be taken to scramble any data that may include personally identifiable information or commercial information.

            I always take care. Additionally, that was before the GPDR (or however it is called in english) was activated, the server / data was in India and there were no personally identifiable information, relevant comercial information was very low (and nothing out of the scope of my work).

            M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you Rating helpful answers is nice, but saying thanks can be even nicer.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups