API automation is the most important and very frequently done task in the industry. Postman is the tool that most companies are using for manual testing of the APIs. Because of the simplicity, can arrange and do well-organized and collaborative work within the same workspace.
Here I'm explaining one of the big problems I faced and how I got solutions through Postman the best feature of the scripting facility and the collection run tool of Newman. I resolved my problem very clearly more than my lead expected from me and through the Postman scripting.
There consists of a major monitoring platform including
Prometheus and Grafana tools used to visualize the whole product and the
deployment platform health checks. The content of deployments was on the Kubernetes
environment where the Prometheus and
Grafana were deployed as itβs pods. There were more than 30 Dashboards on the
Grafana and it was a time-consuming task to check the dashboard with the
release timeline manually. So the task was to automate the data propagation to
the Grafana through the Prometheus. Then, as a solution for the automation used
the Postman Scripting.
I used the Prometheus API tool kit and promQL to get the data
published to Grafana dashboards. PromQL refers to the query language that is
used by Grafana to get the relevant data from Prometheus. I have attached a response I have below.
There are the most commonly used assertions and codes provided by Postman. So it's very easy and funny to start the scripting itself. If you going to automate a huge response you must have some sort of javascript skill to manage it. You can manage and run API requests folder-wise or collection-wise. But there exists a limitation when executing as a collection-wise run. The Newman was used to overcome the above-mentioned limitation.
jsoncrack is the tool that I used for capturing the correct parameter and the value from the huge response.Then I used the Newman tool to run my completed API automation collection.
Installing Newman:
1. Install nodejs package
2. Install Newman
npm install newman
Postman collection run command:
newman run [collection-name].postman_collection.json -e [environment].postman_environment.json
If you need to run with ignoring or disabling SSL:
newman run Grafana-Promethus-Automation.postman_collection.json -e Prometheus-Env.postman_environment.json --insecure
The followings are the result I got once I ran the Postman collection by Newman.
I have used the tool nodejs htmlextra report below to illustrate the results of the execution of the automation framework.
No comments:
Post a Comment