13

We have a Rest API written in C# and I need to investigate a good approach to automate the tests. There are 2 ways to automate API tests:

  • GUI tool (e.g. SoapUI)
  • Programmatic approach, using some test framework

What are the Cons and Pros for each approach ? For Programmatic approach, is it important for the tests to be written in the same language as the code, or it could be written in a scripting language, e.g. Python ?

2
  • @FDM Why didn't you try to use Visual studio Web Tests instead if writing your own framework?
    – Wesam f
    Commented Mar 29, 2018 at 8:48
  • I haven't heard about Visual studio Web Tests, how does it work ?
    – Arthur M.
    Commented Mar 30, 2018 at 10:06

3 Answers 3

13

I have had exactly the same assignment earlier this year, for APIs written in C#. Options I have (tried to) build a PoC for were:

  • SoapUI
  • Postman
  • Own framework built in C# using either RestSharp or HttpClient.

In agreement with the test lead and architecture team, we have decide to use our own C# API testing framework for the following reasons:

  • Ease of data setup: test project can be added to API solution and thus use (in our case) the same Entity Framework models to prepare and/or check data.
  • Version control in TFS or Git, also for the test data.
  • Easy to integrate in the build pipeline so these tests run after every deploy.
  • More control over technical implementation of the tests.
2

In a similar case, we went with writing our own very light weight framework. Reasons are:

  • We were not using many of the features of Soap UI, so just to make Restful calls, Soap UI is an overkill
  • The paid version was costly for our need; extending the free version needed Groovy skills - Groovy was not a language our team was familiar with
  • Soap UI projects did not integrate well with GitHub. The XML nature of the project file always created merge conflicts and we couldn't tell what has changed

We ended up writing a very light weight framework in NodeJS and kept the data in JSON files. If your teams are heavily invested in the SmartBear suite, it makes sense to go with Soap UI / a tool from the suite.

1

We are using Postman.

Reason: It forces us to concentrate on the testing and test cases, and not spend (waste!?) time creating, debugging and tweaking our own test framework.

It works for us, because our API and test cases are very typical, so Postman's features cover it well.

2
  • have you automated the tests ? do you have automated validations of the status code, values in response body, passing parameters from one test to another ?
    – Arthur M.
    Commented Sep 17, 2017 at 15:44
  • We just run a series of tests, no parameter passing etc. Maybe Postman can do this, but I am not sure.
    – timfredo
    Commented Sep 18, 2017 at 10:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.