0
0
Postmantesting~10 mins

Running a collection in Postman - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to run a Postman collection using Newman.

Postman
newman.run({ collection: require('[1]') }, function (err) { if (err) { throw err; } console.log('Collection run complete!'); });
Drag options to blanks, or click blank then click option'
A'./mycollection.json'
B'./collection'
C'collection.json'
D'mycollection'
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting the file extension .json
Using just the collection name without path
Using a directory path instead of a file
2fill in blank
medium

Complete the code to specify an environment file when running a collection with Newman.

Postman
newman.run({ collection: require('./mycollection.json'), environment: require('[1]') }, function (err) { if (err) { throw err; } console.log('Run complete with environment!'); });
Drag options to blanks, or click blank then click option'
A'./env'
B'env.json'
C'environment.json'
D'./environment.json'
Attempts:
3 left
💡 Hint
Common Mistakes
Missing './' at the start of the path
Omitting the .json extension
Using a wrong filename
3fill in blank
hard

Fix the error in the code to run a collection with a timeout option.

Postman
newman.run({ collection: require('./mycollection.json'), timeout: [1] }, function (err) { if (err) { throw err; } console.log('Run complete with timeout!'); });
Drag options to blanks, or click blank then click option'
A5000
B'5000'
C'5s'
D5
Attempts:
3 left
💡 Hint
Common Mistakes
Putting the number in quotes making it a string
Using a string like '5s' which is invalid
Using a small number like 5 which is 5 milliseconds
4fill in blank
hard

Fill both blanks to run a collection and export the run summary to a file.

Postman
newman.run({ collection: require('[1]') }, function (err, summary) { if (err) { throw err; } require('fs').writeFileSync('[2]', JSON.stringify(summary)); console.log('Summary saved!'); });
Drag options to blanks, or click blank then click option'
A'./mycollection.json'
B'summary.json'
C'./summary.json'
D'summary.txt'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a filename without './' for collection
Saving summary as .txt instead of .json
Using inconsistent paths
5fill in blank
hard

Fill all three blanks to run a collection with environment and iteration count options.

Postman
newman.run({ collection: require('[1]'), environment: require('[2]'), iterationCount: [3] }, function (err) { if (err) { throw err; } console.log('Run complete with iterations!'); });
Drag options to blanks, or click blank then click option'
A'./collection.json'
B'./env.json'
C3
D'env.json'
Attempts:
3 left
💡 Hint
Common Mistakes
Using environment path without './'
Putting iteration count in quotes
Using wrong filenames