Test a Django site displays the correct graph - image similarity? Test a Django site displays the correct graph - image similarity? selenium selenium

Test a Django site displays the correct graph - image similarity?


If you're dead set on doing image comparisons, you could try using opencv (see e.g. http://opencv-python-tutroals.readthedocs.org/en/latest/py_tutorials/py_imgproc/py_template_matching/py_template_matching.html). This, however, feels hokey to me (and may slow your testing down a bit although if you're using selenium, you're probably already going slower than what I shoot for in unit tests). An alternate approach might be to convert the data you're passing to the drawGraph portion into an array and compare that with the expected values (as it looks like your graph contains about 100 x,y pairs which is a lot smaller data than 100 * 100 pixels), but I'm not quite clear if your intention is to test that the matploblib code is generating the right data or that it's then transforming the data correctly into a graph.