Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
227 views
in Technique[技术] by (71.8m points)

How to connect to PostgreSQL from postman script for automated api test

I am trying to find a way to connect DB from postman and how it can be done?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

you cannot connect postman to an external api :

Postman allows only the below list of nodejs libraries in the test script and pre request section:

https://learning.postman.com/docs/writing-scripts/script-references/postman-sandbox-api-reference/#using-external-libraries

you can use native js libraries if it has a cdn equalent please see the discussion here:

https://community.postman.com/t/adding-external-libraries-to-postman/1971/8

So to answer your question , the best way will be to write a nodejs program to conect to postgresSQL and expose it by wrapping it with express API . SO that postman can access the result.

ALso see if the below example collection helps:

https://documenter.getpostman.com/view/5922408/RznJmGfn#ed6af38c-dd01-4a9c-9e40-d1071276d6a0


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...