Skip to content

Commit

Permalink
Make minor fixes and adjustments to the import test plan
Browse files Browse the repository at this point in the history
  • Loading branch information
banderror committed Feb 21, 2025
1 parent 8562d4f commit bde4612
Showing 1 changed file with 54 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,21 @@ https://marketplace.visualstudio.com/items?itemName=yzhang.markdown-all-in-one
- [Non-functional requirements](#non-functional-requirements)
- [Scenarios](#scenarios)
- [Core Functionality](#core-functionality)
- [Scenario: Importing an unmodified prebuilt rule with a matching rule_id and version](#scenario-importing-an-unmodified-prebuilt-rule-with-a-matching-rule_id-and-version)
- [Scenario: Importing a customized prebuilt rule with a matching rule_id and version](#scenario-importing-a-customized-prebuilt-rule-with-a-matching-rule_id-and-version)
- [Scenario: Importing a custom rule with a matching rule_id and version](#scenario-importing-a-custom-rule-with-a-matching-rule_id-and-version)
- [Scenario: Importing a prebuilt rule with a matching rule_id but no matching version](#scenario-importing-a-prebuilt-rule-with-a-matching-rule_id-but-no-matching-version)
- [Scenario: Importing a prebuilt rule with a non-existent rule_id](#scenario-importing-a-prebuilt-rule-with-a-non-existent-rule_id)
- [Scenario: Importing a prebuilt rule without a rule_id field](#scenario-importing-a-prebuilt-rule-without-a-rule_id-field)
- [Scenario: Importing a prebuilt rule with a matching rule_id but missing a version field](#scenario-importing-a-prebuilt-rule-with-a-matching-rule_id-but-missing-a-version-field)
- [Scenario: Importing an existing custom rule missing a version field](#scenario-importing-an-existing-custom-rule-missing-a-version-field)
- [Scenario: Importing a new custom rule missing a version field](#scenario-importing-a-new-custom-rule-missing-a-version-field)
- [Scenario: Importing a rule with overwrite flag set to true](#scenario-importing-a-rule-with-overwrite-flag-set-to-true)
- [Scenario: Importing a rule with overwrite flag set to false](#scenario-importing-a-rule-with-overwrite-flag-set-to-false)
- [Scenario: Importing a non-customized prebuilt rule with a matching `rule_id` and `version`](#scenario-importing-a-non-customized-prebuilt-rule-with-a-matching-rule_id-and-version)
- [Scenario: Importing a customized prebuilt rule with a matching `rule_id` and `version`](#scenario-importing-a-customized-prebuilt-rule-with-a-matching-rule_id-and-version)
- [Scenario: Importing a custom rule with a matching prebuilt `rule_id` and `version`](#scenario-importing-a-custom-rule-with-a-matching-prebuilt-rule_id-and-version)
- [Scenario: Importing a custom rule with a matching custom `rule_id` and `version`](#scenario-importing-a-custom-rule-with-a-matching-custom-rule_id-and-version)
- [Scenario: Importing a prebuilt rule with a matching `rule_id` but no matching `version`](#scenario-importing-a-prebuilt-rule-with-a-matching-rule_id-but-no-matching-version)
- [Scenario: Importing a prebuilt rule with a non-existent `rule_id`](#scenario-importing-a-prebuilt-rule-with-a-non-existent-rule_id)
- [Scenario: Importing a prebuilt rule without a `rule_id` field](#scenario-importing-a-prebuilt-rule-without-a-rule_id-field)
- [Scenario: Importing a prebuilt rule with a matching `rule_id` but missing a `version` field](#scenario-importing-a-prebuilt-rule-with-a-matching-rule_id-but-missing-a-version-field)
- [Scenario: Importing an existing custom rule missing a `version` field](#scenario-importing-an-existing-custom-rule-missing-a-version-field)
- [Scenario: Importing a new custom rule missing a `version` field](#scenario-importing-a-new-custom-rule-missing-a-version-field)
- [Scenario: Importing a rule with `overwrite` flag set to true](#scenario-importing-a-rule-with-overwrite-flag-set-to-true)
- [Scenario: Importing a rule with `overwrite` flag set to false](#scenario-importing-a-rule-with-overwrite-flag-set-to-false)
- [Scenario: Importing both custom and prebuilt rules](#scenario-importing-both-custom-and-prebuilt-rules)
- [Scenario: Importing prebuilt rules when the rules package is not installed](#scenario-importing-prebuilt-rules-when-the-rules-package-is-not-installed)
- [Scenario: User imports a custom rule before a prebuilt rule asset is created with the same rule_id](#scenario-user-imports-a-custom-rule-before-a-prebuilt-rule-asset-is-created-with-the-same-rule_id)
- [Scenario: Importing a prebuilt rule when the rules package is not installed](#scenario-importing-a-prebuilt-rule-when-the-rules-package-is-not-installed)
- [Scenario: Importing a custom rule before a prebuilt rule asset is created with the same `rule_id`](#scenario-importing-a-custom-rule-before-a-prebuilt-rule-asset-is-created-with-the-same-rule_id)

## Useful information

Expand Down Expand Up @@ -78,81 +79,85 @@ https://marketplace.visualstudio.com/items?itemName=yzhang.markdown-all-in-one

### Core Functionality

#### Scenario: Importing an unmodified prebuilt rule with a matching rule_id and version
#### Scenario: Importing a non-customized prebuilt rule with a matching `rule_id` and `version`

**Automation**: 1 cypress test and 1 integration test.

```Gherkin
Given the import payload contains an unmodified prebuilt rule
Given the import payload contains a non-customized prebuilt rule
And its rule_id and version match a rule asset from the installed package
When the user imports the rule
Then the rule should be created or updated
And the ruleSource type should be "external"
And isCustomized should be false
```

#### Scenario: Importing a customized prebuilt rule with a matching rule_id and version
#### Scenario: Importing a customized prebuilt rule with a matching `rule_id` and `version`

**Automation**: 1 cypress test and 1 integration test.

```Gherkin
Given the import payload contains a modified prebuilt rule
Given the import payload contains a customized prebuilt rule
And its rule_id and version match a rule asset from the installed package
When the user imports the rule
Then the rule should be created or updated
And the ruleSource type should be "external"
And isCustomized should be true
```

#### Scenario: Importing a custom rule with a matching prebuilt rule_id and version
#### Scenario: Importing a custom rule with a matching prebuilt `rule_id` and `version`

**Automation**: 1 cypress test and 1 integration test.

```Gherkin
Given the import payload contains a custom rule with a matching rule_id and version
Given the import payload contains a custom rule
And its rule_id and version match a rule asset from the installed package
When the user imports the rule
Then the rule should be created or updated
And the ruleSource type should be "external"
And isCustomized should be true
```

#### Scenario: Importing a custom rule with a matching custom rule_id and version
#### Scenario: Importing a custom rule with a matching custom `rule_id` and `version`

**Automation**: 1 cypress test and 1 integration test.

```Gherkin
Given the import payload contains a custom rule with a matching rule_id and version
Given the import payload contains a custom rule
And its rule_id and version match a rule asset from the installed package
And the overwrite flag is set to true
When the user imports the rule
Then the rule should be created or updated
And the ruleSource type should be "internal"
```

#### Scenario: Importing a prebuilt rule with a matching rule_id but no matching version
#### Scenario: Importing a prebuilt rule with a matching `rule_id` but no matching `version`

**Automation**: 1 integration test.

```Gherkin
Given the import payload contains a prebuilt rule
And its rule_id matches a rule asset from the installed package
And the version does not match the rule asset's version
And its rule_id matches one or a few rule assets from the installed package
And its version does NOT match any of those rule assets
When the user imports the rule
Then the rule should be created or updated
And the ruleSource type should be "external"
And isCustomized should be true
```

#### Scenario: Importing a prebuilt rule with a non-existent rule_id
#### Scenario: Importing a prebuilt rule with a non-existent `rule_id`

**Automation**: 1 integration test.

```Gherkin
Given the import payload contains a prebuilt rule
And its rule_id does NOT match a rule asset from the installed package
And its rule_id does NOT match any rule assets from the installed package
When the user imports the rule
Then the rule should be created
And the ruleSource type should be "internal"
```

#### Scenario: Importing a prebuilt rule without a rule_id field
#### Scenario: Importing a prebuilt rule without a `rule_id` field

**Automation**: 1 integration test.

Expand All @@ -162,41 +167,46 @@ When the user imports the rule
Then the import should be rejected with a message "rule_id field is required"
```

#### Scenario: Importing a prebuilt rule with a matching rule_id but missing a version field
#### Scenario: Importing a prebuilt rule with a matching `rule_id` but missing a `version` field

**Automation**: 1 integration test.

```Gherkin
Given the import payload contains a prebuilt rule without a version field
And its rule_id matches one or a few rule assets from the installed package
When the user imports the rule
Then the import should be rejected with a message "version field is required"
```

#### Scenario: Importing an existing custom rule missing a version field
#### Scenario: Importing an existing custom rule missing a `version` field

**Automation**: 1 integration test.

```Gherkin
Given the import payload contains an existing custom rule without a version field
Given the import payload contains a custom rule without a version field
And its rule_id does NOT match any rule assets from the installed package
And this custom rule has already been created
When the user imports the rule
Then the rule should be updated
And the ruleSource type should be "internal"
And the "version" field should be set to the existing rule's "version"
```

#### Scenario: Importing a new custom rule missing a version field
#### Scenario: Importing a new custom rule missing a `version` field

**Automation**: 1 integration test.

```Gherkin
Given the import payload contains a new custom rule without a version field
Given the import payload contains a custom rule without a version field
And its rule_id does NOT match any rule assets from the installed package
And this custom rule hasn't been created yet
When the user imports the rule
Then the rule should be created
And the ruleSource type should be "internal"
And the "version" field should be set to 1
```

#### Scenario: Importing a rule with overwrite flag set to true
#### Scenario: Importing a rule with `overwrite` flag set to true

**Automation**: 1 integration test.

Expand All @@ -209,7 +219,7 @@ Then the rule should be overwritten
And the ruleSource should be based on rule_id and version
```

#### Scenario: Importing a rule with overwrite flag set to false
#### Scenario: Importing a rule with `overwrite` flag set to false

**Automation**: 1 integration test.

Expand All @@ -228,25 +238,28 @@ CASE: should have the same outcome for all rule types
**Automation**: 1 integration test.

```Gherkin
Given the import payload contains modified and unmodified, custom and prebuilt rules
When the user imports the rule
Given the import payload contains prebuilt non-customized, prebuilt customized, and custom rules
When the user imports these rules
Then custom rules should be created or updated, with versions defaulted to 1
And prebuilt rules should be created or updated,
And prebuilt rules missing versions should be rejected
```

#### Scenario: Importing prebuilt rules when the rules package is not installed
#### Scenario: Importing a prebuilt rule when the rules package is not installed

**Automation**: 1 integration test.

```Gherkin
Given the import payload contains prebuilt rules
And no rules package has been installed locally
Given the import payload contains a prebuilt rule
And its rule_id matches one or a few rule assets from the latest package
And the package hasn't been installed yet
When the user imports the rule
Then the latest prebuilt rules package should get installed automatically
Then the latest package should get installed automatically
And the rule should be created or updated
And the ruleSource type should be "external"
```

#### Scenario: User imports a custom rule before a prebuilt rule asset is created with the same rule_id
#### Scenario: Importing a custom rule before a prebuilt rule asset is created with the same `rule_id`

**Automation**: 1 integration test.

Expand Down

0 comments on commit bde4612

Please sign in to comment.