Write API automation tests using RestSharp(Project Language C#) or RestAssured(Java)

Hey Friends,

I am currently working on the project where the c# is used for backend and I am working as QA thinking to introduce RestAssured which is Java bases library

The classic question comes here… Which programming language to use for test automation??

As per my research, online it’s still doesn’t convince me much and it’s unclear

Argument 1 :

C# project language as getting help from Developers is easy and they will be able to help and write test automation effectively to help QAs

But, In reality, quite a few developers actually write test automation and they don’t get much time if they focus on complete story development (Feature development, Unit and Integration tests). I found its a risk

Argument 2:

RestAssured is a more popular tool as compare to RestSharp. So losing more community support is quite a risk and Almost every QA know about this tool or working on this sometime during his/her/its career

If we look at Test Pyramid then Devs can more focus and Unit and Integration layer and QAs can more focus on the API and UI.

having said the amount of writing API and UI is less as compare to Unit and Integration and can completely be owned by QAs so as Automation tech stack decision.

Please let me know your views on this. I may be right or learn something new :grinning:

As a general rule, unless you have compelling reasons not to, it’s better to use the same language your developers are using.

Reasons include:

  • Using the same language means you can use the same general tool set and have a much easier time using existing utility functions rather than creating your own utilities.
  • Using the same language allows you to make use of your team’s expertise in code reviews, solving difficult problems, and so forth.
  • With the same language you have the potential to build and run your API code alongside the application code. This allows you to test the API in a whitebox fashion rather than a blackbox, and to be better able to debug unexpected responses.
  • Using the same language also allows you to leverage existing unit and integration tests, which in turn allows you to focus your tests more effectively.

From your second argument,

If we look at Test Pyramid then Devs can more focus and Unit and Integration layer and QAs can more focus on the API and UI.

having said the amount of writing API and UI is less as compare to Unit and Integration and can completely be owned by QAs so as Automation tech stack decision.

This argument applies equally to RestSharp and RestAssured. If you also consider that Java is not compatible with C# in the sense that it isn’t possible (that I know of) to have Java and C# projects in the same solution, and that Java is just similar enough to C# to cause “interesting” problems to a C# developer trying to review or help with Java code (and vice versa), choosing to work with Java for test automation brings in a potential risk in your situation.

I personally would go with C# in this situation (and have). You will need to weigh your potential risks and benefits a bit more and then choose.

One thing I do recommend is setting up a proof of concept with each potential solution and code connecting to the API, authorizing, and a simple call. Once you’ve done that, you’ll have a better idea of which language works better for you.

4 Likes