2

We have so many API's(5 to 8 API calls - Mostly REST based and 1 or 2 in SOAP based) and Oracle DB. We do not have any WEB UI. No UI automation.Only middle tier and backend automation. For automation of multiple REST API's, accessing Oracle DB tables/stored procedures, What are the best possible ways for effective BDD and ATDD Test Automation using C#

I'm looking combination of these..

NUnit and Specflow and RestSharp and Selenium with/without Page object model using C#

NUnit -> I want to use parallel test methods execution/calling with Priorities using C# similar to TestNG in Java.

//Arrange
//Act
//Assert

or

//SetUp
//Act
//Assert
//TearDown

Specflow -> Gherkin based [Given When And Then] for Behavior driven with Feature files

RestSharp -> Handling REST API request and response asynchronously using async and wait

Selenium -> Thinking to use webdriver for Rest API's/DB interactions along with Specflow and Nunit C#. Currently No Web UI.

PageObjectModel -> Use of PageFactory/Page objects [I think this pattern not required]

Which pattern is feasible or best to fit above my requirement. No Web UI.

Help me the ways or pointers to beginning with automation from ground scratch using C#.

1

You seem good to go with some service testing.

NUnit -> I want to use parallel test methods execution/calling with Priorities using C# similar to TestNG in Java.

//Arrange

//Act

//Assert

or

//SetUp

//Act

//Assert

//TearDown

Both ideas are actually the same. Arrange is a Setup + Teardown.

Specflow -> Gherkin based [Given When And Then] for Behavior driven with Feature files

It's a way to document your checks, although it can become cumbersome. Usually, service testing is pretty much self-explanatory.

RestSharp -> Handling REST API request and response asynchronously using async and wait

Yep - RestSharp's goal is exactly this. If you create the right boundaries and abstractions, you will be able to simply inject the dependency to RestSharp - enabling you to change to another library if you decide to do so.

Selenium -> Thinking to use webdriver for Rest API's/DB interactions along with Specflow and Nunit C#. Currently No Web UI.

Selenium is not meant to interact with services, but with browsers.

PageObjectModel -> Use of PageFactory/Page objects [I think this pattern not required]

POMs are meant to abstract graphical interfaces - not a case in this product.

  • BDD based Service testing with usage of Nunit, I'm not getting which one to use first. How to begin? Is it first do i need to create specflow solution or Nunit solution or class library solution and add Nunit and Specflow?? I need a direction to work with Nunit, specflow Restsharp, DB testing C# with very simple neat structured way with more abstraction and encapsulation and good OOP methodology and any good design pattern if required. Also why Dependency Injection required for automation? I'm not using Model -View-Controller(MVC) here. – venkat Nov 11 at 19:14
  • For Automation tester perspective please guide me to start with framework building and base class methods etc. Any references/links/Best practices for easy for ground scratch for Test automation with BDD and ATDD really helps for the above requirement – venkat Nov 11 at 19:14
0

I agree that you don't need Selenium.

Instead of a Page Object Pattern, you want to model your request and response objects as classes. RestSharp has dependencies on JSON serializer and deserializer classes, so you set up things like Customer customer = response.Convert<CustomerResponseObject>();, and your object hold the object structure.

João's comment about dependency injection is a sensible one - what he means is that you create two layers: one is an interface that the rest of your code calls, and the other is the interaction with RestSharp itself. This means that if you ever need to replace RestSharp, you only need to modify the base layer. (there's a good explanation in the answers to this StackOverflow question)

To interact with the database, I'd suggest looking for a good database helper extension - there are sure to be any number of them, so any that suit your needs should work. If you structure your object classes so that any responses containing one or more business objects are set up with the response object containing a list of business objects, you can then use your database lookups for a direct or near-direct comparison when you check whether the API returned the correct data (or inserted the correct data).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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