Skip to main content

File asserts

"<filepath>" file should[ not] exist

Asserts that a file should exist (or not).

Where

  • <filepath> the path to the file to check
  • notto check that the file does not exist (negation)

Example

   Then "path/to/existing.txt" file should exist
And "path/to/missing.txt" file should not exist
<filepathRef file> should[ not] exist

Asserts that a file should exist (or not).

Where

  • <filepathRef file> is the name of the binding containing the path of the file to check
  • notto check that the file does not exist (negation)

Example

  Given my existing file is "path/to/existing.txt"
And my missing file is "path/to/missing.txt"
Then my existing file should exist
Then my missing file should not exist
"<filepath>" file should[ not] be empty

Asserts that a file should be empty (or not).

Where

  • <filepath> the path to the file to check
  • notto check that the file is not empty (negation)

Example

   Then "path/to/empty.txt" file should be empty
And "path/to/populated.txt" file should not be empty
<filepathRef file> should[ not] be empty

Asserts that a file should be empty (or not).

Where

  • <filepathRef file> is the name of the binding containing the path of the file to check
  • notto check that the file is not empty (negation)

Example

  Given my empty file is "path/to/empty.txt"
And my populated file is "path/to/populated.txt"
Then my empty file should be empty
Then my populated file should not be empty