Giter Club home page Giter Club logo

restassured.net's People

Contributors

d-saravanan avatar lamchakchan avatar ndamdul avatar robertsandu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

restassured.net's Issues

How to fetch complete Json string from Retrieve method when no root element is provided

Suppose we have response json like below, we want to get complete json to deserialize into dictionary(collection) inorder to verify from database but .Retrieve(x=> x) is crashing.

{
"customerId": "12345",
"title": "GitHub",
"Address": {
"City": "NYC",
"Zip": "11223344"
},
"alias": {
"type": "ContactNumber",
"value": "12345678910"
},
"Membership": "Individual"
}

Add Query()

Add a Query() function like Param() to feed key/value pairs. Currently, Param is overloaded and we want more intent. Param feeds into the body and Query feeds to the query string.

AssertAll validates response schema even when not requested for .

Hi,

I'm trying to perform multiple assertions with TestStatus and TestBody without schema validation. From what I have observed AssertAll() always validates schema, which I think it should not be.

Below test is present in MockResponseContextWithJson.cs

  [Test]
    public void AllowMultipleWithoutSchemaAssertion()
    {
        _responseWithObject
            .TestStatus("first", code => code == 200)
            .TestBody("second", body => body.id != null)
            .AssertAll();
    } 

(Based on name of this test I assume AssertAll() performs multiple assertions without schema assertion)

When we have a sample test with below assertions

            .TestStatus("first", code => code == 200)
            .TestBody("second", body => body.id != null)
            .WriteAssertions()
            .AssertAll();

Output shows that schema assertion is always perfromed as part of AssertAll().

Can anyone please correct me if I am wrong and let me know how to bypass schema validation as part of AssertAll()?

Thank you!

Questions about RestAssured.Net

Thanks for this project. I sent an email, but no answer, so turning to the community.

I have some questions about it. Is it actively maintained? Is it designed to keep up with all features of the Java version, or does it go its own way? Is it a must when testing a .NET API, or is it possible to integrate the Java version too? I'm thinking about things like creation and destruction of the test database.

Auth

Is it possible to send authorization bearer token ?
Should it go on Header or as Param ? Thanks.

Implement support for multiple Query params with same name

In REST it's common to have query string params with same name, to get multiple values added to 1 variable, example:
myservice.com?param=value1&param=value2

But with RestAssured.Net the .Query(key, value) method is using Dictionary and adds only 1st query param with that name, others are ignored.

Please implement support for providing multiple values.
Possible syntax:

.Query("param", "value1").Query("param", "value2")

OR

.Query("param", "value1", "value2")

RestAssured.Net with Specflow

Hi,

Recently, I have tried integrating specflow with restassured, however it seems that there are some threading issue, when a step definition is being executed the thread where restassured gets executed is different from the step defintion thread, therefore the restassured request will never complete and will keeps looping forever.

When executing restassured request using normal unit test framework, it works fine as it shares the same thread as the test execution.

Any one experiencing this issue before? or workaround?

Passing httpClient

Hi all,

Is it possible to pass a HttpClient instance to the SetupContext in order to use TestServer middleware?

Something like this:

  _testServer = new TestServer(new WebHostBuilder()
                .UseStartup<Startup>()
            _httpClient = _testServer.CreateClient();


  public void MyTest()
  {
          var test= new RestAssured()    
                .Given()               
                    .HttpClient(_httpClient)                                      

Thx

What is the namespace for import

I am using the library, however it is not clear in the documentation which is nameSapace that must be imported in the using to be able to use the library in my class.

Not able to install packages with .NetFramework 4.5.1 or 4.5.2

Getting "Could not install package 'RestAssured 1.0.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.5.2', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author." error when trying to install RestAssured 1.0.0

.Body() only serialises to json objects and doesn't support other types such as binary files

I require the ability to submit binary files as part of a request body for testing.

I can't use .File() because this converts the request to a multipart/form - which my server does not expect.

The current implementation of Body() in RA/src/SetupContext.cs line 159 uses JsonConvert.Deserialize() but I need a way to prevent it from converting everything to json and use the correct serializer for whatever I pass in.

@DayneD89 - I know you're working on this at the moment, could you possibly look into this?

Thanks.

Breaking up a call chain example is obselete in README file

        var endpoint1 = new RestAssured()

.Given()
//Optional, set the name of this suite
.Name("JsonIP Test Suite")
//Optional, set the header parameters.
//Defaults will be set to application/json if none is given
.Header("Content-Type", "application/json")
.Header("Accept-Encoding", "gzip,deflate")
.Host("jsonip.com")
.Uri("/endpoint1");

        endpoint1.When().Get().Then().TestBody("test 1", x => x.ip != null).Assert("test 1");

is not compiling and giving me error System.Exception : (application/json; charset=utf-8) not supported

Same for the below modified code from example:
var endpoint1 = new RestAssured()
.Given()
//Optional, set the name of this suite
.Name("JsonIP Test Suite")
//Optional, set the header parameters.
//Defaults will be set to application/json if none is given
.Header("Content-Type", "application/json")
.Header("Accept-Encoding", "gzip,deflate")
.Host("jsonip.com")
.Uri("/endpoint1");

        //Make a copy of the settings from above, but adjust the endpoint.
        var endpoint2 = endpoint1.Clone().Uri("/endpoint2");

        //Do a GET action with the first endpoint configuration
        endpoint2.When().Get().Then().TestBody("test 1", x => x.id != null).Assert("test 1");

        //Do a POST action with the second endpoint configuration
        endpoint2.When().Post().Then().TestBody("test 1", x => x.id != null).Assert("test 1");

Cant hit localhost

For some reason, I am unable to hit a localhost address. To replicate this I am hosting http://jsonplaceholder.typicode.com/ locally on port 3000 and I can confirm that accessing this url through a web browser brings up the same information as using the site. For this example I'll be using the path /todos/1/.

int type = 2;
string uhost = (type == 1) 
    ? "https://jsonplaceholder.typicode.com"
     : "http://localhost";

new RestAssured()
    .Given()
        .Name("Localhost Test")
        .Port((type == 1) ? 80 : 3000)
    .When()
        .Get(uhost+"/todos/1")
    .Then()
        .TestStatus("test a", x => x == 200)
        .Assert("test a")
    .WriteAssertions();

When type is 1 this runs as expected, however, when I change it to 2 (localhost) it gets back a HTML page and a 404 (Thus it fails to parse as Content-Type is html, but I set a custom parser to just print the _content to the console for this content-type).

Localhost does work if I change this to;

new RestAssured()
    .Given()
        .Name("Localhost Test")
        .Port((type == 1) ? 80 : 3000)
        .Host(uhost)
    .When() 
        .Get("/todos/1")
    .Then()
        .TestStatus("test a", x => x == 200)
        .Assert("test a")
    .WriteAssertions();```

However, needing a workaround isn't elegant.

Only limited response-types work?

Doesn't seem to work with response types that are not application/json?
E.g. for returning a text/html or application/vnd.ms-excel, etc

Are there plans to add support, or is this project abandoned?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.