Do you think IIT Guwahati certified course can help you in your career?
No
Introduction
Hello ninjas. I hope you are well. This blog will help you understand the MySQL Databases as Data Sources in Ready API.
MySQL is a relational database management system. Instead of placing all the data in one massive warehouse, a relational database keeps the data in individual tables. The physical files used to organize the database structure are designed for speed.
Now let's get into the topic MySQL Databases as Data Sources in Ready API.
MySQL Databases as Data Sources in Ready API
Going through numerous data sets is one of the most time-consuming activities while testing a web service's operation. You can utilize the Data Source test steps in ReadyAPI to connect to a data source and supply data to a web service, which can help you resolve this problem.
This blog covers how to use a MySQL server as a data source.
The virtual service and a MySQL server with the default MySQL sample database will be used in this article.
Install a MySQL Server
A MySQL server is required to access MySQL's data.
To set up a MySQL server, follow these instructions:
Step 1: From the MySQL website, download the MySQL installer:
Step 2: Run it after installing it on your machine.
Step 3: To install MySQL Server, click ‘Add’ in the main window and follow the installation wizard's instructions.
Step 4: The MySQL installer will prompt you to configure the server after the installation is finished. You have the option to alter the default settings or that.
Install a Sample MySQL Database
You will need to use some test data in this course.
Install a test MySQL database by performing the following:
Activate the MySQL installer.
Click Add in the main window.
Choose Product and Features on the wizard's first page.
In the Available Products section, choose Documentation > Samples & Examples.
Toggle the right arrow icon.
After selecting Next, follow the installation wizard's instructions.
After the installation is complete, you will be prompted to configure the example database by MySQL Installer. The default settings can be left in place.
You can now set up a JDBC driver.
Install a JDBC Driver
Installing a JDBC driver is necessary to enable ReadyAPI to access MySQL data.
We are putting in a JDBC driver.
Step 1: From the official website, get the ZIP archive:
Step 2: The JAR library should be extracted from the archive and placed in the bin/ext directory of your ReadyAPI installation.
Now that we are done with the preparation let's move to the implementation part.
Import the Virtual API
You must import and execute a virtual API for this tutorial to send queries to it.
1.Download the virtual API's packed ReadyAPI project at the Virtual API initiative
2. Choose the downloaded project in the window that appears by choosing File -> Import Packed Project.
3. Indicate the location where the project will be saved and unzipped.
4. (Optional) The project's virtual API typically operates on port 8092 by default. Change the virtual API port if this port is already in use on your computer.
5. Modifying the virtual API port. Click to launch the virtual API after selecting it in the Navigator.
When the API gets queries with an email in the query string, it returns results based on the value of the email. You will develop a test step that will send questions to the hypothetical API in the following tutorial step.
Establish a Test Case
Create a test case after the preparations are complete.
Step 1
To create a new functional test, choose File > New Functional Test.
Choose whether you want to add the URL you have added to an existing project or create a new one on the wizard's following page.
For the next step click next.
Step 6
You can modify new requests by adding assertions on the wizard's subsequent page. The proposed assertions will not be used in this tutorial, so deselect them and click Next.
Access the MySQL Database for Data
You may now create the Data Source test step because you have a project and a test case.
Establish a Data Source
Click the Generate Values button in the request editor.
Select the request parameters configured automatically in the Create Data-Driven Loop dialogue.
In the Data Source test stage, ReadyAPI will automatically add a property expansion that refers to the email property and a data source loop.
Launch the test phase for the data source. As you can see, ReadyAPI has set the data source to automatically produce random email addresses as values for the email attribute.
Establish a JDBC Connection
1. Choose the JDBC data source type in the data source editor.
2. Click Configure to set the connection string.
3. Pick the MySQL JDBC driver in the Database Configuration dialogue.
4. In the Change Connection Properties dialogue, select Yes.
5. The wizard to build a SQL query will now show up.
Check the email column in the list of table columns after selecting the customer table from the list of tables.
Enter the email, and the name of the property from the data source test step, in the Alias column.
6. To include your new query in the data source configuration, click OK.
7. You must establish a cap on how much data you will be able to retrieve from the database for this tutorial.
In the data source toolbar at the top, select setting.
8. Change End Row to 5 on the Settings tab.
9. Press "OK."
You can now complete your test.
Start the Test
You have finished all preparations and are ready to take the test.
Click on the test case toolbar to perform the test.
You may view the details in the transaction log while the test case is running.
Click Transaction Log on the test case toolbar to access it.
The run details will then be visible to you.
Add Assertion
1. Go to the REST Request page and select Smart Assertion:
2. ReadyAPI will automatically configure which values are required for specific data fields and produce an assertion based on the most recent response:
3. You can set comparison operators and anticipated values or uncheck boxes to exclude specific fields from the assertion. When finished, click Save.
The Smart Assertion has been added to your test request. It will check whether the response data corresponds to the predicted values. The additional assertion can be found in the Assertions panel.
"ReadyAPI" is one of the products of "SmartBear". It is an easy-to-use no-code API testing platform designed to streamline the testing workflows.
Is "ReadyAPI" open source?
"ReadyAPI" includes third-party open-source software modules subject to their respective licenses.
What is "SmartBear"?
"SmartBear" software is an American privately-held IT company that delivers tools for APM(application performance monitoring), software development and testing, API testing, and management.
What does API stand for?
API stands for Application Programming Interface.
What is the use of API?
API is a software intermediary that allows two different applications to communicate.
Conclusion
In this blog, we studied the details of MySQL Databases as Data Sources in Ready API. Basically, it is a tutorial for installing a MySQL database, JDBC drivers, etc.
To know about more articles like MySQL Databases as Data Sources in Ready API, check out the following: