I need to automate my web application functionality using rest assured.
Means there are no endpoints to verify the functionality of login module on the homepage and I need to automate same login Page functionality using Rest Assured.
Please, anyone, tell me to know the solution of my this query.
Rest-Assured is just a REST testing tool, you can't use it to perform UI functional testing.
You should use one of the tools dedicated to that, like Selenium.
The best way to go is to split your testing in two separate projects.
Backend functional testing with Rest-Assured (Making REST calls).
Frontend functional testing with Selenium (Using Selenium).
Related
I am asked to choose one and the best from these two for unit and integration tests-
1. RestAssured
2. Mockmvc
The application is in Spring and Spring Boot. I have read many blogs and no clear distinction is given or I couldn't find one. For rest assured, its neat and clean code and BDD style that makes it more readable. But doesn't sound a convincing point. Some of the tests are written using Mockmvc and I am trying to write the same in RestAssured to compare the same.
I know this may sound a theoretical question but I am unable to get points in favor of one and suggest which one is better and why. Looks like a choice of flavor to me. Any views and suggestions?
You would choose MockMvc for web layer testing. These tests will allow you to validate your controller classes properly handle respective HTTP requests. Since these are practically fine grained controller unit tests, you can additionally include them as part of your apps’ code coverage percentage with tools like JaCoCo. On a side note, these tests will likely run faster than integration tests since they won’t require the web server to run on.
RestAssured is used for integration testing in your Spring Boot app. When it comes to RESTful based API integration testing and validation, RestAssured offers convenient methods to create and execute your HTTP calls with custom headers, auth, content types, query parameters, payload content, cookies, etc.
To aid your comparison check out this article - Testing Spring Boot RESTful APIs using MockMvc/Mockito, Test RestTemplate and RestAssured - it has a good explanation and robust examples on the usage for RestAssured and MockMvc.
The application is using Minitest on Rails 4 with Capybara.
I'd like to write an integration or feature test that stubs a websocket connection (the application uses Faye as a client) to return a specific message (like I'm used to doing with Webmock).
Is this possible? If so, can you provide an example? My research has not turned up any examples.
Your research hasn't shown up any examples because it's not really what you're supposed to be doing in feature tests. Feature tests are supposed to be end-to-end black box tests where you configure the data as required for the app to generate the desired results and then all interaction is done via the browser (no mocking/stubbing which technically alter your apps code). Additionally when connections between the browser and a 3rd party service are involved there is nowhere in your app where you can mock it.
It may be possible to stub a websocket connection from the browser with a programmable proxy like puffing-billy, however it's generally cleaner to produce a small fake version of the 3rd party service for testing purposes (sinatra app, etc) and point the browser at that rather than the original service when you need to craft custom responses. Additionally, there are a lot of fakes already out there, depending on what service you are using (fake-stripe, fake-s3, etc), which may provide the functionality you're looking for.
I have a quiz tool and I want to see how can I test this for 100 simultaneous users. This quiz tool have JS for its front-end and the JS is calling RESTful API.
I have some tests running on for trivial stuffs like login in Nightwatch.js for my web application but the question is how it can guarantee a number of simultaneous users?
As far as I'm aware none of the load testing tools will execute JavaScript, so the options are in:
If you need to simulate load directly on front-end and check rendering speed as well as REST backend performance you should go for browser-based testing using i..e Selenium Grid
If you think that simulating the load on REST backend will be enough you can simulate the load using i.e. SoapUI or Apache JMeter.
Personally I would combine above approaches i.e. created the main load with SoapUI or Apache JMeter and checked JS frontend client-side performance either manually using something like YSlow or in automated manner using Selenium depending on if there is an adhoc activity or something which will be executed on the regular basis.
I am developing in a micro services architecture, currently each service is developed in ruby.
One of the advantages of decoupling services is a future ability to refactor a service from ruby to another technology, let's say Node.js
When I will do this refactor some time in future, I would want my integration tests to keep functioning.
Ideally, I would want to develop the integration tests in rspec (ruby), and to keep them functioning on a non-rails server via HTTP.
Is that possible with rspec?
Which tool can provide this requirement?
RSpec is a behavior-driven development (BDD) framework for the Ruby programming language. It is used for unit testing. It can;t be integrated with another tech stack
However, If it is all about doing the integration testing for your web services, I think Cucumber is something that will help you to achieve the same.
Cucumber as a tool is technology agnostic. However, you will have to design your integration tests in such a way that any helper libraries to execute or write the testcases could be easily replaced with the libraries of other language when you are changing you tech. stack for the webservices/test cases.
As long as you test the endpoints exposed by the webservice and not how they are implemented , they should keep functioning.
You could achieve that by writing your integration tests in spock which is a beautiful BDD framework in groovy, using that you can hit the endpoints like
GET /cars ---> Check for the list of cars
POST /cars ---> Add a car
GET /cars/1 ---> Get a specific car details
PUT /cars/1 ---> Edit a specific car
Now when you are testing like this, it doesn't matter what the implementation is coz you are always testing the interface.
I am building a REST Web Service layer on top of a Rails app that will be used by an Iphone application. The response format is XML.
I would like to build some acceptance tests that should be external to the rails stack (and should test everything, including the http server). The test scenarios are quite complex, involving the process of searching/posting/reviewing an order. What would be the best solution to accomplish this?
a. Ruby script using curl/curb to fetch the request and Hpricot to parse the request
b. Selenium
c. ..
It would also be nice that those tests could be used as integration tests (therefore, run on every git commit). What integration solution would you recommend?
a. Integrity
b. CruiseControl
c. something else
I've used three approaches over this last few years
Active-resource
I found this to be too concerned with looking like active-record to be a great solution. In some cases I had to patch parts of it to work as I'd like a REST client to behave.
Rest-client
This gem is very good - well documented and does works as expected. I combined this with my own simple DSL and it's worked out better than a generic testing framework
XML over HTTP
I use this for performance testing. Very flexible but the learning curve is higher than Rest-client. If you go down this approach you could use the Net::HTTP core class or the HTTParty gem (I haven't tried this but it looks great>
A really good resource is this Net::HTTP cheat-sheet
For ad-hoc testing I've also found the Rest Client add-in for Firefox very useful.
Use selenium-rc in ruby mode and you'll be a happy camper. Webrat/Cucumber already do this for you so you can just put that in a second project and run the tests that way, all you'll have to do is override the host (so instead of localhost you'll be using your domain).
As to CI I'm afraid I don't know the best one.
you can't possibly mean mks integrity...if so, the answer is anything but. CC is a good CI tool. really good.