Closed agrover8 closed 9 years ago
What is your problem?
@cybertk In my hook file, I have provided two different cases for resource 'GET /org/15602/activity/{activityid} -> 200'
Both the cases have incorrect activityid, so I am expecting these test cases should be fail.
But when I am running the following command all the test passed. $ abao origin_new.raml https://test.com/ssvui --hookfiles=hook.coffee
So to debug this I just ran the raml file without hook file: $ abao origin_new.raml https://test.com/ssvui
Result of the above command is also same as the first command, so its look like abao is not reading hook file. Though it says: Found Hookfiles: hook.coffee
Please let me know if you need more information.
You can define only one test for each case(response code) in Abao. So for your case, you defined two tests/hooks for GET /org/15602/activity/{activityid} -> 200
, only one is used and the other one is ignored.
If you want test the error case of your API, you should define it in your RAML. e.g. Your API will response 400 if activityid
is not a number with
responses:
200:
...
400:
...
I think Abao should print a warning message for your case, what's your advice?
@cybertk
For example, I have one resource GET /org/15602/activity/{activityid} -> 200, and I want to test this resource with 3 different activityid where the response code for all 3 cases is 200.
GET /j_spring_security_check -> 302
.@cybertk If we can define only one test for each case(response code) in Abao. So the test mentioned in the Hook file run for that particular resuource, right? Example: RAML file has activityid 12345* for GET /org/15602/activity/{activityid} -> 200 and Hook file has activityid 567* for GET /org/15602/activity/{activityid} -> 200
Abao test will run with activityid 567*\ (Hook file), is that correct?
Correct.
@agrover8 I have an idea for your condition, test multiple test cases for one case. You can write multiple hooks, then run Abao multiple times with different hook.
Such as,
$ abao origin_new.raml https://test.com/ssvui --hookfiles=hook1.coffee
$ abao origin_new.raml https://test.com/ssvui --hookfiles=hook2.coffee
$ abao origin_new.raml https://test.com/ssvui --hookfiles=hook3.coffee
You can open a feature request either, we will implement it in future.
@cybertk Can we pass request data from external file to hook file, like in RAML we can !include example.sample? Instead of passing request data in hook file I want to pass reference of the external file.
Yes, you can. Hook file is just a normal javascript/coffeescript source file, you can do whatever you want.
@cybertk There are some instances where we need to pass the response data from one resource to request data, query parameters, uriParameters to other resource, is that possible in ABAO?
Yes. Do whatever javascript can do
Filed #35 for multi test case.
I had some working example going of parameter passing using some global context variable to define things.
Something roughly like...
context = {}
after < test 1 > ... context.example.id = test.response.body.example.id
before < test 2 > ... test.request.query.id = context.example.id
@agrover8 is your hook file working now?
@cybertk @jekhardt Yes, hook file is working now. I am closing this issue.
Hi,
I have created hook coffee script which looks like abao is not reading.
My RAML File look like:
Hook file:
Can anyone help me on this?