Home > Software engineering >  How to communicate batch project with Api project?
How to communicate batch project with Api project?

Time:12-01

I have two projects first one is called api project to launch a REST api webServices and the other project is batch project that is responsible to execute batchs.

How can make the batch project execute a rest api that exist in the api project?

CodePudding user response:

Using newman utility from Postman for REST API batch project.

'newman` is Javascript utility. it can be use when production.

postman is UI based API testing utility when you develop a test logic.

Installing and running of enter image description here

This test logic

#1 Check response code

#2 Check number of users

#3 Check User name/email and address

pm.test("Status code is 200", function () {
  pm.response.to.have.status(200);
});

pm.test('Check the number of users', () => {
    pm.expect(pm.response.json().length).to.equal(10);
});

let user = pm.response.json().find(a => a.username === 'Bret');

pm.test('Check the email of Bret', () => {
    pm.expect(user.email).to.equal("[email protected]");
});

pm.test('Check the name of Bret', () => {
    pm.expect(user.name).to.equal("Leanne Graham");
});

pm.test('Check the address of Bret', () => {
    pm.expect(user.address.street).to.equal("Kulas Light");
});

running collection in Postman

it can filter test items and number of loop

enter image description here

Shows whole test steps and processing time enter image description here

Also can debug in console view. you can put console.log message. enter image description here

  • Related