Associating a schema with MongoDB
After you establish the connection between HCL OneTest™ Data and MongoDB, you must associate a schema with a database of MongoDB. You must select the schema that you want to use to generate the test data.
Before you begin
You must have created a collection in the selected MongoDB database.
For more information, refer to db.createCollection() section of Database Methods.
About this task
You can associate any schema with the MongoDB database that can generate the test data in the JSON format.
The following schema formats support the output format in JSON:
- Excel
- JDBC
- XSD
- CSV
Procedure
- Select your project in HCL OneTest™ Server and go to the Data Fabrication page.
- Click the Connections tab and select the MongoDB connection name that you created.
- Click the menu and select New Action.
- Select Target as the Action Type in the New Action dialog box, and then click Next.
-
Click Fetch to extract a list of all the collections of
the selected database, and then select a collection from the
Collection drop-down list.
Note:
You can retain the default property settings for all other boxes.
- Click Next to provide the schema details.
- Click the Schema drop-down list to select the schema that you want to use to generate the test data.
- Click the Schema Type drop-down list to select the group type for which you want to generate the test data, and then click Next.
-
Provide the identification details of the new action, and then click
OK.
The new action is created and listed under the MongoDB connection.
Results
You have successfully associated the schema with the database.
What to do next
You can generate the test data from the schema that you associated with the database of MongoDB. The generated test data is directly inserted into the database. See Inserting the generated test data in a database.