Skip to content
This repository was archived by the owner on May 17, 2023. It is now read-only.
This repository was archived by the owner on May 17, 2023. It is now read-only.

System: File content basic manipulation #16

@mkolisnyk

Description

@mkolisnyk

Basic file content manipulation includes various operations which are targeted to set/get/update file content and relevant information. The following operations are included:

  • Append text
  • Write text
  • Get contents
  • Head/tail file content
  • Get file size

Scenario: Append text to file

  • Append text

Given the "./Test.txt" file doesn't exist
When I append the "./Test.txt" file with the "test line" text
Then I should see the "./Test.txt" file is available
And the "./Test.txt" file content is:
|Line|
|test line|
When I append the "./Test.txt" file with the "test line 2" text
Then I should see the "./Test.txt" file content is:
|Line|
|test line|
|test line 2|

Scenario: Write text to file

  • Write text

Given the "./Test.txt" file doesn't exist
When I write the "test line" text into "./Test.txt" file
Then I should see the "./Test.txt" file is available
And the "./Test.txt" file content is:
|Line|
|test line|
When I write the "test line 2" text into "./Test.txt" file
Then I should see the "./Test.txt" file content is:
|Line|
|test line 2|

Scenario: Get contents, head and tail

  • Get contents
  • Head/tail file content

Given the "./Test.txt" file doesn't exist
When I append the "./Test.txt" file with the following lines:
|Line|
|test line 1|
|test line 2|
|test line 3|
|test line 4|
|test line 5|
Then I should see the first 3 lines of the "./Test.txt" file are:
|Line|
|test line 1|
|test line 2|
|test line 3|
And the last 2 lines of the "./Test.txt" file are:
|Line|
|test line 4|
|test line 5|
And the lines from 2 of the "./Test.txt" file are:
|Line|
|test line 2|
|test line 3|
|test line 4|
|test line 5|
And the lines from 2 to 4 of the "./Test.txt" file are:
|Line|
|test line 2|
|test line 3|
|test line 4|

Scenario: File size

  • Get file size

Given the "./Test.txt" file doesn't exist
When I append the "./Test.txt" file with the "test line" text
Then I should see the "./Test.txt" file size is 11 bytes
When I append the "./Test.txt" file with the "test line2" text
Then I should see the "./Test.txt" file size is 23 bytes
When I delete the "./Test.txt" file
Then I should see the "./Test.txt" file size is -1 bytes

Metadata

Metadata

Assignees

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions