Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation if status codes comparators parameters were provided #296

Merged

Conversation

plutasnyy
Copy link
Contributor

I created validation for StatusCodesComparator`s parameters

Description

I added validation and changed test to be consistent with documentation

Motivation and Context

This change provide validation if mandatory arguments were provided

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

I hereby agree to the terms of the AET Contributor License Agreement.

@plutasnyy plutasnyy requested a review from tkaik July 27, 2018 12:46
Copy link
Contributor

@malaskowski malaskowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, it looks that this filter works a little different than docs says.
If user does not provide filterRange or filterCodes the default range is checked, which is 0 - 600.
We would like to keep this behavior.

Instead of making validation here, please update Status Codes Comparator docs and describe how it works, that parameters are optional and what's the behavior if none of parameters is defined.

Bonus: what happens if user define both: filterRange and filterCodes?

@tkaik
Copy link
Contributor

tkaik commented Jul 30, 2018

As discussed with @Skejven - the default range should be changed to 400-600, because filterRange / filterCodes are actually for specifying which status code should be reported as unexpected (i.e. should mark the test case as failed).

@plutasnyy plutasnyy force-pushed the validation_if_statusCodesComparators_parameters_were_provided branch from fd9caf4 to e34670c Compare July 31, 2018 11:58
| `showExcluded` | boolean (default: `true`) | true | Flag that says if excluded codes (see [[Status Codes Data Filters | StatusCodesDataFilters]]) should be displayed in report. By default set to `true`. | no |
If you provide `filterRange` and `filterCodes`, it will be used as logical sum. It means that `filterRange="400,500"` `filterCodes=501,502` is equivalent to `filterRange="400,502"` but for `filterRange="300,400"` `filterCodes=404` all codes between `401-403` won`t be checked.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please leave a blank line between the table and that sentence. There is something wrong with layout without it.

Please change this sentence to:

If you provide both filterRange and filterCodes, it will be used as logical sum. It means that:

  • <status-codes filterRange="400,500" filterCodes="501,502" /> is equivalent to <status-codes filterRange="400,502" />
  • <status-codes filterRange="300,400" filterCodes="404" /> won't check 401-403 codes.

Copy link
Contributor

@malaskowski malaskowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update CHANGELOG according to AET Contributing rules

<url href="comparators/statuscodes/noneexistingPage.jsp"/>
</urls>
</test>

<test name="F-comparator-StatusCodes-200-success" useProxy="rest">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have new test added here.
Please update also our integration tests (functional).

CHANGELOG.md Outdated
@@ -10,6 +10,7 @@ All notable changes to AET will be documented in this file.
## Unreleased
**List of changes that are finished but not yet released in any final version.**

- [PR-296](https://github.com/Cognifide/aet/pull/296) The behavior of StatusCodesComparator was changed
Copy link
Contributor

@malaskowski malaskowski Aug 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add more information here?
E.g.

Status Code Comparator check now range 400-600 by default, parameters validation added

@@ -96,7 +96,7 @@ public void setUp() {
@Test
Copy link
Contributor

@wiiitek wiiitek Aug 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some issues with this test. Could we resolve them in this pull request?
It looks like dataResult mock is never used (or am I wrong?).
Also: it looks strange when whe change from failed to passed. Why is that?

Currently we are not testing much here. It might be a good time to improve this test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added some tests. The change from failed to passed is the result of changed logic expression when we have both filterCodes and filterRange - before, we had AND between range and codes, now we have OR ;)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! That is great! I had some more ideas (pull request #305). Maybe you would like to get some of them into your feature branch?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely! Thank you so much for your help :D

@@ -55,8 +55,8 @@ Feature: Tests Results Filtering
Scenario: Filtering Tests Results: status-codes
Given I have opened sample tests report page
When I search for tests containing "status"
Then There are 20 tiles visible
And Statistics text contains "20 ( 8 / 0 / 12 / 0 )"
Then There are 21 tiles visible
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this! :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your welcome ;)

@@ -1,5 +1,7 @@
#### Status Codes Data Filters

Data filters will be apply only for codes contained in the `filterange`. If the `filterRange` isn't provided, default range will be used.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix the filterange typo.
What about codes contained in the filterCodes parameter - will data filters be applied for them?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

Copy link
Contributor

@malaskowski malaskowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before merging to master please merge #305 to this branch first.

@tkaik tkaik merged commit ff295e4 into master Aug 9, 2018
@tkaik tkaik deleted the validation_if_statusCodesComparators_parameters_were_provided branch August 9, 2018 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants