Ask a Question

Change format of emailed test results using slPacker


Change format of emailed test results using slPacker



I have successfully added an operation to my Keyword test that emails the test results.
I have used the slPacker method to do so.

Can I use a different export format? I have not seen this explained in the documentation, it looks like I must use Log.SaveResultsAs() 

Using that method, I can seem to find the proper structure. I have tried to copy the example of the help file:
Log.SaveResultsAs("C:\QA\\Log.mht", lsMHT)
But when I click Next on the Call object method wizard, it gives the error:
"The specified expression does not return an existing object, or that object does not contain any methods or properties"

Any help appreciated!


Ahhhh!! Wow 🙂
This morning I was trying to Add a script and I thought the language selection would be there.. it wasn't and I couldn't find it.

You were right, I was in DelphiScript. Python was OK, this is the language I'll have the most ressources to find help with - internally. So I switched it to Python. 
It did not change anything, so I added a new script in case the old ones did not convert. It still fails.

When I go in the options, I can see it is set to Python now. I have also restart TestComplete, just in case. Same.


Will I be able to change scripting language once a project is started?

Unfortunately, you cannot change the scripting language once the project has started; which is why it is important to select the one you are most comfortable with at the onset of the project creation. 


What I would suggest is starting a new project within that same project suite. You can do that buy right clicking at the project suite level inside of your project explorer in the far left hand side of the screen. You can then name the project, store it in some directory, and choose Python. You can then start creating python script routines to fit your needs. 


If you want to copy the test steps from your previous Project's keyword test, you can copy and paste the test steps into the keyword test of your new project, and merge the name mapping.

Hope this helps.

Justin Kim

Oh great information.
I am now in a Python project and have imported my test and the NameMapping.

I created the script and added to my project, it is all working fine now!


A big thanks for your patience and help.

I wonder if I can trouble you guys with another question, related to the same topic.

Using the same script as above, would it be possible to email only the errors? I saw some posts on emailing the errors only, but using different functions than the ones I used with your help. I wonder if I can adapt my current script to email errors only, or if I should of thought of that first and used a different script completely.

The reason behind this is just the size of the zip is too large for our company server and it won't let me email it.

On a sidenote, I am having a lot of fun with TestComplete! I now have automated 54 tests and I can send the results by email, this is incredible! I feel like a programmer even though I have no programming notion! It is so fast compared to my manual testing.

Most likely, in that case you'd be looking at using the event handler project item, for the onlogerror event. 

however, you should be careful, since if you have an event handler associated in a certain project, you may see some errors occuring if you run your tests at the test level and not the project level.

Anyhow you would add in Events item into your project


and you would add in an LogError event:


and then you would add in the script to generate the mht result file, and send the email with that attached.

image.pngand then the script would look something like this:




def OnErrorSendEmails_OnLogError(Sender, LogParams):
Log.SaveResultsAs(Project.ConfigPath + "\\MHT_Files\\" + aqTestCase.CurrentTestCase.Name + ".mht", lsMHT)
SendMail("", "", "Justin Kim", "", "Error in Test Run", "Please take a look at the attached results file", Project.ConfigPath + "\\MHT_Files\\" + aqTestCase.CurrentTestCase.Name + ".mht")


Then finally, you would run your tests at the project level, and whenver there is an error, testcomplete will generate an MHT results file to that designated location, and send an email with that file attached.


scratch that, even with on log error, if one of your project items has an error, it will generate and send all the of the logs of the project test items. in this case, we will need to use a conditional statement instead and have that as its own test case.

Justin Kim


Justin Kim
Showing results for 
Search instead for 
Did you mean: