-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Does AAA applies to API/Integration testing? #223
Comments
I am no expert, but let me offer my humble opinion:
It depends on your point of view (what you mean by "one Act").
You could say I am acting multiple times, or you could even see the Basically it could be reduced into "When I do this act given this arrangement I assert, that it produces a certain result".
I would say generally no. Having your tests abide by AAA is beneficial for Functional, Integration, Unit, Smoke, etc. tests as well.
These days, the teminology around tests seems pretty inconsistent as different domains need different type of testing, so people are inventing "new types of tests" each day. I have heard what you describe being called "API Tests", "System Tests" or "Functional Tests". If your domain is the API itself and your "users" and by extensions use cases are usages of the API, then I would say these are Functional Tests, but I am no testing expert.
You can write the tests to suite your needs. For me, this approach is not good for tests, that will be maintained by multiple people, that also might not have the whole domain knowledge. It might be:
These kinds of tests are effective in "code coverage" and can work if the team is small or aligned with this approach. But I would generally leave these "scenario type" of tests to End to End testing. Or at least not have them as the primary type of tests in your application. |
ATM, in my api backend, I have about 10% unit tests and 90% of what I would call "API tests". I'd like to include some of the best practices explained in this great repo, but I'm not sure how.
The problem starts by finding a correspondence between what I call "API testing" and the concepts in this repo. This article is quite fitting. In your repo it might correspond to black-box testing and/or to integration testing but I'm not sure.
Example:
This maps well to the AAA pattern, but what if I want to call multiple apis, to test a "story", a "flow"?
Example:
You don't explicitly say that there should be only one Act but I've found this quite upvoted post that says:
That post is about unit testing and I see how it makes perfect sense for unit testing. My questions are:
Thanks
The text was updated successfully, but these errors were encountered: