Data handling

Handling and binding data

To increase re-use of automated tests, it’s key to be able to separate dynamic data from static, non-changing code. It’s easy to understand why. Let’s say you have a test case that fills out a web form. Without separation of data, you would need to record one test for each set of data that needs to be tested.

Boozang supports a wide-variety of data-types

  • Properties: For name-value pairs
  • CSV data: To loop over data sets
  • Matrix data: For accessing a data set by key
  • Object: One-level JSON data – perfect for forms
  • Array data: A list of string or numbers
  • File: Used for file upload tests
  • External data: Used to fetch data from external sources
  • JavaScript: Javascript to generate data using Javascript

The data is available to be stored on four different levels, or “scopes”  in the Boozang tool

  • Project level:This scope is used for common data shared across modules
  • Module level:This scope is used for data shared across different tests in a module
  • Test level:This scope is used for local test data and temp data
  • Parameter level:  This scope is temporary data, that should be set when invoking a test

Data binding is a very powerful way to use data to record filling of forms. When a user is recording a form fill and “Bind data” is enabled, Boozang will look for matching data in the specified scope. For instance, when finding data key “first_name”, this will be suggested to be filled in the “First Name” field.

It’s also possible to do the opposite. When recording a form fill, simply type the data into the form and click on the suggested key, and the data will be saved as JSON in the Boozang tool data tab. This allows users to create data-driven tests directly when recording, greatly adding to the re-usability of the test.

Lean more about data binding in our documentation:

Automated data generation

In order to further speed up the creation of tests that fill out forms, Boozang can automatically generate this data. Boozang identifies the field label can automatically fill the input with data corresponding to the value of the field. There are a number of data types pre-defined, but you can also add your own custom data.

In Settings -> Content Policy you can find the predefined data attributes, and add your own custom ones as well. Each data attribute has the following fields

  • Field mapping: Specify keywords that should match the form label
  • Regex: Specify the pattern that the generated data must match
  • Example: Shows an example of the data generated

As an example, to emulate all the versions of a US zip code, you can add the following regexp “^\d{5}(?:[-\s]\d{4})?$” and for instance map it to the Field mapping “zip”. Now when auto-generating data, any forms that has the corresponding label will be auto-populated with data that complies to the regex.

Create your account for free!

No credit card required.