Return to site

Mockaroo

broken image


In comes Mockaroo, which, as they say on the site: 'lets you generate up to 1,000 rows of realistic test data in CSV, JSON, SQL, and Excel formats.' What do they mean by realistic? What do they mean by realistic? The 'Generate' function in DATPROF Privacy offers more than 20 synthetic test data. 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. This is the issuer endpoint for Mockaroo tenant. You can get OpenID Connect endpoint addresses and client credentials here. You can test authentication on tenant's OpenID Connect Test page or you can try random user generation on. Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.

At a recent client engagement, my colleague had to create some location data for testing one of the client application. The data creation involved multiple steps like downloading some data from the net, removing some columns, transforming it as per needs using Python code. The process was a bit time-consuming. Recently when I was searching for some tools for data gathering I chanced upon a tool called Mockaroo. Mockaroo is an excellent tool for generating realistic test data. I found it really helpful and it fit my needs very well. This post is about how I could use different features of Mockaroo which I felt would be very helpful for anyone testing data intensive applications.

Data Requirements

Our requirement was a bit more complex than just using random names or address. We had fields like Longitude, Latitude, Address, Area calculation mode, Radius, Travel mode, Travel type. Longitude and Latitude attributes are based on the location details. The Address field is a combination of Street, Province, and Postal Code. Area calculation mode has two dependent parameters ‘radius' and ‘travel-time'. If area calculation mode is ‘radius' then we had to set the ‘radius' parameter to be a radius in miles. If the area calculation mode was set to ‘travel-time', we had to set ‘travel mode' to one of 'Bike', 'Walk', or 'Drive' and then we had to set the value of ‘travel-time' to a number of minutes around the location. The fields ‘travel mode' and ‘radius' correspond with the field ‘area calculation mode'. As you can guess, a lot of manual effort was needed for populating this kind of test data.

Using Mockaroo to generate the data

Mockaroo is a brilliant online tool that lets you solve the data generation problems in a few clicks. It provides a GUI to build some data that suits your needs and lets you generate up to 1,000 rows of realistic test data in CSV, JSON, SQL, and Excel formats. It generates data from a saved schema which can be helpful for automated testing.

The tool has columns for data field names, their data types and blank options which you can alter to adjust the data order and specifications. 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. The column named ‘Field Name' accepts simple text input, ‘Type' accepts data type and ‘Options' accepts numerical input. You can add more fields by clicking on the 'Add another field' button.

Minecraft auto clicker. Mockaroo supports around 74 different types, each of these data type provides a range of appropriate sample data that is used to populate the field. You can view the list of 74 types on the API docs page as shown below. You can also customize the data types according to your data needs.

Different operations using Mockaroo Data Types

Mockaroo has a lot of useful features. In this section, I'll talk about the ones I found most useful features like Formulas, Functions, Custom List which we have applied for data transformations specific for our requirement. Here is link to location_details Schema which we created for our data creation (See Mockaroo- Location_details Schema image)

Longitude and Latitude Data types

Generating realistic data for Longitude and Latitude fields in our data set was a time-consuming process. Mockaroo made it simple. Mockaroo supports a data type called Longitude and Latitude which allows us to generate data for longitude and latitude values for the given location details. This helped us to create this data quickly and made our job simple.

Custom List

Custom List is another data type which is appropriate for populating default values in the fields. It picks items randomly or sequentially from a custom list of values specified. For our requirement, we choose Custom List values for the field ‘Area calculation mode' to generate random data values ‘radius' or ‘travel-mode' for each row.

Formula

Mockaroo

Formula https://binsmafunkgert1975.mystrikingly.com/blog/grid-connected-pv-systems-design-and-installation-7th-edition-pdf. is a powerful feature of Mockaroo to generate any kind of data we want. You can use formulas to create your own data types in Mockaroo. It helps to reference existing fields and generate data based on the custom code. Using formulas you can do things like writing different functions for date diff, concatenate strings, mathematical calculations, conditional logic etc…, Any kind of data transformation is made simple using these formulas.

Concat Function

The Address field in our requirement is a combination of Street, Province, and Postal code. We used concat function to concatenate all these strings. The Mockaroo API doc has all the syntax for different functions. Please see the above image for the concat function. Similarly, you can use different logical operators, functions, Regular Expressions to do data transformations.

Conditional IF Statements

If you want a value based of some incoming value from another field you can utilize conditional IF statements. In our case, for the field radius, we want to generate some values from 1 to 20 based on another field called Area calculation mode. So we could achieve this by using IF conditional statements(See below image for formula).

If you notice in the location_details schema, you'll also see that there are a couple of extra variables which we don't need in our dataset. These variables are commonly found when you create data using formulas. Mockaroo allows us to hide the fields which we don't need in our desired data set. You can just type ‘__'(two underscore) characters in front of the field you want to hide, it will be automatically hidden. This is useful when creating intermediate fields for use in formulas and templates. For example, in our case the fields like ‘___address_type','__state_type','__province', ‘__postal_code' were created to refer in the concat function to generate data for Address field.

Apart from these feature Mockaroo provides with some additional features which are useful like

  • Specify number of rows to be generated.
  • The ‘Download Data' button to download the data.
  • You can preview what data will be downloaded by clicking on the 'Preview' button.
  • You can save the setting to your profile through the 'Clone This Schema' button
  • Import fields from csv or sql

Once you are done with the field manipulations, you can save this schema and once you save this schema you'll be given a Share Link to the schema.

Mockaroo Rest API

Mockaroo provides a REST API, which lets you download randomly generated data into your projects in real-time with unlimited calls. Using REST API you can easily integrate into test automation workflow for repeatable test data generation. 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 contains a single method:

How To Make Macarons Recipe

This method will return CSV or JSON formats depending on the file type part of the URL. You can find more details on Mockaroo REST API here

I found Mockaroo is a really great, free product and is perfect if you need to generate test data quickly.

If you are a startup finding it hard to hire technical QA engineers, learn more about Qxf2 Services.

Mockaroon Coupon

References

1. Creating Test Data with Mockaroo

2. How to generate random, realistic & reliable data for your application?

3. Generate Test Data Quickly In Two Easy Steps

Mockaroon

Related posts:

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.

(Blame Chris Huntingford for the name)

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.

Wattagio 1 4 7 download free. 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. Hot wheel games for free. 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).

Mockaroo

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. 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.

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.





broken image