Seeding data for automated tests

Hi, I’m currently writing some selenium tests for a c# bot project, but when I run my tests with a fresh database it doesn’t have enough data (in the form of users, entities and relationships) for me to get adequate coverage of my app’s functionality.

Is there an effective way to generate the data I need to test out all of my app’s functionality?

1 Like

You can put seed data into DataSeedHelper.cs, inside the CreateObjects function. This is the function which manages setting up the initial users which are available for development environments, but you can use it for setting up any data you’d like.

Be warned, however: This file is run every time the server starts. You may need to add a check to ensure that it doesn’t reseed data that you already have.

If you seed data here, it will then be available to any Selenium or Serverside tests you run. If needed, you can add conditions to prevent it from appearing in non-development environments, if you don’t want your production environment tainted with test data.