Skip to main content

Command Palette

Search for a command to run...

Testing with Postman: Moment

Published
1 min read
Testing with Postman: Moment
B
I build automation frameworks — not just tests. Over 10 years I've designed and shipped production testing platforms across payment, insurance, and healthcare domains. My instinct is always toward architecture: clean abstractions, maintainable patterns, and systems that don't fall apart when the product scales. What I'm working on now: - A Claude/Playwright agent framework that generates test cases directly from Jira tickets - Concurrency and race-condition coverage for financial transactions - A modular Playwright/JavaScript platform covering UI and 20+ API service integrations with 100+ JSON schema validators I've built production automation in Playwright, Geb/Spock, Rest-Assured, and Selenium across payment, insurance, and healthcare domains. When a stack isn't working, I replace it. When a pattern is wrong, I fix it. If the automation problem is interesting, I'm probably already thinking about it.

Postman has many built in Javascript libraries. Moment is one of the more useful ones for getting dates such as today's date or tomorrow's.

Creating a Date with Moment

Moment is another tool build into postman that can be used for your test. This is great for creating a rolling future, current or past date. You can add and subtract time be it minutes, hours, days, months, or years. You can also change the format to match what you need.

var moment = require('moment');

var date = moment().add(10, 'days').format('MM/DD/YYYY');
var date2 = moment().add(1, 'month').format('MM/DD/YYYY');
pm.environment.set("date", date);

Links

Postman Quick Reference Guide Chai Assertion Library Regex Cheat Sheet Postman: The Complete Guide on Udemy

More from this blog

B

Ben Weese - Senior QA Engineer

13 posts

As the son of a programmer I grew up on computers and have always loved them. Now I work as a Software Development Engineer in Test to write code and test things. I also enjoy my homelab hobby.