ํฌ์ŠคํŠธ๋งจ์—์„œ ๋žœ๋ค ๋ณ€์ˆ˜ ์‚ฌ์šฉํ•˜๊ธฐ (dynamic variables)

ํฌ์ŠคํŠธ๋งจ์œผ๋กœ API ํ…Œ์ŠคํŠธ๋ฅผ ํ•˜๋‹ค๋ณด๋ฉด, ๋žœ๋ค ๋ณ€์ˆ˜๊ฐ€ ํ•„์š”ํ•  ๋•Œ๊ฐ€ ์žˆ๋‹ค. (timestamp, uuid, ์ด๋ฆ„, ์ „ํ™”๋ฒˆํ˜ธ, ์ด๋ฉ”์ผ ๋“ฑ)
์“ธ๋•Œ๋งˆ๋‹ค ๊นœ๋นกํ•ด์„œ ๋งค๋ฒˆ ๊ตฌ๊ธ€์—์„œ ๊ณต์‹ ๋ฌธ์„œ๋ฅผ ์ฐพ์•„์„œ ๋“ค์–ด๊ฐ€๋Š” ๊ฒƒ์ด ๊ท€์ฐฎ์•„์„œ, ์ž์ฃผ ์‚ฌ์šฉํ•˜๋Š” ๋ณ€์ˆ˜๋Š” ๋”ฐ๋กœ ์ •๋ฆฌํ•ด๋ณธ๋‹ค.

์ž์ฃผ ์‚ฌ์šฉํ•˜๋Š” ๋ณ€์ˆ˜

API ํ…Œ์ŠคํŠธํ• ๋•Œ ์ฃผ๋กœ ์‚ฌ์šฉํ•˜๋Š” ๋ณ€์ˆ˜๋“ค์„ ๋ชจ์•„๋ณด์•˜๋‹ค.

๋ณ€์ˆ˜์„ค๋ช…์˜ˆ์‹œ
{{$guid}}UUID ๋ฒ„์ „ 4611c2e81-2ccb-42d8-9ddc-2d0bfa65c1b4
{{$timestamp}}UNIX ํƒ€์ž„์Šคํƒฌํ”„1562757107
{{$isoTimestamp}}ISO ์‹œ๊ฐ„ํ˜•์‹2020-06-09T21:10:36.177Z
{{$randomIP}}IPv4 ์ฃผ์†Œ216.7.27.38
{{$randomUserAgent}}User AgentMozilla/5.0 (Macintoshโ€ฆ
{{$randomFirstName}}์ด๋ฆ„Ethan
{{$randomLastName}}์„ฑWillms
{{$randomFullName}}์ด๋ฆ„ (์ „์ฒด)Connie Runolfsdottir
{{$randomPhoneNumber}}10์ž๋ฆฌ ์ „ํ™”๋ฒˆํ˜ธ700-008-5275
{{$randomPhoneNumberExt}}12์ž๋ฆฌ ์ „ํ™”๋ฒˆํ˜ธ27-199-983-3864
{{$randomExampleEmail}}์ด๋ฉ”์ผ ์ฃผ์†ŒTalon28@example.com

Pre-request / Tests ์Šคํฌ๋ฆฝํŠธ์—์„œ ์‚ฌ์šฉํ•˜๊ธฐ

pm.variables.replaceIn() ๋ฅผ ํ™œ์šฉํ•˜๋ฉด ์Šคํฌ๋ฆฝํŠธ์—์„œ ์‚ฌ์šฉ์ด ๊ฐ€๋Šฅํ•˜๋‹ค.

// dynamic variable ์‚ฌ์šฉ ์˜ˆ์‹œ
var email = pm.variables.replaceIn('{{$randomExampleEmail}}');
console.log(email);

์ฐธ๊ณ  ๋ฌธ์„œ

  • Dynamic variables ๊ณต์‹ ๋ฌธ์„œ: Dynamic variables
  • Dynamic variables์—์„œ ์‚ฌ์šฉํ•˜๋Š” ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ: faker.js

๋‹ต๊ธ€ ๋‚จ๊ธฐ๊ธฐ

์ด๋ฉ”์ผ ์ฃผ์†Œ๋Š” ๊ณต๊ฐœ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ํ•„์ˆ˜ ํ•ญ๋ชฉ์€ *(์œผ)๋กœ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค