Establishing a MongoDB connection with HCL OneTest Data

You must establish a connection between HCL OneTest Data and MongoDB to associate a schema with the database.

Before you begin

You must have completed the following tasks:
  • Created or imported a schema in the HCL OneTest Data project.
  • Installed MongoDB on your computer and the MongoDB instance must be ready to connect. For more information, refer to Install MongoDB.
  • Created a database in MongoDB. For more information, refer to Database Methods.

Procedure

  1. Select your project in HCL OneTest Server and go to the Data Fabrication page.
  2. Click Connections.
  3. Click New to create a new connection.

    The New Connection dialog box is displayed.

  4. Select MongoDB as a connection type and click Next.
  5. Enter the following properties of the connection in the Properties dialog box:
    1. Enter the host name of MongoDB in the Host field.
    2. Enter the server port number of the computer where MongoDB is running in the Port field.
    3. Enter the user name and password to access MongoDB.
  6. Click Test to verify whether the connection is established successfully.
    Note: If the connection fails to establish, it can be because of any one of the following reasons:
    • Unreachable database.
    • Missing database.
    • Incorrect host name and port number.
  7. Click Fetch to upload all the databases available in the configured MongoDB in the Database drop-down list, and then select the database that you want to use to write the generated test data.
  8. Click Next, and then provide a name to the established MongoDB connection.
  9. Click OK.

    You can see the name of the MongoDB connection under the Connections tab.

Results

You have successfully established the connection between HCL OneTest Data and MongoDB.

What to do next

You must associate a schema with a database of MongoDB. See Associating a schema with MongoDB.