Another tool I am pleased to announce – Mockaroo Data Munger!
This tool is an interface between Mockaroo and your CDS environment. Mockaroo is an excellent random data generator which has been my go to source for data over the last couple of years for building demo or test data sets. I found myself regularly configuring Mockaroo data exports, creating Excel spreadsheets and then importing them to the latest demo environment.
As Mockaroo has an API, the next logical step is to bring this API to the XrmToolBox. This is so I can cut out the middle man – no need to do the export to Excel, map the data in a CDS import and wait for the import, let a tool do it for me.
As Mockaroo has an API, the next logical step is to bring this API to the XrmToolBox. This is so I can cut out the middle man – no need to do the export to Excel, map the data in a CDS import and wait for the import, let a tool do it for me.
(Blame Chris Huntingford for the name)
NMockaroo is a little library that provides an easy way for you to generate mock data based on your C# objects using the Mockaroo API. Mockaroo is an excellent random data generator which has been my go to source for data over the last couple of years for building demo or test data sets. I found myself regularly configuring Mockaroo data exports, creating Excel spreadsheets and then importing them to the latest demo environment.
TLDR;
I created a tool to allow creation of random data using the Mockaroo API available in XrmToolBox here.
Walkthrough of the Tool
First of all, you will need a Mockaroo Key. Go here and sign up. A Mockaroo account is free, if you can cope with 200 requests a day, 1000 rows per request. Pretty impressive for free. In all my testing, I have never scratched these limits. As Mockaroo paid plans are intended to be used by testers, calling the api for a single record multiple times etc, for our usage, the free plan is more than enough.
Once you have an account, go to My Account and grab your API Key.
In the Tool, enter this in the toolbar.
You can save this key along with your map by hitting the Save Current Map button.
Next, select an entity. The fields that are displayed are those that are available for entry when a record is created. Certain fields aren’t, like the Create and modified Dates and users. Others are calculated/roll up fields.
Choose your Mock Types
Mockaroo provides various types of data, from address information to car makes, MAC addresses and other useful information. Useful to someone, maybe not you. These are listed here. I have transitioned those to selectable types in the grid.
Choose a row and hit the checkbox. This will populate the mock types that are relevant to your selection – even I try to prevent text going into numbers. If there is any options for you to choose from or configuration of the type, the Options field is populated with the defaults. You can change these defaults by clicking on the little grey box (not to self, add an icon).
A small form will pop up, allowing you to make modifications to the default selections. This could be selecting one or more choices for a picklist, setting the minimum or maximum for numbers or the number of paragraphs of random text you need for your memo.
Once you are happy with your data configuration, it is time to call the API. Select the number of records you desire and hit Get Mockaroo Data.
Mocked Data
After hitting the button, the Results tab becomes available. This lists the data that has been generated for you, before you insert it in your environment.
The raw values are displayed, as in the numeric value for any picklists and guids for any lookups. On the road map to show the friendly versions of these records.
If you are happy, hit Create Data. Phonerescue 3 7 0 – ios data recovery program manual. This will insert the data and present any issues that are returned in doing so.
Creating data has a lot of issues, most are down to the data. You can not assign records to users without the appropriate security rights for example. There are a multitude of rules that CDS has, particularly when using the first party apps like Sales or Field Service. These are not usually for data integrity reasons, but business logic, fired prior to the record being created.
Unfortunately, all I can do is present the issues to you so you can fix the data.
Unfortunately, all I can do is present the issues to you so you can fix the data.
Next Steps
I want to add Resolving cases and other business logic that is done after the record is created normally to allow simple creation of these records. I am also looking for suggestions how it can be improved, particularly around the types of data you need to generate – combining fields for example.
Go over to the GitHub page to raise an issue https://github.com/LinkeD365/MockarooDataMunger/ and let me know what you think.
I'm currently working on a project that requires realistic test data. In the past, I've used tools such as RedGate's SQL Data Generator for this purpose, which is fantastic if you are looking for a commercial product. Recently, I came across Mockaroo, an online test data generator. It is currently free and lets you generate up to 100,000 rows of realistic test data in CSV, JSON, SQL, and Excel formats. If that's not enough data for you, there is also a Big Data Edition which lets you generate unlimited JSON and CSV data, leveraging multi-core cloud computing.
Mockaroo.com
The Mockaroo website provides an intuitive interface that makes it extremely easy to generate test data.
You simply enter a field name and select a data type. You can move fields up using the handle bars on the left, or delete fields using the cross on the right. Most field types are simple like this but some, like the URL shown above, allow you to specify additional customisations.
Here is a sample of the data that Mockaroo generates for this schema. Note that data is related across fields in the same row, so Judy Barnes has an email address of [email protected].
The data types are the real power of Mockaroo. It supports 74 different types, each of which provide a range of appropriate sample data that is used to populate the field. You can see the list of 74 types on the API docs page. When you select the data type in the schema editor you are presented with a great dialog which makes it easy to filter and choose the appropriate data type.
In keeping with the overall theme of simplicity, Mockaroo makes creating an account about as simple as I've seen it. Just click on the
Sign in with
Google or Facebook links. I chose Google, then clicked one of my Google accounts, and that was it, I had an account setup. Once you have an account you can save and clone schema.REST API
![Mockaroo Mockaroo](https://blog.appsheet.com/hs-fs/hubfs/mockaroo.png?width=439&name=mockaroo.png)
Mockaroo provides a REST API, which lets you download randomly generated data into your projects in real-time with unlimited calls. You can download based on a saved schema or fields you define at runtime. Anything you can generate via the website can also be generated via the REST API. The API is currently free for all to use while it is in open beta, but you need to create an account and get an API key to use it.
The API contains a single GET method,
generate
, which will return CSV or JSON formats depending on the file type part of the URL. The docs page provides JavaScript and Java examples, so I thought I would provide one here using .Net and
HttpClient
. I will define the fields at runtime rather than using a saved schema.The fields must be defined as a JSON array and can be passed in the request body or in the query string as a
fields
element. Here, I've created a simple MockerooParameter
class for each field specification and then serialized the collection to a JSON array using ServiceStack's JsonSerializer
. You don't need to create a parameter class like this, but I found the serialization produced cleaner JSON this way. Note the call to EmitCamelClassNames
which tells the JsonSerializer
to emit the property names with camel case in the JSON, even though the class uses title case.Mockaroon
When I construct the request I pass my API key, the count of how many records I want returned, and the JSON field specification in the query string.
And finally call the API and serialize the JSON response into a strongly-typed class that represents the fields specified:
Creating Data Sources from Mockaroo Data
Mockaroo Data Generator
I mentioned that I was working on a test data project. I needed to create dictionary files of unique words representing the sorts of data in the Mockaroo field types. Mockaroo does not currently provide access to the data sources it uses for those data types (some are generated with regular expressions, but some are using word dictionaries) but it is quite straightforward to grab the data.
First, I created a schema that contained a field for each of the 74 data types, then I used the web interface to generate a JSON file with the maximum 100,000 records. Visual Studio has a really great feature that lets you take a row of JSON and paste it as a class (I wrote about it last year). That produces this strongly-typed class:
Then, it's just a case of taking a distinct list of words from the specified field and saving it to a text file:
which is called like this:
Mockaroon
and produces a text file of city names:
Check it out
Mockaroo is a really great product. Its creator, Mark Brocato, was incredibly responsive and helpful to my questions by email when I was putting my test data together, so a big thanks to him for that. Features are frequently being added to Mockaroo and you can see those reported on twitter.
How To Make Macarons Recipe
Mellel 4 1 3 download free. All the code from this post is on github.