Perfer to define methods instead of calling test

This file is using this pattern already
Correct comment [ci skip]
Merge pull request #14840 from akshay-vishnoi/doc_changes

Correct comment [ci skip]