Skip to content

Commit

Permalink
[tests] Extend test coverage of Excel features (#5145)
Browse files Browse the repository at this point in the history
  • Loading branch information
valfirst authored Jun 21, 2024
1 parent 1f8e532 commit 9a34c6b
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ Lifecycle:
Before:
Scope: STORY
When I execute HTTP GET request for resource with URL `https://github.com/vividus-framework/vividus/blob/master/vividus-plugin-excel/src/test/resources/TestTemplate.xlsx?raw=true`
Then response code is = `200`
Then response code is equal to `200`

Scenario: Step verification 'Then `$excelDocument` contains excel sheet with index `$index` and records:$records'
Scenario: Validate step 'Then `$excelDocument` contains excel sheet with index `$index` and records:$records'
Then `${response-as-bytes}` contains excel sheet with index `0` and records:
{valueSeparator=!}
|cellsRange|valueRegex |
!A4:B5 !(Product|Price)\d+\s* !
!B3 !Price !
!C1:C5 ! !

Scenario: Validate variable initialization with binary data and step verification 'Then `$excelDocument` contains excel sheet with name `$name` and records:$records'
Scenario: Validate variable initialization with binary data and step 'Then `$excelDocument` contains excel sheet with name `$name` and records:$records'
Given I initialize scenario variable `excel` with value `${response-as-bytes}`
Then `${excel}` contains excel sheet with name `Mapping` and records:
{valueSeparator=!}
Expand All @@ -24,14 +24,14 @@ Then `${excel}` contains excel sheet with name `Mapping` and records:
!B3 !Price !
!C1:C5 ! !

Scenario: Verification cell formatting preserving
Scenario: Validate cell formatting is preserved
Given I initialize scenario variable `excel` with value `${response-as-bytes}`
Then `${excel}` contains excel sheet with name `AsString` and records:
|cellsRange |valueRegex |
|A1 |TRUE |
|B3 |3 |

Scenario: Verification of step 'When I create temporary excel file with content:$content and put path to $scopes variable `$variableName`' and transformer FROM_EXCEL
Scenario: Validate step 'When I create temporary excel file with content:$content and put path to $scopes variable `$variableName`' and transformer FROM_EXCEL
Meta:
@requirementId 1028, 2953
@feature table-transformers
Expand All @@ -47,7 +47,7 @@ When I initialize scenario variable `excel-data` with values:
Then `${excel-data}` is equal to table:
{transformer=FROM_EXCEL, path=$\{path\}, sheet=Sheet0, range=A1:B2}

Scenario: Steps verification 'When I create temporary excel file containing sheet with name `$sheetName` and content:$content and put its path to $scopes variable `$variableName`' and 'When I add sheet with name `$sheetName` and content $content to excel file at path `$path`'
Scenario: Validate steps 'When I create temporary excel file containing sheet with name `$sheetName` and content:$content and put its path to $scopes variable `$variableName`' and 'When I add sheet with name `$sheetName` and content $content to excel file at path `$path`'
Meta:
@requirementId 2953
When I create temporary excel file containing sheet with name `my-sheet-name` and content:
Expand All @@ -74,3 +74,40 @@ Then `${excel-data}` is equal to table:
{transformer=FROM_EXCEL, path=$\{path\}, sheet=my-sheet-name, range=A1:B2}
Then `${added-sheet-excel-data}` is equal to table:
{transformer=FROM_EXCEL, path=$\{path\}, sheet=added-sheet, range=A1:B4}

Scenario: Validate FROM_EXCEL transformer
Meta:
@issueId 647
Then `<joined>` is equal to `line 1 line 2 line 3`
Examples:
{transformer=FROM_EXCEL, path=/data/excel.xlsx, sheet=Sheet1, addresses=A1, column=joined, \{lineBreakReplacement|VERBATIM\}= }

Scenario: Check loading excel table with different data types using FROM_EXCEL transformer
Meta:
@issueId 2908
When I initialize scenario variable `expectedTable` with values:
|StringValue|NumericValue|BooleanValue|FormulaValue|FormulaErrorValue|
|City |17 |FALSE |289 |#VALUE! |
Then `${expectedTable}` is equal to table:
{transformer=FROM_EXCEL, path=/data/excel.xlsx, sheet=DifferentTypes, range=A1:E2}

Scenario: Check FROM_EXCEL transformer with multiple ranges (separate ranges for header and data)
Meta:
@issueId 5084
When I initialize scenario variable `expectedTable` with values:
|StringValue |NumericValue |BooleanValue |FormulaValue |
|Timezone |21 |FALSE |441 |
|City |17 |FALSE |289 |
|Country |19 |TRUE |361 |
Then `${expectedTable}` is equal to table:
{transformer=FROM_EXCEL, path=/data/excel.xlsx, sheet=DifferentTypes, range=A1:D1;A4:D4;A2:D3;}

Scenario: Check FROM_EXCEL transformer with multiple ranges (separate ranges for header with data and additional data)
Meta:
@issueId 5084
When I initialize scenario variable `expectedTable` with values:
|NumericValue |BooleanValue |FormulaValue |
|17 |FALSE |289 |
|19 |TRUE |361 |
Then `${expectedTable}` is equal to table:
{transformer=FROM_EXCEL, path=/data/excel.xlsx, sheet=DifferentTypes, range=B1:D2;B3:D3}
Original file line number Diff line number Diff line change
Expand Up @@ -146,43 +146,6 @@ Examples:
|jhbdahjabw |
|738162378613896 |

Scenario: Verify FROM_EXCEL transformer
Meta:
@issueId 647
Then `<joined>` is equal to `line 1 line 2 line 3`
Examples:
{transformer=FROM_EXCEL, path=/data/excel.xlsx, sheet=Sheet1, addresses=A1, column=joined, \{lineBreakReplacement|VERBATIM\}= }

Scenario: Check loading excel table with different data types using FROM_EXCEL transformer
Meta:
@issueId 2908
When I initialize scenario variable `expectedTable` with values:
|StringValue|NumericValue|BooleanValue|FormulaValue|FormulaErrorValue|
|City |17 |FALSE |289 |#VALUE! |
Then `${expectedTable}` is equal to table:
{transformer=FROM_EXCEL, path=/data/excel.xlsx, sheet=DifferentTypes, range=A1:E2}

Scenario: Check FROM_EXCEL transformer with multiply ranges (separate ranges for header and data)
Meta:
@issueId 5084
When I initialize scenario variable `expectedTable` with values:
|StringValue |NumericValue |BooleanValue |FormulaValue |
|Timezone |21 |FALSE |441 |
|City |17 |FALSE |289 |
|Country |19 |TRUE |361 |
Then `${expectedTable}` is equal to table:
{transformer=FROM_EXCEL, path=/data/excel.xlsx, sheet=DifferentTypes, range=A1:D1;A4:D4;A2:D3;}

Scenario: Check FROM_EXCEL transformer with multiply ranges (separate ranges for header with data and additional data)
Meta:
@issueId 5084
When I initialize scenario variable `expectedTable` with values:
|NumericValue |BooleanValue |FormulaValue |
|17 |FALSE |289 |
|19 |TRUE |361 |
Then `${expectedTable}` is equal to table:
{transformer=FROM_EXCEL, path=/data/excel.xlsx, sheet=DifferentTypes, range=B1:D2;B3:D3}

Scenario: Verify ExamplesTable property value with space
Meta:
@issueId 767
Expand Down
45 changes: 45 additions & 0 deletions vividus-tests/src/main/resources/story/system/Excel.story
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
Meta:
@epic vividus-plugin-excel

Lifecycle:
Before:
Scope: STORY
When I execute HTTP GET request for resource with URL `https://github.com/vividus-framework/vividus/blob/master/vividus-plugin-excel/src/test/resources/TestTemplate.xlsx?raw=true`
Then response code is equal to `200`

Scenario: Validate cell formatting is not preserved
Given I initialize scenario variable `excel` with value `${response-as-bytes}`
Then `${excel}` contains excel sheet with name `AsString` and records:
|cellsRange |valueRegex |
|A1 |true |
|B3 |3\.0 |

Scenario: Check loading excel table with different data types using FROM_EXCEL transformer - without preserving cell formatting
Meta:
@issueId 2908
When I initialize scenario variable `expectedTable` with values:
|StringValue|NumericValue|BooleanValue|FormulaValue|FormulaErrorValue|
|City |17.0 |false |289.0 | |
Then `${expectedTable}` is equal to table:
{transformer=FROM_EXCEL, path=/data/excel.xlsx, sheet=DifferentTypes, range=A1:E2}

Scenario: Check FROM_EXCEL transformer with multiple ranges (separate ranges for header and data) - without preserving cell formatting
Meta:
@issueId 5084
When I initialize scenario variable `expectedTable` with values:
|StringValue |NumericValue |BooleanValue |FormulaValue |
|Timezone |21.0 |false |441.0 |
|City |17.0 |false |289.0 |
|Country |19.0 |true |361.0 |
Then `${expectedTable}` is equal to table:
{transformer=FROM_EXCEL, path=/data/excel.xlsx, sheet=DifferentTypes, range=A1:D1;A4:D4;A2:D3;}

Scenario: Check FROM_EXCEL transformer with multiple ranges (separate ranges for header with data and additional data) - without preserving cell formatting
Meta:
@issueId 5084
When I initialize scenario variable `expectedTable` with values:
|NumericValue |BooleanValue |FormulaValue |
|17.0 |false |289.0 |
|19.0 |true |361.0 |
Then `${expectedTable}` is equal to table:
{transformer=FROM_EXCEL, path=/data/excel.xlsx, sheet=DifferentTypes, range=B1:D2;B3:D3}

0 comments on commit 9a34c6b

Please sign in to comment.