Forum Discussion

sborno's avatar
sborno
Occasional Contributor
5 months ago

Screenshots in Keyword test to document steps

Hi!
How to attach a screenshot in Smartbear's Testcomplete to a single test step of type 'Property Checkpoint' or
of type 'Run Script Routine' in the keyword testing mode like is it done automatically during an 'On Screen Action' operation with 'Capture images' flag enabled the Visualizer settings?

The option 'Tools' -> 'Current Project Properties' -> 'Visualizer' -> 'Collect Test Visualizer data during test run' -> 'Capture images' (activated)
binds the screenshot to the script function and not to the calling keyword test step as expected.

Used Testcomplete version 15.62.2.7 x64

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    See https://support.smartbear.com/testcomplete/docs/testing-with/visualizer/index.html 

    The visualiser is useful for when developing your tests and during debug. However these images will grow in size, and it's not necessary to store them into a file repository system. Ideally, you should only capture errors. Personally, I don't think it's necessary to document every single step - if you have structured your test appropriately, then it should be easy to follow/read. 

    • sborno's avatar
      sborno
      Occasional Contributor

      Hi, rraghvani

      Many thanks for the link. Unfortunately, I don't see a way to enable screenshots for these types of test steps on the Smartbear pages.

      I disagree with you about the documentation. If it takes me an hour to retrace a workflow with screenshots and 8 hours without, because nobody knows what the deleted button or the changed combobox was for, it's worth documenting every step precisely!

      Best regards, sborno

  • Hassan_Ballan's avatar
    Hassan_Ballan
    Frequent Contributor

    You could use a Logging Operations such as "Log Message" or "Post Screenshot"

  • sborno's avatar
    sborno
    Occasional Contributor

    Thank you Hassan_Ballan for your reply.

    "Log Message" or "Post Screenshot" are new keyword test steps, then. - How could I assign the result (= a screenshot) to the existing test step 'Run Script Routine'?

    For example, if I had 20 test steps of type 'Run Script Routine', inserting 20 test steps of type 'Post Screenshot' becomes quite confusing. Isn't there a simpler solution?

    Thanks in advance

    • Hassan_Ballan's avatar
      Hassan_Ballan
      Frequent Contributor

      If I understand it correctly that you are trying to use screen shots to document test steps, may I suggest using a different approach.

      Use the simple "Log Message" or create a log folder structure for the test case hierarchy by utilizing the Logging Operations "Append Log Folder" along with "Pop Log Folder" Logging Category | TestComplete Documentation (smartbear.com)

      • sborno's avatar
        sborno
        Occasional Contributor

        Yes, I try to document test steps as clear as possible and like to illustrate them by a screenshot taken at the time of design. 

        I'll think logging is not a adequate solution, because this will be done during the execution of each test step and if I understand it correctly, it is not visible in the flow of the keyword test table.

        Is there a way to get the same behaviour for a step of type 'Run Script Routine' as when processing a normal keyword test step by using a plugin for Testcomplete or something like that?

        Is there a possibility to develop a plugin for Testcomplete to reach this goal?

  • sborno's avatar
    sborno
    Occasional Contributor

    Hi,

    Unfortunately, no suitable solution has yet been found.

    My expectation was that this kind of behavior should work out of the box for a commercial product that has been on the market for a long time.

    Kind regards

  • You are welcome to post here and add your feature request.

    https://community.smartbear.com/category/testcomplete_forum/ideas/testxcompletefeaturerequests

  • MW_Didata's avatar
    MW_Didata
    Regular Contributor

    For keywordtests you can use the 'post screenshot' action.

    Scripts have their own version of this Log.Picture, in example Javascript:

    you can also make any log message post a screenshot like this:

    Property checkpoints doesn't post screenshots, but you can add them with the post screenshot action after or before the check.

    • sborno's avatar
      sborno
      Occasional Contributor

      Hi MW_Didata

      Thank you for your answer!

      But this is not my usecase. - Making a screenshot with a script command is not my goal.

      To reuse scripts, countless keyword tests call up our scripts.

      It is tedious and confusing to navigate from each script call (encapsulated in a test step of type 'Run Script Routine') to the script to be able to understand the expected workflow.

      Kind regards