HTMLTestRunner add screens for a comparative regression test

Asked by reriadboom

Hello ;-)

I'm currently trying to develop a POC using Sikulix in a comparative regression test. What I'm doing is :

_ Excute some GUI actions on an Old version of my Soft and take some screen shots at defferent steps (for example screens : screen1, screen2 and screen3 are saved);
_ Do the same thing on the new version of the soft + at each step I check if the GUI has changed by testing the existence of the screens taken on the old version (testMethod having assertion).

It's working and the report is generated. But I just want to integrate links to the two screens (old/new) on each testMethod in the report like :
 old version screen1 "link" and new version screen1 "link"

Is there a simple way to add some code (method) in the HTMLTestRunner to do that ?

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

--- Is there a simple way to add some code (method) in the HTMLTestRunner to do that ?

Look into the code of the bundled HTMLTestRunner.py (app data folder Lib).

There is already a modification, to add the last screenshot to the output on failure.

This might help, to understand the principle.

Make a copy named stag. like MyHTMLTestRunner.py, put it somewhere in your working environment and make your modifications.

How to make things ready to import it into your scripts:
https://sikulix-2014.readthedocs.io/en/latest/scenarios.html#access-python-packages-from-sikulix-scripts-run-by-sikulix-gui-or-commandline

Revision history for this message
reriadboom (raiderben) said :
#2

Hello Raiman,

Thx for your speed response. Actually I have already looked at the bundled HTMLTestRunner.py and I of course put a custom version of it in my "C:\Users\.....l\AppData\Roaming\Sikulix\Lib\site-packages" as indicated in the doc. And my custom version of HTMLTestRunner.py is correctly loaded.

By may be because I m not a senior "Python" developper I'm facing some troubles to achieve my goal.
And to precise, the attempt was to add some static or class method to the "_TestResult" class and call it from my test method like :

def test1(self):
        self.screen_1 = captureZoneOnWindow()
        HTMLTestRunner._TestResult.addScreen(self.screen_1)
        assert True

Let me know if I going on a right or bad direction.

Revision history for this message
reriadboom (raiderben) said :
#3

And the new method "addScreen" looks like :

    @staticmethod
    def addScreen(img1):
        _TestResult.result.append((0, test, output, _exc_str, img1))

Revision history for this message
RaiMan (raimund-hocke) said :
#4

Ok, I will have a look - might take some hours.

Revision history for this message
reriadboom (raiderben) said :
#5

Ok, I appreciate.

Revision history for this message
Best RaiMan (raimund-hocke) said :
#6

I have a principle solution.

I would like to continue with private mailing.

Please send me a mail contact to where I can send you a zip file with my current state and to further discuss it.

I am sikulix---at---outlook---dot---com.

Revision history for this message
reriadboom (raiderben) said :
#7

Thanks RaiMan, that solved my question.