-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make WithResponseTime more fluent #230
Comments
@ivaylokenov : Thankq , But am trying to use it in my Integration Testing. I get errors. Can we achieve Integration testing from Remote server using this library?. |
Example: My Web API is running in another server, I need to send request & get response from that server. Does this library supports it ? |
@tdbgautham Can you please give me the integration test code and the errors you receive and I will take a look and fix it. |
Also how do you start and setup the integration test code? |
@tdbgautham I tested locally and it fails here too because currently the server is started in memory but it will be easy feature to add. Will update the library tomorrow. |
@ivaylokenov Yes, i need to know . How to Start & Setup too . I used Global Configuration. If there is a sample webapi project & respective test case for that webapi will helpful. I have concerns on these I cannot share my code has it owned by company. :( . |
Most probably you are starting local server with your configuration. There is sample integration testing here, but the server is local: https://github.com/ivaylokenov/MyTested.WebApi/blob/master/samples/Source%20Control%20System%20API/Tests/SourceControlSystem.Api.Tests/IntegrationTests/CommitsIntegrationTests.cs Will add remote server testing by providing only the base URL address. Should that be ok? |
Yes.That will be helpful. An test case which connects to remote server and does api call and fr that what will be Response time. -----Original Message----- Most probably you are starting local server with your configuration. There is sample integration testing here, but the server is local: https://github.com/ivaylokenov/MyTested.WebApi/blob/master/samples/Source%20Control%20System%20API/Tests/SourceControlSystem.Api.Tests/IntegrationTests/CommitsIntegrationTests.cs |
@tdbgautham Implemented in version 1.1.8. You can update your package. More information here: |
@ivaylokenov I am able to connect Remotely. But i am not able to provide handler to the remotely accessible server. Included changes for Handler for remoter server. Its working now. Thank you. |
@ivaylokenov I have one concern on Dispose,. When we do Integration testing, we call many API based on scenario. When i tried that way, it disposes MyWebApi class for single API call. So again i need to do Set-Up. Why can't we dispose this link in server().STOP() . ? |
@tdbgautham You should do it the following way: // first run this
MyWebApi.Server().IsLocatedAt("http://myremoteurl.com");
// then how many you want of these
MyWebApi
.Server()
.WorkingRemotely() // working remotely will use the globally set base address
.WithHttpRequestMessage(req => req.WithMethod(HttpMethod.Get))
.ShouldReturnHttpResponseMessage()
.WithStatusCode(HttpStatusCode.OK); Any problems with that? What is your setup code? Can you give a sample or your usage? |
@ivaylokenov tried as mentioned above, but i need to set Handler in Remote server for my request. I tried to set as GlobalClient in your library by including handler, but its getting disposed. MyWebApi.Server().IsLocatedAt("http://localhost/", handler); Tried this way. I am able to get Handler for 1st request, but second request again i need to set the handler. I dont know why. |
@tdbgautham Will take a look. Can you give some sort of code sample what are you trying to do because I am kind of guessing your problem? |
@ivaylokenov Ok. How can we set global handler for remote server integration testing ? |
@tdbgautham Ususally you do not need to set the handler. Can you write a small code sample and add it to pastebin so that I can see what you are trying to accomplish and guide you to a solution? |
Currently the method can be called only after ShouldReturnHttpResponseMessage
The text was updated successfully, but these errors were encountered: