Chakram is an API testing framework built on node.js designed to perform end to end tests on JSON REST endpoints.
Questions tagged [chakram]
15 questions
27
votes
4 answers
TypeError: expect(...).to.startsWith is not a function - chai and chakram
I started writing some automation tests(API)
Now I tried to do to this endpoint:
https://dog.ceo/api/breeds/image/random
so I added into my function
expect(response.body.message).to.startsWith('https://images.dog.ceo/breeds/');
and at the…

Justyna J
- 303
- 1
- 3
- 8
2
votes
1 answer
How to modularise function in Chakram to get values
I have an API that returns data in this format -
{
"data": [
{
"id": 121,
"id_type": "some string",
"id_value": "test",
"attribute1": {
"attr_id": 140,
"attribute_client_id": null,
…

demouser123
- 4,108
- 9
- 50
- 82
1
vote
2 answers
Finding entries with duplicate values in an array inside a JSON Object returned from an API
I have an API which has a response like this
{conditions:{,…}
individuals:[{employee_id: 12300, employee_type: "Permanent", person_id: "1211211", full_name: "John Jacobs",…},…]
page_num:5
rows:10
total_count:213}
Each entry inside the individuals…

demouser123
- 4,108
- 9
- 50
- 82
1
vote
1 answer
Unable to expect status in chakram when using .then in before()
I am using chakram to test API and whenever I am using a .then in a before(), I always get an error when testing the "it". I am not sure what I am doing wrong but I expect it has something to do with my returns.
describe('create group', function()…

ultima-forsan
- 9
- 3
1
vote
3 answers
Match elements of an array from a JSON Array of Objects using Chai
Let's say I have an array
let array_of_string = ['John','Jack','Smith','Ryan'];
How can I assert that these keys are included in JSON array of objects where the JSON is something like this
[ {
"person_name": "Jake",
"person_id": '1234',
…

demouser123
- 4,108
- 9
- 50
- 82
1
vote
2 answers
Undefined response returned by Chakram requests
I'm facing a strange problem in my automated tests written using Protractor. We need to test a bunch of API endpoints that return JSON over HTTP, as opposed to actual websites so instead of relying on Protractor, my team decided to use Chakram.
I…

toniedzwiedz
- 17,895
- 9
- 86
- 131
0
votes
1 answer
Asynchronous function works with Postman but not while testing
I have got a function that based on services fetches their time and sums it up. Services need to be fetched from mongoDb database first, so I have written a function that is async
function that fetches time from services
const getTotalVisitsTime =…

janlan
- 477
- 1
- 5
- 19
0
votes
1 answer
Correct way to do async calls to get test data from REST end points inside Protractor?
We are doing end to end UI testing using Protractor and using Jasmine as BDD framework. We need text of UI to be validated against the data from REST API, for which we are using Axios!!
Is this the right approach?
Sample code is mentioned…

Honey Thakuria
- 223
- 3
- 16
0
votes
1 answer
Chakram test not working
I was looking for a new framework and I came across, with chakram, now I trying to do the following test:
Make an api call (get) and this returns an array of elements which I need to iterate and use it's Id to make another api call and then assert…

elcharrua
- 1,582
- 6
- 30
- 50
0
votes
4 answers
Fetching records from inside a JSON Object inside an Array
I have an API response coming in this format.
[{
"response_data": {
"0":{
"id" : 0,
"office" : "India",
"type" : 'Perm'
},
"1":{
id : 0,
"office" : "America",
"type" : 'Perm'
},
"2":{
id : 0,
…

demouser123
- 4,108
- 9
- 50
- 82
0
votes
2 answers
Incorrect Array length and array element when saving a JSON object key
I have an API with a JSON Array of objects response like this
[
{
person_id:"12212",
person_name:"some name",
deptt : "dept-1"
},
{
person_id: "12211",
person_name: "some name 2"
deptt : "dept-2"
},
]
I…

demouser123
- 4,108
- 9
- 50
- 82
0
votes
2 answers
How to export a variable from inside a Mocha describe block
I am currently using Chakram API Testing framework to test some REST API endpoints.
The first API gets a CSRF token which is used in the rest of the endpoints in the headers.
The CSRF API returns a JSON object - something like this
{
csrf_token :…

demouser123
- 4,108
- 9
- 50
- 82
0
votes
1 answer
How to assert a header contains specific value in Chakram
I have an API which has a response header of Keep-Alive with the following values
Keep-Alive →timeout=15, max=100
I want to assert that the values timeout is at least 10 and at most 100. Earlier I was using Postman BDD library and had this code
let…

demouser123
- 4,108
- 9
- 50
- 82
0
votes
1 answer
Run a mocha test with multiple js files and generate separate JSON reports
I have several mocha & chakram test case files, located on current directory:
test1.js
test2.js
test3.js
..and so on
I want to run a mocha test sequentially and generate a JSON reports for every test case.
What I want
Test1.json (result of…

user2018
- 310
- 2
- 7
- 21
0
votes
1 answer
How to execute multiple API calls using chakram and mocha?
I'm using mocha as a test framework, and chakram for API calls.
I have an array of objects, I want to loop over them and POST each one to an API, how can I do this? What I've tried so far doesn't give any output from the each iteration.
This is what…

Jimmy
- 16,123
- 39
- 133
- 213