Hướng dẫn cài đăt postman setup wordpress gmail

Khi mà gần như mọi tester đều có thể dùng những chức năng cơ bản của postman, bạn cần phải nâng cấp skills, dùng được những chức năng khác để làm test được dễ hơn, nhanh hơn. Dưới đây là những thứ mà bạn nên biết:

Update: The Postman SMTP Plugin has been replaced by the newer Post SMTP Mailer/Email Log. Check out our article on how to setup your site with this newer, more secure email plugin for WordPress.

So you have a WordPress website and the site isn’t sending emails. One of the best plugins to help you do this is the Postman SMTP plugin for WordPress.

This highly popular plugin allows you to send emails from your website using Gmail, SMTP an a host of other email server protocols.

This article will help you setup the Gmail API option.

To setup your WordPress site to send emails using the Gmail API:

Step 1: Install the Postman SMTP Plugin

  1. Jump to Plugins in the back of your WordPress website.
  2. Click the “Add New” link at the top of the page.
  3. In the “Search Plugins” field in the top right, enter “Postman SMTP”.
  4. In the search results, you will see “Postman SMTP Mailer/Email Log”. Click the [Install Now] button.
  5. Click the [Activate] button after it has installed.

Step 2: Tell Postman SMTP to use the Gmail API

  1. Scroll to Settings > Postman SMTP.
  2. Click the “Show All Settings” link.
  3. In the “Type” setting, select “Gmail API”.

Step 3: Create API Settings

This part of the process is long BUT stay with it. Follow the bouncing ball and you’ll be fine.

  1. Ensure you have a Google account. If you don’t have one yet, you can set one up here – Setup a new Google Account.
  2. Login to your Google account.
  3. Jump to https://console.developers.google.com/start/api?id=gmail.
  4. Make sure that the “Create a project” is selected.
    Hướng dẫn cài đăt postman setup wordpress gmail
  5. Click the [Continue] button.
  6. Under the heading “Find out what kind of credentials you need”, click the “API Key” link.
  7. Give the Key a name, e.g. WordPress Email key.
    Hướng dẫn cài đăt postman setup wordpress gmail
  8. Click the [Create] button.
  9. A screen will show stating “API key created”.
  10. Click the [Close] link.
  11. In the “Credentials” tab, click the [Create Credentials] drop down.
  12. Select OAuth client ID.
    Hướng dẫn cài đăt postman setup wordpress gmail
  13. In the “Credentials” screen, select the “Web application” option.
  14. Enter a name for the “Name” setting, e.g. Website Emails.
    Hướng dẫn cài đăt postman setup wordpress gmail
  15. Copy the “Authorized JavaScript origins” and “Authorized redirect URIs” settings from the Postman SMTP screen.
    Hướng dẫn cài đăt postman setup wordpress gmail
  16. Copy these back into the Gmail API screen. NOTE, when you copy and paste a setting a new field shows below the field that you just pasted into. Ignore this new field.
    Hướng dẫn cài đăt postman setup wordpress gmail
  17. Click the [Create] button.
  18. A screen will show with the Client ID and Client Secret. These are the settings that you copy and paste back into the Postman SMTP settings.
    Hướng dẫn cài đăt postman setup wordpress gmail
  19. Copy the Client ID and Client Secret from this screen back into the Postman SMTP settings.
    Hướng dẫn cài đăt postman setup wordpress gmail
  20. Click [Save Settings].

Now that you have the ID’s in your WordPress website, you will need to grant permission to Google to allow Postman SMTP to talk to it.

Newman là 1 tool của Postman, chuyên dùng run collection bằng command-line (cli). Nó sẽ phù hợp cho các trường hợp mà sử dụng các CI tools như Jenkins, TeamCity, hay TravisCI…

Chốt lại: Newman giúp run collection mà không cần phải mở chức năng Runner ở postman. Newman có 2 cách sử dụng chính:

  • Sử dụng dòng lệnh
  • Sử dụng như 1 thư viện của Nodejs (sẽ nói ở bài số 23)

II. Cách cài đặt

1.Cài đặt Nodejs

Download: https://nodejs.org/en/

Hướng dẫn cài đăt postman setup wordpress gmail

  • Setup như các phần mềm khác
  • Verify
    Hướng dẫn cài đăt postman setup wordpress gmail

2. Cài đặt Newman

npm install -g newman

Hướng dẫn cài đăt postman setup wordpress gmail

III. Sử dụng

Để chạy được các lệnh của newman, thì bạn phải export postman collection trước.

Hướng dẫn cài đăt postman setup wordpress gmail

newman run examples/sample-collection.json

Hướng dẫn cài đăt postman setup wordpress gmail

Ngoài ra để run thêm các thứ khác, ví dụ:

-e <source>, --environment <source> //E.g: -e .\postman-script.postman_environment.json

Run kèm Environment (đã được export từ postman)

-n <number>, --iteration-count <number> // E.g: -n 5

Số lần lặp lại khi run collection

Full-list option sẽ nằm

Ngoài ra, nếu bạn muốn có 1 cái report đẹp đẽ bằng HTML, thì nên sử dụng newman-reporter-htmlextra

npm install -g newman-reporter-htmlextra

Hướng dẫn cài đăt postman setup wordpress gmail

HTML report sẽ được tạo ra ở folder ./newman

IV. Tổng kết

Newman là 1 cách để bạn run test khá nhanh và phù hợp cho việc sử dụng trong CI/CD pipeline. Biết cách sử dụng linh hoạt newman sẽ làm cho bạn càng ngày càng “có vẻ” pro hơn, dễ “làm màu” hơn trong mắt người khác. Hi vọng nó giúp ích gì đó cho bạn.