Giter Site home page Giter Site logo

testdatagen's Introduction

Nuget

I'm updating this for .NET6, because I have a new need for it.

Please see the test to see a simple case in action.

Documentation below is out of date, but gives some context.


Nuget package: AoTestDataGen

CodeProject article: A-Random-Test-Data-Generator-Library

There are several test data generator apps for SQL Server -- Red Gate, ApexSQL, and DevArt have tools that come to mind. I actually bought the Red Gate app. I did not try the ApexSQL app if I recall, but my problem with Red Gate's tool was that although you could do random foreign key lookups, you couldn't put a filter or predicate on those lookups. This is important in multi-tenant systems where foreign key values must be consistent within a certain customer "partition." In other words, you can't have foreign key values that cross customer boundaries. I have not seen that as a feature in any of the apps I looked at, so that's something I wanted to address.

This repo is just my baby steps towards a test data generator app for SQL Server. There is no user interface yet, just some low-level randomization and data access methods. I am not positive that I want to to build a GUI at all -- right now I'm just exploring feasibility.

Here's an example I used today (6/8/17) that generated 100 random "customer" records via an MVC action. Although my example uses the Postulate SaveMultiple method to save the data, this library has no dependence on Postulate.

Here's a link to the Generate method in this library that does the actual work. Also, note the Random method. There are a couple overloads of it (as well as a RandomWeighted method). This is what supplies individual random values to a property when generating a random object.

img

Here's a couple more examples. Here is a simple use of the Random method to select any character from an array. There's no weighing in effect, so the 'M' and 'F' values will be more or less equally used:

img

But you can also weigh items in source array differently so that certain selections come up more often. Here's an example that uses the RandomWeighted method to make 'M' come up 3x as often as 'F'. It relies on the IWeighted interface.

img

testdatagen's People

Contributors

adamfoneil avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

testdatagen's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.