-
Notifications
You must be signed in to change notification settings - Fork 29
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
Create API-Testing-Guidelines.md #117
Create API-Testing-Guidelines.md #117
Conversation
@shilpa-padgaonkar Document looks fine to me. |
spellcheck
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/LGTM
Maybe a link to subproject sample could help? This one for exemple
Submission of test cases by trehman-gsma · Pull Request #68 · camaraproject/SimSwap (github.com
@patrice-conil : made the fix as you suggested. I simply used qod as example because simswap example is still a PR |
Update following camaraproject/Commonalities#117 proposal.
Hello @shilpa-padgaonkar Like my colleague @patrice-conil I think referring a sample is very useful. I have an issue with QoD file because it not reflect the rules (several when/then, name). I've applied rules here: camaraproject/DeviceLocation#119 (review) - Could you please take a look on this proposal and check if it aligned with your view? We should have an exemple fully aligned with these rules i guess and use it as base. |
@thanks Ludovic for your quick feedback. I simply added qod as an example for the location (where should the feature file reside). BTW, should we add your example link already, or would you want to do this after your PR gets merged (I am fine both ways)? |
@bigludo7 Except minor comments , mentioned feature file in PR camaraproject/DeviceLocation#119 (review) |
Thanks a lot @shilpa-padgaonkar and @mdomale for your review. Regarding:
I suggest we wait from Device location project feedback but I will inform then that current proposal is "OK" from our perpsective. Adding @jlurien in the loop. |
|
||
## Best practices and recommendations <a name="recommendations"></a> | ||
|
||
* One feature file per API is advisable so that all scenarios can be covered corresponding to the API & the corresponding resource. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should not impose one single .feature file per API, but one feature file per operation or API endpoint/resource. In general, it is not advisable to test several unrelated "API features" within the same .feature file. For closely related operations we may add scenarios in the same file testing crossed behaviour between several operations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shilpa-padgaonkar following today Commonalities meeting I proposed to update this sentence but I'm not able to update the file. My proposal for line 25:
Granularity of the feature file must be decided at the project level but it is recommended to:
- group in one file all scenarios for one given API capability (that can cover several endpoints).
- provide several files when one CAMARA API (yaml) covers several independent functions that can be provided independently
Perhaps @jlurien could provide a better wording. I think we're aligned.
|
||
## References <a name="references"></a> | ||
|
||
* [One feature file per API](https://www.testquality.com/blog/tpost/v79acjttj1-cucumber-and-gherkin-language-best-pract) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where does this reference recommend having one file per API? APIs are not explicitly mentioned, but considering several files for specific parts is advised:
How should the files be separated?
Because separating the features might result in a large number of files, you must consider how to separate the features into various files.A popular solution is to have a file with features that collect everything relevant to a specific part of the program and even organize it into directories.
In the issue #94, another reference was mentioned. There, it is advised to:
Putting multiple features in a single feature file is not recommended. It is recommended to have a separate feature file for each feature. However, it is acceptable to include multiple scenarios in a single feature file.
So we should identify what are the "features" in the context of an API, and put a feature per file. To me a feature in this context is an API operation or resource. For simple APIs with single operations, it is quite straight-forward to decide that one file is enough, e.g. location-verification API, but for more complex APIs, such as QoD, we may need several files to test unrelated features, e.g. discovery of QoD profiles, creating QoD sessions, etc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jlurien The reference link for one feature per API is https://copyprogramming.com/howto/multiple-feature-inside-single-feature-file#multiple-feature-inside-single-feature-file @shilpa-padgaonkar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mdomale. In my understanding, the guidelines there does not advice for one feature per API but one "feature" per *.feature file. So that is what I suggest, to identify which are the "features" to test in the context of an API, and put each feature in each own *.feature file. Thus, an API may have several *.feature files for testing different aspects of the API. In simple APIs with just one endpoint that will not be the case.
Co-authored-by: Jose Luis Urien <jlurien@gmail.com>
@jlurien : Thanks for your comments. I will fix the incorrect link with the new one provided by @mdomale and add it to the doc. |
@shilpa-padgaonkar I tend to agree with @jlurien that we should flex the following sentence:
Indeed, as I'm involved in Device Status for example, we have there one API (one yaml) that feature 3 distincts capabilities:
(the granularity of this API is perhaps challengeable but that's another topic) I assume that it will be in this case simpler to have 3 dedicated features --> I will trigger the discussion in this project. Let's see the feedback we have from QoD & Device Status... Perhaps we can put in like this: Granularity of the feature file should be at the project level but it is recommended to group in one file all scenario for one given API fonction. If a CAMARA API features several independent fonctions it is recommended to provide several files. |
@bigludo7 : Thanks Ludovic for driving this in devicestatus. :) |
I agree with @bigludo7 and Device Status is a very good example. "Feature" is a very abstract concept, but the common advice is to not mix unrelated functionality in the same file. It is more easy to work with several small files dedicated to test an specific part of an application or API, in our case, that having only a huge file with hundreds of unrelated scenarios. |
@jlurien and @bigludo7 : Could you also kindly propose a text in the meanwhile which would reflect this more relaxed guideline, as opposed to "One feature file per API is advisable so that all scenarios can be covered corresponding to the API". As we need to agree and merge this document for the upcoming release, I would request you to already prep for this text and once we get this similar feedback as suggested above from devicestatus and qod, we can add your text and proceed with approving and merging this doc. |
I've just provided a sentence as a review comment ;) |
@bigludo7 : Thanks. Your suggestions are now added to the doc :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Requesting @jlurien to kindly review and approve if ok |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with some minor suggestion
Co-authored-by: Jose Luis Urien <jlurien@gmail.com>
Thanks all for the contributions, review and approval. @rartych: Could you kindly check that there are no more open points ignored as a part of the review and if not, proceed to merge the PR? |
@RubenBG7 @jordonezlucena - as @jlurien approved the PR, could you approve it as codewoners? |
What type of PR is this?
Add one of the following kinds:
What this PR does / why we need it:
Adds API-testing-guidelines doc
Which issue(s) this PR fixes:
Fixes #94
Special notes for reviewers:
Changelog input
Additional documentation
This section can be blank.