You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ultimately we want to be able to use Bruno to compare two different databases and ensure they align with each other when API calls are made against them.
So as an experiment I built out a very simple API call to the SAME database and am storing those in environment variables.
Post response script for the first call:
////Output Response body contents
let thisVar = res.body.data;
// Variables and JSON Keys are case sensitiv!
console.log("Setting Response A");
bru.setEnvVar("responseA", thisVar);
//Output Response body contents
console.log(bru.getEnvVar("responseA"));
Post Response script for the second call, which then rolls into the post-processing logic:
////Output Response body contents
let thisVar = res.body.data;
// Variables and JSON Keys are case sensitiv!
console.log("Setting Response B");
bru.setEnvVar("responseB", thisVar);
//Output Response body contents
console.log("First Section Response");
let RespA = bru.getEnvVar("responseA")
console.log({RespA});
console.log("Second Section Response");
let RespB = bru.getEnvVar("responseA")
console.log({RespB});
//Compare the two
if ({RespA} == {RespB}) {
console.log("Elements Match");
} else {
console.log("Elements DO NOT Match");
}
When I run the script, the console output indicates that the values of the two environment variables are matching; however it's falling into the logic section for a mismatch.
New to Bruno, and a tad rusty on my JavaScript, but everything looks correct, is there a better way to do these comparisons with the understanding that the number of columns being compared could reach near 100, making it impractical to check each column result one by one unless I absolutely have to?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Ultimately we want to be able to use Bruno to compare two different databases and ensure they align with each other when API calls are made against them.
So as an experiment I built out a very simple API call to the SAME database and am storing those in environment variables.
Post response script for the first call:
Post Response script for the second call, which then rolls into the post-processing logic:
When I run the script, the console output indicates that the values of the two environment variables are matching; however it's falling into the logic section for a mismatch.
New to Bruno, and a tad rusty on my JavaScript, but everything looks correct, is there a better way to do these comparisons with the understanding that the number of columns being compared could reach near 100, making it impractical to check each column result one by one unless I absolutely have to?
Beta Was this translation helpful? Give feedback.
All reactions