Building an API Framework From Scratch

We’ve all had the dream at some point in our testing careers. We join a team, we see the test/automation frameworks and we want to scrap them all and start again.

Now imagine you get that opportunity, you join a team and you’re allowed to build an API framework from scratch. Obviously the technology you choose would vary based on the API.

If you had to build an API testing solution from the ground up, how would you do it and why?

I’m using an open source Concordion in Java (https://concordion.org/), as a unified test automation framework. It allows me to embed all my REST API tests using Spring framework. I also wrote an article on how to do REST API automation (https://www.methodsandtools.com/archive/restapitesting.php)

I think the question can be extended to cover test automation frameworks in general, doesn’t have to be just for API (testing).

It would probably have to be a compromise between personal preferences + team/company fit + management expertise with the chosen technology down the line based on hiring from market & existing team/company expertise.

Personally, having done such evaluation/research some time back, I would much prefer not to build a framework from scratch and use an existing general purpose framework for the job and customize it for one’s organization’s needs.

My personal preference would be to use RobotFramework where possible, for all its general purpose feature set & it’s ability to work cross programming/scripting language by way of remote interface for test libraries, allowing one to code test tooling for the framework in other languages besides python & Java. There are not that many frameworks out there that have cross language support.

Found a discussion on Slack about this, specifically related to a .net framework and the community had this to say:

used readyAPI - its great, they do rest and soap calls (I needed to support both). They connect to the DB for assertion, there is managed authentication which lets you handle complicated authentication (such as expired token or different rights to different users) . The learning curve is minimal and there is a lot of support from their team when you get to do more complicated things. You can start simple by developing tests using clicks and move on to more complex testing steps and assertions using groovy (or other languages that they support).

@mwinteringham added

the very excellent @g33klady built a C# version of my api framework model that you can check out here: https://github.com/mwinteringham/api-framework

@gwendiagram offered

RestSharp is super cute http://restsharp.org/
I’d write it in code and it gets the developers more involved and feels like everyone is involved in testing and can see the results. I’d write it in C# to ensure the developers were still involved as well.