Reporting the DOM on test case fail?

27 Views Asked by At

The elephant in the room

This is probably one of the most subjective questions I have posted on here...

It may even have an overwhelmingly obvious answer...

But I have run into a slew of test case runs that have ended up failing/flaking, because of various reasons. The most common one? Some test objects that were being waited on, failing on the next action (e.g. clicking on a button after waiting for it to be present), and the test case failing on that step without waiting on the timeOut for the wait-for-element-present...

What's even more frustrating about that, is that, I have my NewTestListener taking screenshots on fail:


    @AfterTestCase
    def sampleAfterTestCase(TestCaseContext testCaseContext) {
        if (!testCaseContext.getTestCaseStatus().equals("PASSED"))
            WebUI.takeScreenshot("Screenshots/Test Case Fails/${testCaseContext.getTestCaseId()}.png")
        
        PracticeProfileHandler.GetInstance().close();
        
        SMDWebDriverUtils.CloseDriver();
    }

and when I check out the screenshot, I see clearly the test object that interaction is attempted on, that it complains is not there....!

An attempt at resolution

I am strongly thinking about having the DOM, or a section of it (e.g. the <body>) cloned to an HTML file on test case fail...

How should I proceed with this? What precautions should I take (e.g. deleting all <script> tags from the outputted HTML file)?

0

There are 0 best solutions below