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

using schemathesis or similar tools for testing purposes #51

Open
sameh-farouk opened this issue Jan 15, 2023 · 10 comments
Open

using schemathesis or similar tools for testing purposes #51

sameh-farouk opened this issue Jan 15, 2023 · 10 comments
Assignees
Labels
grid-proxy belongs to grid proxy type_feature New feature or request
Milestone

Comments

@sameh-farouk
Copy link
Member

sameh-farouk commented Jan 15, 2023

Description

I saw these two issues raised recently,

  1. Sometimes our API specifications get outdated and out-of-sync with our implementation. we should always respect this contract, but how to make sure it is always respected and updated?
  2. We need to test our API functionality regularly to ensure it is working properly, a PR was submitted to run basic tests in a GitHub action. it will add one more thing to the stack that is needed also to keep in sync with every change.

I want to point out that there are many tools that can generate and run tests from the API specification.
e.g, schemathesis is an API testing tool that could run thousands of generated test cases given just the API schema.

This could solve these two issues and provides added benefits:

  • The API specification is the source of truth, this will help us to improve the API and make sure that API specification remains in sync with the implementation. issue no1. solved.
  • No tests code to write or maintain, less work. issue no.2 solved.
  • Better coverage. the tool will run thousands of tests.
  • GitHub action is available out of the box (for the suggested tool).

It is expected to have many falling tests when we start to use this tool, but I see this as a pro and a way to improve and fix invisible issues.

@ramezsaeed
Copy link

@A-Harby please verify and update this issue

@A-Harby
Copy link
Contributor

A-Harby commented Feb 21, 2023

As @sameh-farouk said old PR is a hard coded endpoint tests so it's hard to maintain updated with every new changes happens on the grid proxy.
And I did some researches on schema/api testing tools and schemathesis was the most suitable tool to be used cause it have the ability to generate and easily customize theses tests.

The issue is that when the schema was tested, it reported a numerous amount of errors which will make it hard to debug and fix.
so with using schemathesis docs I found a way to use a python code to specify each endpoint and checks (mentioned below) I want the tool to test and I'm trying to separates theses errors as I could, so it could be more easier to identify and report.

There are five built-in checks you can use:

  • not_a_server_error. The response has 5xx HTTP status;
  • status_code_conformance. The response status is not defined in the API schema;
  • content_type_conformance. The response content type is not defined in the API schema;
  • response_schema_conformance. The response content does not conform to the schema defined for this specific response;
  • response_headers_conformance. The response headers does not contain all defined headers.

@Stranger6667
Copy link

Hey, Schemathesis author here. Folks, if you'd need any help or something won't work as expected with Schemathesis or you'd like to propose some feature request - do not hesitate to ping me :)

@xmonader xmonader added the type_feature New feature or request label Mar 8, 2023
@xmonader xmonader transferred this issue from threefoldtecharchive/tfgridclient_proxy Apr 12, 2023
@rawdaGastan rawdaGastan added the grid-proxy belongs to grid proxy label Apr 12, 2023
@xmonader xmonader added this to the later milestone Apr 17, 2023
@xmonader
Copy link
Contributor

xmonader commented Jun 7, 2023

What is the status here? please make sure it's updated and merged or let's close the issue

@muhamadazmy muhamadazmy modified the milestones: later, 1.1.0 Oct 30, 2023
@xmonader
Copy link
Contributor

xmonader commented Dec 6, 2023

@ramezsaeed @A-Harby what are we going to do with this one?

@A-Harby
Copy link
Contributor

A-Harby commented Jan 16, 2024

I will update the old PR code and version at threefoldtecharchive/tfgridclient_proxy#297, and create a new PR on this repo after.

@A-Harby A-Harby mentioned this issue Jan 30, 2024
4 tasks
@A-Harby
Copy link
Contributor

A-Harby commented Jan 30, 2024

wip:
Create a new PR with new versions, all the networks and locally, and some fixes: #695, waiting for reviews.

@sameh-farouk
Copy link
Member Author

Any progress or help needed for This one? Last update/review on PR was about two months ago.

@A-Harby
Copy link
Contributor

A-Harby commented Apr 14, 2024

Any progress or help needed for This one? Last update/review on PR was about two months ago.

I'll update the PR with some changes as requested here: #695 (comment) and will request a re-review.

@A-Harby
Copy link
Contributor

A-Harby commented May 1, 2024

Approved and done: #695 (review).

@rawdaGastan rawdaGastan modified the milestones: 1.1.0, later Sep 5, 2024
@rawdaGastan rawdaGastan modified the milestones: later, v0.17.x Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
grid-proxy belongs to grid proxy type_feature New feature or request
Projects
None yet
Development

No branches or pull requests

7 participants