Documentation >> Getting Started


Data Dictionary

AutoTest Studio has a powerful data dictionary and uses Sqlite as the data storage engine, so it can provide good read performance.

AutoTest Studio's data dictionary organizes the data hierarchy in a directory structure, which makes the data dictionary organization more readable.

In the data dictionary, there are two concepts, Dataset and Dataitem.

Dataset

Dataset is a collection of the same type of data. Dataset is globally unique. In the same data dictionary, the name of the dataset cannot be repeated, even in different directories.

Dataitem

A data record under the dataset, is stored in key-value mode.

In practical applications, a user can be used as a Dataset, and the user's information, such as name, age, gender, etc., can be used as Dataitem.

After creating a project, AutoTest Studio will create an empty data dictionary and place it in the same directory as the project.

The data dictionary module provides two operation interfaces.

  • Read the entire dataset and return a Json format data.

GetDataset(dataset)

  • Read the value corresponding to the key in the dataset.

GetDataValue(dataset, key)

Working Mode

AutoTest Studio provides two working modes when the task is running, file mode and memory mode.

  • File Mode

The data is stored in the file, which consumes less memory, but the reading speed is slower, which is suitable for reading a small amount of data dictionary.

  • Memory Mode

Data is stored in memory, which consumes more memory, but the reading speed is faster, which is suitable for frequent reading of the data dictionary.

Create Dataset

Right-click on the directory and select "New"->"Dataset" from the pop-up menu

Fill in the name of the dataset and click "Commit".

Create Dataitem

Select the dataset, double-click and navigate to the Dataset.

Click "New" on the right toolbar.

In the pop-up dialog box, enter the data and click "Submit".

Read Data

Create a new test case and write the following code:

from autotest import *

#read Dataset

userInfo=GetDataset("Tom")

print("Tom'data:\n{0}".format(userInfo))

#read Dataitem

name=GetDataValue("Tom","name")

age=GetDataValue("Tom","Age")

gender=GetDataValue("Tom","Gender")

email=GetDataValue("Tom","Email")

print("Name:{0}\nAge:{1}\nGender:{2}\nEmail:{3}".format(name,age,gender,email))

Running result: