-3

I've created a service application that import orders from an SQL database. Right now I'm manually entering the data into the database, but in release a 3rd party application will export orders to the database.

overview

For now, while in testing, I'd like to have a test software to simulate orders coming in and out of the database. Any suggestions?

13
  • Why not write the code to emulate the orders coming in, or capturing production data periodically to use in test? Apr 16, 2021 at 14:18
  • Yes that's true. But wonder if there is a generic one? Apr 16, 2021 at 14:21
  • 2
    @MatsGausdal: I am not sure what you mean by "generic solution", but if you are looking for a tool which magically knows which records need to be inserted or deleted to simulate incoming and outgoing orders in the specific schema of your DB, the answer is "no, there is no such tool, you have to develop one by yourself".
    – Doc Brown
    Apr 16, 2021 at 14:37
  • 1
    "in the tool one could manually enter what data to put in, and then have a counter or random variable for every entry that is published every x seconds" - that does not sound like a generic requirement to me, but a very specific one - so yes, you will most probably have to write your own specific solution.
    – Doc Brown
    Apr 16, 2021 at 15:18
  • 1
    For each test case, mock the database interface, if possible. Otherwise, have a set of records for each test case and load those into your test database before each test is run. As suggested by others you can extract the data you need from a production database. You don't, however, need to load the whole database.
    – John Douma
    Apr 18, 2021 at 15:40

1 Answer 1

0

The best way to get the data for test in is the same way that it will get in in production, because its the most realistic.

So the question here is how exactly does this third part software get its data in? inserts, a sproc, an API, SSIS? use the same method to insert your test data.

If you don't know or cant tell, then you could run the tool and check the database log, or monitor the network traffic. perhaps you can even rerun the transactions

7
  • Why would it matter how the 3rd party software gets its data in? Orders are added to the database and the service application imports the orders from the database. Instead of adding the orders manually, I'd like to have a tool where I can select the database and the table, and then simulate 50 orders coming in during 2 mins. So during the 2 mins with equal interval, orderNumbers are incremented, ArticleNumbers are randomly selected from the Article table, the qty is a random integer between 1 and 50. Apr 18, 2021 at 15:37
  • 1
    because you want to ensure the the orders look exactly like real ones. if you fake the insert you may miss something. Also the process of inserting make break you code, for example deadlocks
    – Ewan
    Apr 18, 2021 at 16:01
  • @Ewan Unit tests are meant to test specific areas of the code. If we are testing how our service reacts to changes in code then it is perfectly okay to mock the data. I have seen too many slow builds because of developers who didn't grasp the idea of modularity and overcomplicated their tests.
    – John Douma
    Apr 18, 2021 at 16:56
  • @JohnDouma sure, but this question specifically asks about getting data into the database
    – Ewan
    Apr 18, 2021 at 17:13
  • if you were mocking you would mock whatever data layer retrieves the data from the database
    – Ewan
    Apr 18, 2021 at 17:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.