cancel
Showing results for 
Search instead for 
Did you mean: 

Adding fields to Summary Report

SOLVED
Highlighted
Occasional Contributor

Adding fields to Summary Report

e are trying to import results into Zephyr. The parse can support several additional fields like Requirements ID and attachments. I have manually added them to the Summary XML and do an import with the Zbot Files watcher so I know they work. I cannot figure out how to get TestComplete to add the field to test cases in the Summary Report. Has anyone figured this out? 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Manager

Re: Adding fields to Summary Report

Thank you Justin! 

@palmerbw will this solution work for your case? 


Sonya Mihaljova
Community and Education Specialist
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️

View solution in original post

8 REPLIES 8
Highlighted
Community Manager

Re: Adding fields to Summary Report

Let's see if the Community has ideas on how to do this kind of custom reporting.

 

@AlexKaras @tristaanogre @BenoitB @Marsha_R @cunderw ?

You insight is appreciated!


Sonya Mihaljova
Community and Education Specialist
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Highlighted
Community Hero

Re: Adding fields to Summary Report

Hi,

 

I am afraid that the Summary Report (likewise the log itself) is not extensible at the moment.

You may create Support ticket (via the https://support.smartbear.com/message/?prod=TestComplete form) for the official reply and, hopefully, some piece of advice. I will appreciate it if you share reply from Support if they provide you with some workaround.

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
Highlighted
Community Hero

Re: Adding fields to Summary Report

I'm with @AlexKaras .  The "stock" reports built in to TestComplete aren't so much reports as they are a data analysis of the logs.  Whatever the logs have in them, that drives what shows p on the reports and that includes specifics about test cases.

 

As always, you can write out your own reports.  TestComplete has the capability of writing files such as CSV or Excel as well as inserting records into an SQL data table so, if you need something in more detail than what's available "out of the box", you can develop your own.  I know many users on this forum who have done so who might be willing to share their code.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
Highlighted
Community Manager

Re: Adding fields to Summary Report

Thank you Community!

 

@palmerbw were the suggestions helpful? Please let us know!


Sonya Mihaljova
Community and Education Specialist
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Highlighted
Staff

Re: Adding fields to Summary Report

@palmerbw 

This is just one simple solution:

first you need a script that will parse through your xml file to append the new tags of requirements and attachments

 

import sys
import xml.etree.ElementTree as ET


'''
This python script will attach file and one requirement to all of the test cases contained within the automation suite that was run via the zbot
You will include an additional call to this script within your batch file as a part of the same automation run
This .py file will take three command line arguments as explained below. 
-------------------------------------

When calling the this python script from your batch file, provide additional command line arugments for these parameters
in the following order:
1) Your XML file generated by the automation run, its directory location, so that we can modify with additional sublemenets
2) the requirment to be mapped to all of the test cases within the automation job that just ran i.e AltID_JIRA-12
3) The location of the additional attachment to add (whatever file type, absolute path; i.e C:\\myAttachment.pdf)
-------------------------------------
your batch file will then look like (i.e for testcomplete tests)
<TC executable path> <TC project suite file> <runtime arguments ie. /r /e> </ExportSummary:"C:\\XML file location to be generated">
<python executable> <path to this .py file that will modify your xml file> <XML file location (from the /ExportSummary arugment)> <Your requirement i.e AltID_JIRA-12> <your attachment location>

'''
def add_att(myXMLfile, gen_req, attachment_location):
    myXMLfile = str(myXMLfile)
    gen_req = str(gen_req)
    #Reading the file from disk:
    tree = ET.parse(myXMLfile)
    root = tree.getroot()

    for testcase in root.iter('testcase'):
        att_name = str(attachment_location) #"C:\\" + str(testcase.get('classname')) + ".mht"
        
        #add in the attachments subelement for testcases
        attachments1 = ET.SubElement(testcase, 'attachments')
        attachments2 = ET.SubElement(attachments1, 'attachment')
        attachments3 = ET.SubElement(attachments2, 'attachment')
        attachments2.text = att_name
        

        #add in the requirements subelements for test cases
        requirements1 = ET.SubElement(testcase, 'requirements')
        requirements2 = ET.SubElement(requirements1, 'requirement')
        requirements3 = ET.SubElement(requirements2, 'requirement')
        requirements2.text = gen_req

        ET.dump(testcase)
        #print(testcase.attrib)
    
    tree.write(myXMLfile)


if __name__== "__main__":
    add_att(str(sys.argv[1]), str(sys.argv[2]), str(sys.argv[3])) 


then you need to call on this code to modify your junit xml file that's generated by TestComplete as a part of your batch file, so that you batch file now looks like: 

<"Path to TestComplete.exe"> <"path to your TestComplete pjs file"> <additional arguments ie. /r /e /ExportSummary:"C:\myresults.xml">
<"path to your python exe"> <"path to that .py file above"> <C:\myresults.xml> <the requirement id> <path to your attachment>

----------------------

feel free to take that .py sample and modify it to fit your needs

Best,
Justin Kim
Highlighted
Community Manager

Re: Adding fields to Summary Report

Thank you Justin! 

@palmerbw will this solution work for your case? 


Sonya Mihaljova
Community and Education Specialist
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️

View solution in original post

Highlighted
Occasional Contributor

Re: Adding fields to Summary Report

Basically this indicates that I can write my own code to make two Smartbear tools communicate well. This does not seem like a good solution but I will accept it. 

Highlighted
Community Manager

Re: Adding fields to Summary Report

@palmerbw thank you for the response. This is not as smooth a solution as one could hope but I am glad to know that it can help you achieve the desired outcome.


Sonya Mihaljova
Community and Education Specialist
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
New Here?
Join us and watch the welcome video:
Announcements
Script Wanted
A new challenge is here!

Create a function to drag one element to another for the TechCorner tag!

Will you dare to take the challenge?


Scripts created in July:
- Passing custom command-line arguments as a test parameter
Top Kudoed Authors