Closed kiranfractal closed 9 years ago
Any documentation on how to access new webapi's to create automation ?
Is the current API v2 is same as API v1?
Processing by Webapiv2Controller#run as JSON
Parameters: {"{ \"api_request\": { \"command\": \"CheckVersion\", \"option1\": \"dummy1\", \"value\": \"1.2.3\" }}"=>nil, "api_key"=>"oMPIgICN9KXsDhGgxfh", "object"=>"versions", "endpoint"=>"search"}
WARNING: Can't verify CSRF token authenticity
Completed 400 Bad Request in 4.8ms (Views: 0.3ms | ActiveRecord: 1.1ms)
Processing by Webapiv2Controller#run as JSON
Parameters: {"{ \"api_request\": { \"command\": \"CheckVersion\", \"option1\": \"dummy1\", \"value\": \"1.2.3\", \"api_key\": \"oMPIgICN9KXsDhGgxfh\" }}"=>nil, "object"=>"versions", "endpoint"=>"search"}
WARNING: Can't verify CSRF token authenticity
Completed 400 Bad Request in 1.6ms (Views: 0.3ms | ActiveRecord: 0.0ms)
Processing by WebapiController#run as XML
Parameters: {"<?xml version"=>"\"1.0\"?>
Started POST "/versions/search.json?api_key=oMPIgICN9KXsDhGgxfh" for 127.0.0.1 at 2014-12-29 10:53:35 +0000
ActionController::RoutingError (No route matches [POST] "/versions/search.json"):
vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.21/lib/action_dispatch/middleware/debug_exceptions.rb:21:in call' vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.21/lib/action_dispatch/middleware/show_exceptions.rb:56:in
call'
vendor/bundle/ruby/2.0.0/gems/railties-3.2.21/lib/rails/rack/logger.rb:32:in call_app' vendor/bundle/ruby/2.0.0/gems/railties-3.2.21/lib/rails/rack/logger.rb:18:in
call'
vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.21/lib/action_dispatch/middleware/request_id.rb:22:in call' vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/methodoverride.rb:21:in
call'
vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/runtime.rb:17:in call' vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.21/lib/active_support/cache/strategy/local_cache.rb:72:in
call'
vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/lock.rb:15:in call' vendor/bundle/ruby/2.0.0/gems/rack-cache-1.2/lib/rack/cache/context.rb:136:in
forward'
vendor/bundle/ruby/2.0.0/gems/rack-cache-1.2/lib/rack/cache/context.rb:143:in pass' vendor/bundle/ruby/2.0.0/gems/rack-cache-1.2/lib/rack/cache/context.rb:155:in
invalidate'
vendor/bundle/ruby/2.0.0/gems/rack-cache-1.2/lib/rack/cache/context.rb:71:in call!' vendor/bundle/ruby/2.0.0/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:in
call'
vendor/bundle/ruby/2.0.0/gems/railties-3.2.21/lib/rails/engine.rb:484:in call' vendor/bundle/ruby/2.0.0/gems/railties-3.2.21/lib/rails/application.rb:231:in
call'
vendor/bundle/ruby/2.0.0/gems/railties-3.2.21/lib/rails/railtie/configurable.rb:30:in method_missing' vendor/bundle/ruby/2.0.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:576:in
process_client'
vendor/bundle/ruby/2.0.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:670:in worker_loop' vendor/bundle/ruby/2.0.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:525:in
spawn_missing_workers'
vendor/bundle/ruby/2.0.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:140:in start' vendor/bundle/ruby/2.0.0/gems/unicorn-4.8.3/bin/unicorn_rails:209:in
<top (required)>'
vendor/bundle/ruby/2.0.0/bin/unicorn_rails:23:in load' vendor/bundle/ruby/2.0.0/bin/unicorn_rails:23:in
@kiranfractal for the v2 api the api_key is provided via the json post data not in the url. In your example you have provided the api_key both in the json data and the url unnecessarily.
There is no documentation for the v2 api yet. I opened issue #55 to address documentation more generally and once it is collectively decided how to proceed I will document the new web api.
In the meantime you can look at the unit tests for examples of v2 api usage https://github.com/msjit/testcasedb/tree/master/spec/webapi
@agramian thanks a lot for the clarification. I would like to use v2 api for automation and I have documentation of using v1 for automation. Please have a look at the below documentation which uses v1 api. http://news.testcasedb.com/wp-content/uploads/2012/05/automation_example1.pdf
I am looking for a sample automation script of using v2 api.
It would be great if you let me know how to use v2 api so that I can try using them for automation rather waiting for complete documentation.
How to run unit tests ? Is the below command is right ? Where will be the results stored ?
Run "bundle exec rspec” from the root testcasedb directory. The results are printed to the console output not stored.
I am getting rspec not found error as shown below.
$ bundle exec rspec
bundler: command not found: rspec
Install missing gem executables with bundle install
On Tue, Dec 30, 2014 at 11:14 PM, Abtin Gramian notifications@github.com wrote:
Run "bundle exec rspec” from the root testcasedb directory. The results are printed to the console output not stored.
— Reply to this email directly or view it on GitHub https://github.com/msjit/testcasedb/issues/64#issuecomment-68378196.
gem 'rspec-rails', '~> 3.0.0' is under test and development group.
I am running the app under production mode.
So it is not installed in my machine.
On Wed, Dec 31, 2014 at 10:29 AM, Kiran Patil kiran@fractalio.com wrote:
I am getting rspec not found error as shown below.
$ bundle exec rspec bundler: command not found: rspec Install missing gem executables with
bundle install
On Tue, Dec 30, 2014 at 11:14 PM, Abtin Gramian notifications@github.com wrote:
Run "bundle exec rspec” from the root testcasedb directory. The results are printed to the console output not stored.
— Reply to this email directly or view it on GitHub https://github.com/msjit/testcasedb/issues/64#issuecomment-68378196.
This is intended behavior. You do not want the test only items available in the production environment.
You need to start the rails server in development or test mode and make sure the test/development environment and databases have been properly set up.
I believe to run in development or test mode you must run the setup script without the -p flag to create the databases and then for the gems run the rake command with the proper RAILS_ENV.
script/setup
rake assets:precompile RAILS_ENV=development
You may also have to restart the rails server.
passenger start -a 0.0.0.0 -p 3000 -d -e development
Something different may have to be done now with the updated version of rails but I'm not sure.
@joffems, can we have a simple automation script using v2 webapi ?
@kirantpatil can you be more specific? What language and what are you trying to do? The v2 API provides very detailed error messages. Are you not able to even send and receive a request? You van even test it with a GUI tool like API kitchen.
@agramian, I need a simple script to as shown in http://news.testcasedb.com/wp-content/uploads/2012/05/automation_example1.pdf for testing GUI. I have no idea of how to access them and come up with a automated script.
I will check with API kitchen.
Thanks.
I would like to use ruby to automate.
First of all @kirantpatil let's go back to your first example.
If you look at https://github.com/msjit/testcasedb/blob/master/spec/webapi/versions_api_spec.rb you will find example usage of the versions endpoint.
Your code should be revised as follows and it should work.
contents of command.json:
{
"version": "1.2.3",
"api_key": "oMPIgICN9KXsDhGgxfh"
}
curl command to TestCaseDB v2 web api
curl -k --data-ascii @command.json https://178.79.180.79/api/versions/search.json
@agramian, yes now it worked. Thanks a lot.
Hi,
I am trying to check the webapi with json as below and it is giving me 404 error.
cat command.json :
{ "api_request": { "command": "CheckVersion", "option1": "dummy1", "value": "1.2.3", "api_key": "oMPIgICN9KXsDhGgxfh" } }
curl -k --data-ascii @command.json https://178.79.180.79/versions /search.json?api_key=oMPIgICN9KXsDhGgxfh
<!DOCTYPE html>
The page you requested cannot be found.
If you continue to experience issues with this page, please contact your system administrator.