Unit testing with production data

Hi.

We're developing an analysis type of software, in which we fetch data from the database, and run some analysis on it.

For our unit tests, it's very hard to create fake or anonymized data, so I'm thinking maybe we simply should use production data in our tests. We'd basically do something like this in our tests:

  1. We create a database mock that returns the real production data. Typically this data would be a file export from the real SQL query
  2. We run this data though our code under test, and verify the output

Of course, we'd have to make sure not to add the production data to our git repo.

On the one hand, this sounds ok, but it means we have to maintain test data somewhere outside of the repo, which is a hazzle. Plus, using production data in a unit test doesn't sound right, but having to create fake data sounds even worse.

So, how have other developers handled this sort of issue before?

submitted by /u/tangleofcode
[link] [comments]

from Software Development – methodologies, techniques, and tools. Covering Agile, RUP, Waterfall + more! https://ift.tt/3lmT7t9

Leave a comment

Design a site like this with WordPress.com
Get started
search previous next tag category expand menu location phone mail time cart zoom edit close