Article
· Jun 29, 2023 3m read

IRIS Api Tester

Hello Community!!

I just upload my lastest application "IRIS Api Tester" to the Open Exchange. 

It's a docker project with InterSystems IRIS + Newman that will allow you to test your Postman Collections in a quick and easy way..

It's ready to work out of the box, you just have to clone the repo: https://github.com/daniel-aguilar-garcia/irisapitester

Run the docker-compose file:

 

Open this url in your browser: 

http://localhost:52773/csp/user/index.html

 

Add some test to your Postman collection:

In this example I have added a global test for all the entries of the collection by adding a test in the Test section of the collection but individual test can be added for each item.

In my case I'm testing that the status code of the request is equal to 200, in case that the status code is different to 200 it will appear as an error in the report.

 

After adding your test export your collection in json format:

 

 

Then drag the json file to the IRIS Api Tester's home page and press the "Run Test" button:

 

 

After a few seconds you will be redirected to the report page:

 

Where you can move through the report and examine all the test in detail.

 

If you prefer launch the test without user interface you can use this request:

POST request to execute test:

localhost:52773/run_tests

Body example:

{
 

"collection" : {
	"info": {
		"_postman_id": "79cfb5de-a2ab-4548-aa54-4a1712bf67a4",
		"name": "TestNewman",
		"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
		"_exporter_id": "838575"
	},
	"item": [
		{
			"name": "test_ok",
			"event": [
				{
					"listen": "test",
					"script": {
						"exec": [
							""
						],
						"type": "text/javascript"
					}
				}
			],
			"request": {
				"method": "GET",
				"header": [],
				"url": {
					"raw": "localhost:52773/test_ok",
					"host": [
						"localhost"
					],
					"port": "52773",
					"path": [
						"test_ok"
					]
				}
			},
			"response": []
		},
		{
			"name": "test_ko",
			"request": {
				"method": "GET",
				"header": [],
				"url": {
					"raw": "localhost:52773/test_ko",
					"host": [
						"localhost"
					],
					"port": "52773",
					"path": [
						"test_ko"
					]
				}
			},
			"response": []
		}
	],
	"event": [
		{
			"listen": "prerequest",
			"script": {
				"type": "text/javascript",
				"exec": [
					""
				]
			}
		},
		{
			"listen": "test",
			"script": {
				"type": "text/javascript",
				"exec": [
					"pm.test(\"Verificar código de cabecera\", function () {",
					"    pm.response.to.not.have.status(500);",
					"});"
				]
			}
		}
	]
}
}

 

Then get the html report:

GET request to get the HTML report:

localhost:52773/show_report

 

If you need it, I have left a json file of an exported example collection so that you can try it yourselves.

 

I hope this app could be useful for you.

 

Thanks for reading!!

 

Here is it a video demo ;-)

https://www.youtube.com/embed/6JJJ0a6dSmY
[This is an embedded link, but you cannot view embedded content directly on the site because you have declined the cookies necessary to access it. To view embedded content, you would need to accept all cookies in your Cookies Settings]

Discussion (1)1
Log in or sign up to continue

Hi Daniel,

Your video is available on InterSystems Developers YouTube:

⏯️IRISApiTesting InterSystems IRIS + Newman

https://www.youtube.com/embed/KM2yd_uoJuc
[This is an embedded link, but you cannot view embedded content directly on the site because you have declined the cookies necessary to access it. To view embedded content, you would need to accept all cookies in your Cookies Settings]

Please enjoy!