Skip to content
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

Open
ivaylokenov opened this issue Dec 2, 2015 · 16 comments
Open

Make WithResponseTime more fluent #230

ivaylokenov opened this issue Dec 2, 2015 · 16 comments
Assignees

Comments

@ivaylokenov
Copy link
Owner

Currently the method can be called only after ShouldReturnHttpResponseMessage

@ivaylokenov ivaylokenov self-assigned this Dec 2, 2015
@ivaylokenov ivaylokenov added this to the Far in the future milestone Dec 2, 2015
@tdbgautham
Copy link

@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?.

@tdbgautham
Copy link

Example: My Web API is running in another server, I need to send request & get response from that server. Does this library supports it ?

@ivaylokenov
Copy link
Owner Author

@tdbgautham Can you please give me the integration test code and the errors you receive and I will take a look and fix it.

@ivaylokenov
Copy link
Owner Author

Also how do you start and setup the integration test code?

@ivaylokenov
Copy link
Owner Author

@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.

@tdbgautham
Copy link

@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
-> How to start a Remote server, is there a sample ?
-> What is Working(StartUp) ?

I cannot share my code has it owned by company. :( .

@ivaylokenov
Copy link
Owner Author

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?

@tdbgautham
Copy link

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-----
From: "Ivaylo Kenov" notifications@github.com
Sent: ‎04-‎12-‎2015 12:38
To: "ivaylokenov/MyTested.WebApi" MyTested.WebApi@noreply.github.com
Cc: "tdbgautham" tdbgauthamkumar@gmail.com
Subject: Re: [MyTested.WebApi] Make WithResponseTime more fluent (#230)

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?

Reply to this email directly or view it on GitHub.

@ivaylokenov
Copy link
Owner Author

@tdbgautham Implemented in version 1.1.8. You can update your package. More information here:
https://github.com/ivaylokenov/MyTested.WebApi/tree/master/documentation#remote-server

@tdbgautham
Copy link

@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.

@tdbgautham
Copy link

@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() . ?

@ivaylokenov
Copy link
Owner Author

@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?

@tdbgautham
Copy link

@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.

@ivaylokenov
Copy link
Owner Author

@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?

@tdbgautham
Copy link

@ivaylokenov Ok. How can we set global handler for remote server integration testing ?

@ivaylokenov
Copy link
Owner Author

@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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants