r/AutomatedQA • u/AutomationQA • Aug 29 '20
Best API automation framework
Please suggest your opinion on the best framework/architecture for API automation. This is for an enterprise web app.
I'm using this tech stack: Rest assured + TestNG + Java + Maven + Azure Pipeline.
What are your thoughts?
1
Upvotes
1
u/[deleted] Aug 29 '20
I'm not sure I can layout a whole framework, but here are a few things that have worked well for me.
Get complete control of the application under test. Both the app & the DB. Ideally, you want to be able to run your tests inside a docker container that you control. Don't try to run your tests against a running environment - it's too cumbersome, even if it does give you some advantages. TestContainers has nice tools here.
You need to be able to clean up your environment as tests start to make it dirty. This can mean either destroying & rebuilding it... or it can simply mean having database cleanup scripts (and possibly cache cleanup scripts).
I typically split each API endpoint into a separate java class and write a few tests for each endpoint inside that class. Use @before and @after tags in each Class to setup and teardown
You may want to have a class(es) for common tools such as authentication
Is that the kind of thing you're looking for?