Change format of emailed test results using slPacker
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Change format of emailed test results using slPacker
Hello,
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!
Thanks
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok... I don't see how this helps me.
The procedure that zips the test result is not related to outlook - at least in my head.
If I cut my procedure in two parts: zipping the file and sending via email.
The part I want to modify is the zip. It's OK to be a zip format, but I would prefer the files inside in HTML or PDF or different format than the default produced from the slPacker method.
Once this is done, I will email it. But I doubt that Outlook has any incidence on the content of the zip file saved on my disk.
Thanks!
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, could you provide screenshots of the error messages that you get from the test log regarding the Log.SaveResultAs method?
I see that you included 1 backslash after the C directory where you were defining the file location within that snippet you provided (i think you may need 2, probably, depending on your scripting language of choice (since there are two backslashes at the folder level beneath that))...
Justin Kim
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello @hkim5
Yes, and sorry there was a mistake above (one place I had one backslash and the other place had two). The number of slashes does not change the error - I tried with single backslash at both places and double backslashes also. I think in the wizard you normally enter one backslash and when the wizard closes, the code that shows includes the 2 backslashes. At least, this is what I noticed with the PackCurrentTest operation.
Here are the screenshots:
And this is my existing operation, with its wizard:
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
would you be open to creating a couple of short script routines to perform these operations?
I don't know what that script routine is below the slPacker operation, but maybe the order of the test steps are wrong?
Are you looking to save logs at the test case level? Or the project level. For the former option, the best bet would be to create on onStop or onStart test event handler with the log.saveresultas method (but this only works when you start running tests at the project level).
The easier option would be to use both log.saveresultas and slpacker at the project level as their own individual tests - here are screenshots to describe what i mean:
and then drag these scrip routine (tests) to the project level
so now that you run the project, you see some logs like this:
and then you can see the log.saveresultas file's mht format result in the designated file location:
and finally also the slpacker's resulting zip file
Justin Kim
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry for the delay, I was on vacation.
Yes I am opened to using scripts but still so new at this... and not very good 🙂
I created the script routine I needed to pack the files like in your screenshot (thank you for that).
Although now, I am unable to call the script. I think it needs to be defined within a function, as that is how the other script I have is written (the one that sends the email).
I am currently having a red X near the:
def save_logs():
it says Routines not found.
I will investigate this and report back 🙂 Thanks!
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
could you add some screenshots as to
1) your script for slpacker
2) your project where you drag and dropped the test cases & script routines in
3) error logs
4) any other error message your're getting
Justin Kim
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@hkim5
Thank you so much for the help. Yes, I can provide the screenshots. Just keep in mind, because the script is in error I cannot add it to the project, so as it is right now, I can only show you the script.
It seems like I cannot define the function, but I don't understand why. I've isolated both functions and both fail. I also tried several different names for the function "Save_logs", with and without the underscore, no caps, etc.
I am not getting any errors since the script won't run. When I hover the mouse over the red "X", the error is "Unexpected Identifier". I did not customize your code much, as of now I'd like to just be able to execute it. From there, I should be able to continue.. hopefully 🙂
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When you created this project (the project that this script unit as a whole is a part of) did you define the scripting language of your choice? My code, and the screenshot that you provided is in Python Syntax, so if you chose any of the other 6 languages supported in Test Complete, you will get a syntax error.
if you go to these documentation webistes:
(slpacker): https://support.smartbear.com/testcomplete/docs/reference/program-objects/slpacker/index.html
(Log.saveresultas): https://support.smartbear.com/testcomplete/docs/reference/project-objects/test-log/log/saveresultsas...
you will see example code snippets like this :
you just need to follow the syntax structure of your scripting language, and the red "x" should disappear from your script routine.
If you dont know what language you chose, go to tools>options>general>project and it should show you what your default language is.
Justin Kim
