-
Notifications
You must be signed in to change notification settings - Fork 12
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
Discussion: data driven testing #52
Comments
Two important concepts:
|
Data driven requires the user to have a basic knowledge of the system's models as well as APIs to interact with these models. |
But data drive testing is already taken, also known as table driven testing. Wiki: https://en.m.wikipedia.org/wiki/Data-driven_testing. However, given that table driven is widely used and has gained a relative stable shape(a table), then this method can still be referred as Data driven testing. |
To do data driven testing, following these 4 steps:
(draw a diagram to illustrate the relation of data and APIs, APIs are fall into 2 categories: internal and external like database.) |
The reverse process, convert real API response to data context, is also valuable. Compared to that directly replay real traffic, we actually split that into 2 phase:
With this, unit test can be more easily constructed and maintained from live traffic. |
Never depend on the implementation directly. Abstract a layer between the implementation and the intent.
For example, when testing a service with external dependencies, we want to mock all of them.
But we should not directly mock their request or response, instead, we abstract a data structure called
TestingContext
.This
TestingContext
is declared as a universal data fake storage:Then each dependency read data from this central data storage, and construct corresponding response based on the data.
And to reduce duplication of repeating declaring TestingContext, different tests can share a basic TestingContext, adding their custom overlay to the context.
The text was updated successfully, but these errors were encountered: