Hi there,
I am new to C# and Ranorex and want to do something seemingly very simple but not quite sure how to go about doing it.
I want to hit an API endpoint before I start each test, as this will ensure the application is in the correct state for the test to take place. I just want this to be an action I can pass a variable to at the start of a test module, which will complete before moving on to the next test step.
I have written some very simple verification methods as "user code" in Ranorex before so am familiar with how to add user code methods in their simplest form.
Thanks in advance for your help.
Simple HTTP Requests in Code
- RobinHood42
- Posts: 324
- Joined: Fri Jan 09, 2015 3:24 pm
Re: Simple HTTP Requests in Code
Hi lukeclewlow
I'm would suggest to check out the following articles:
Cheers,
Robin
I'm would suggest to check out the following articles:
Cheers,
Robin
Re: Simple HTTP Requests in Code
Well there isn't much else than to just understand a C# HTTP request and handle the response. There are loads of materials on these topics.
From the response you could either fail or succeed the test and have correct Error behaviour set up to either continue or stop the test flow.
So basically, just make the request, capture the response and from the response either fail or succeed the test.
If the API actually works on WSDL level, you could create a web reference out of it and have the functionality inside of the test suit for other test case use as well.
But try to understand first how C# handles HTTP requests and responses.
From the response you could either fail or succeed the test and have correct Error behaviour set up to either continue or stop the test flow.
So basically, just make the request, capture the response and from the response either fail or succeed the test.
If the API actually works on WSDL level, you could create a web reference out of it and have the functionality inside of the test suit for other test case use as well.
But try to understand first how C# handles HTTP requests and responses.