misMatchThreshold Value
The usage information doesn't provide a context for this value. Is it a percentage?
@grayloon Hi, thanks for posting. I have gotten a lot of requests for this -- it's a good question.
The raw value comes from here:
https://github.com/Huddle/Resemble.js/blob/af57cb2f4edfbe718d24b350b2be1d956b764298/resemble.js#L495
(mismatchCount / (height*width) * 100)
Hope that helps!
Hi @garris
In my config file I have misMatchThreshold = 15.00
A URL that failed shows this in the log:
compare | ERROR { size: isDifferent, content: 3.97%, threshold: 15% }
The HTML report shows this for that page:
misMatchPercentage": "3.97"
The way I interpret this is that the page had a 3.97% difference. But shouldn't the difference be 15%+ before it fails?
@robertloo hi, thanks for posting. It looks like you have a size = "isDifferent" in your result.
This will cause a fail regardless of your threshold.
Please check the browser report -- you will probably see a very distorted diff image. the test may be revealing an unintended size change?
@garris the DIFF image shows the footer slighting distorted. Everything else looks fine.
In my config file I set requireSameDimensions = false. Should that not have made it to ignore the dimension difference?
Here is another failed test with the HTML error report:
Report: {
"isSameDimensions": false,
"dimensionDifference": {
"width": 0,
"height": -33
},
"misMatchPercentage": "6.58",
"getDiffImage": null
}
Threshold: 1
I still have my misMatchThreshold at 15.00 in the config file. Here it says it is 1. Maybe my threshold value is not being passed?
Yes, you're doing everything right. That feature, requireSameDimentions was just added and in fact, is not yet in @latest.
Try installing canary...
npm install -g backstopjs@canary
Sorry in advance if canary has any issues. I didn't have a chance to check on the last push.
That feature was added for exactly this situation. Please let me know if it addresses your issue.
Thanks!
I installed canary. I think this is working better. I constantly get good test runs (12 pages/test). But every so often I get one with a failing page, like this:
Report: {
"isSameDimensions": false,
"dimensionDifference": {
"width": 0,
"height": -6
},
"misMatchPercentage": "1.83",
"getDiffImage": null
}
Threshold: 1
Log
compare | ERROR { requireSameDimensions: false size: isDifferent, content: 1.83%, threshold: 15% }
Are you saying you get different results when running backstop test multiple times without making changes?
Correct. I'm using a decent connection. Here are more of my settings:
var selectors = ["document"];
var delay = 3000;
var misMatchThreshold = 15.00;
var requireSameDimensions = false;
viewports: [
{
name: "desktop",
width: 1500,
height: 1200
}
],
engine: "phantomjs",
My guess is phantomjs does not handle large displays well consistently. I was hoping to mitigate that inconstancy with a high misMatchThreshold. I could raise it higher. But fear that might start giving me false negatives.
It'd be useful to get an output log for a successful test and then one for a failing test. Also, a couple of screenshots from each test. @robertloo
Try testing smaller regions using selectors. Also, check for Ajax content and or animations that are still running during your test. That is usually the issue.
@jtuds the console log of a successful test of that failing test mentioned above shows this:
compare | OK: <url...>
@garris I think Ajax might be the cause. Putting that aside though, I would expect the misMatchPercentage to be over 15% on a failing test. I don't mind getting fail tests like this every so often. I'm going to try 20% threshold and see if that helps.
Thanks for the awesome project! :)
@robertloo I am concerned because it sounds like "isSameDimensions": false is still triggering a false negative? I am not clear if this is true or if installing @canary fixed this issue? Could you let me know? Thanks!
If possible. I would try run some tests on an isolated, very small and single scenario. Then repeat it a few times and see if you get any false negatives. If you are getting false negatives on a very small, simple HTML page with no Javascript or styling then this could be an issue with the functionality rather than your use case. @robertloo
I created two empty tables
Table A (reference) height: 50%; width: 50%;
Table B (test) height: 80%; width: 80%;
Config settings var misMatchThreshold = 15.00; var requireSameDimensions = false;
Log report
compare | ERROR { requireSameDimensions: false size: isDifferent, content: 22.44%, threshold: 15% }:
HTML report

Table B (TEST) is proportionally bigger even though you can't see it here. So the dimension is different. But it is the same thing.
Your mismatch is over the threshold in this instance though, requireSameDimensions won't stop a test that is over the mismatch threshold from failing. What happens if you make it under the mismatch, say 14%, and then run the tests?
@jtuds Good point!
Here is another test. Same settings as before, except
var misMatchThreshold = 23.00;
Log report
compare | ERROR { requireSameDimensions: false size: isDifferent, content: 22.44%, threshold: 23% }:
HTML report

Hm, this looks like it may be a bug. I see you are setting your options with variables, e.g. var misMatchThreshold = 23. How are you passing these to the Backstop config file/s?
I'm running my config as a node module using --configPath
Ok, this sounds like it is a bug and needs looking at. @garris If you agree, can you reopen this issue?
Thank you for working on this!