0
0
Postmantesting~10 mins

Generating documentation from collections 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 export a Postman collection as JSON.

Postman
JSON.[1](pm.collection.toJSON())
Drag options to blanks, or click blank then click option'
Asave
Bstringify
Cexport
Dparse
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'save' instead of 'stringify' causes errors because 'save' is not a JSON method.
Using 'parse' tries to convert a string to an object, which is the opposite of what we want.
2fill in blank
medium

Complete the code to generate documentation for a Postman collection.

Postman
pm.collection.generateDocumentation([1])
Drag options to blanks, or click blank then click option'
Afalse
Bnull
Ctrue
D{}
Attempts:
3 left
💡 Hint
Common Mistakes
Passing 'true' or 'false' causes type errors because the method expects an object.
Passing 'null' results in no documentation generated.
3fill in blank
hard

Fix the error in the code to correctly export collection documentation as HTML.

Postman
const doc = pm.collection.generateDocumentation({ format: 'html' });
pm.environment.set('docHTML', [1]);
Drag options to blanks, or click blank then click option'
Adoc.toString()
BdocHTML
Cdoc
Ddoc.html
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'docHTML' causes a reference error because it is undefined.
Using 'doc.toString()' is unnecessary since 'doc' is already a string.
4fill in blank
hard

Fill both blanks to create a script that saves collection documentation to a file.

Postman
const fs = require('[1]');
fs.writeFileSync('collection-doc.html', [2]);
Drag options to blanks, or click blank then click option'
Afs
Bfs-extra
Cdoc
Ddocumentation
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'fs-extra' requires an extra package and is not standard.
Using 'documentation' instead of 'doc' causes a reference error.
5fill in blank
hard

Fill all three blanks to generate Markdown documentation and save it to a variable.

Postman
const [1] = pm.collection.generateDocumentation({ format: '[2]' });
const markdownDoc = [3];
Drag options to blanks, or click blank then click option'
AmdDoc
Bmarkdown
DmarkdownDoc
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'markdownDoc' as the first variable causes confusion.
Setting format to 'md' or other strings causes errors.