Azure / data-api-builder

Data API builder provides modern REST and GraphQL endpoints to your Azure Databases and on-prem stores.
https://aka.ms/dab/docs
MIT License
899 stars 180 forks source link

Improve readability and extensibility in the test suite #2143

Open aaronburtle opened 6 months ago

aaronburtle commented 6 months ago

Across our test suite, we have a number of tests that have correct functionality but can be difficult to modify and have some readability issues. Things like code duplication, and hard coded values can make updates to the test time consuming.

As an example, take this test from GraphQLPaginationTests.RequestAfterTokenOnly

image

Because of how the expected values are coded, if for example we want to update this test because we have a case where the after token is not of this form, it requires us to add another conditional that matches the new case and then has the expected value setup their. This is difficult to read, and slow to update.

As we expand our functionality we will require updates to our test suite, and improving readability and extensibility will be useful.

One candidate for code duplication is the test class used in this PR

https://github.com/Azure/data-api-builder/pull/2139

which has many spots where code is duplicated across many tests.

seantleonard commented 6 months ago