This is a migrated thread and some comments may be shown as answers.

Save the Test Log

5 Answers 93 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
tom
Top achievements
Rank 1
tom asked on 06 Oct 2010, 01:50 PM
Hi

I want to have a step at the end of a test, that saves the test log as a .txt fiel.

I need these to be able to batch process them after a day or 2 of testing for times,...

I believe this can be done in code?

I have no idea where to start and how to do it really. any help would be appreciated.

Regards,
Tom


5 Answers, 1 is accepted

Sort by
0
Accepted
Cody
Telerik team
answered on 12 Oct 2010, 05:03 PM
Hi tom,

You can do this by overriding the CleanUp method. It won't appear as a test step, but will always run whether the test passes or fails. Here's the starter of the code:

public override void CleanUp()
{
    base.CleanUp();
 
    string results = this.ExecutionContext.TestResult.Message;
}
 

All the best,
Cody
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
tom
Top achievements
Rank 1
answered on 13 Oct 2010, 11:36 AM
Hi Cody,

Thks for getting back to me.

This code looks great, but i am unsure of where to put it unless I add a code step?

Could you direct me as to where this code should be placed?

Regards,
Tom

0
Accepted
Cody
Telerik team
answered on 13 Oct 2010, 09:32 PM
Hi tom,

Sure. For QA Edition follow these steps:

  1. Open your test in the tool
  2. If your test doesn't have a coded step already, add one by clicking Script Step in the ribbon bar. We won't actually be adding anything to this script step, and in fact will be deleting it soon. The only purpose is get a code behind file generated for that test.
  3. Click the Class View button
  4. Scroll down in the code until you see this section:
    public Pages Pages
    {
        get
        {
            if (_pages == null)
            {
                _pages = new Pages(Manager.Current);
            }
            return _pages;
        }
    }
     
    #endregion
  5. Insert the CleanUp code from my previous post after the #endregion line, but before the next "[CodedStep" line.
  6. If you added a coded step in Step 2, you can safely delete the entire empty coded step while in Class View.

Regards,
Cody
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
tom
Top achievements
Rank 1
answered on 14 Oct 2010, 10:40 AM
Hello Cody,

Thank you so much for your help so far.

I couldn't find the class view button at first...

It's located above the steps, with the other step controls...

this guide shows images and explains how it works: http://www.telerik.com/documents/automated-testing-tools/WebUITestStudioQAEditionQuickStartGuide.pdf?bcsi_scan_60645583C891AE6C=0&bcsi_scan_filename=WebUITestStudioQAEditionQuickStartGuide.pdf Page 38 onwards.

Regards,
Tom
0
Cody
Telerik team
answered on 14 Oct 2010, 04:01 PM
Hi tom,

I'm glad you were able find it. I'll pass along that you had trouble locating the Class View button. It means we need to work a little more on our UI.

All the best,
Cody
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
General Discussions
Asked by
tom
Top achievements
Rank 1
Answers by
Cody
Telerik team
tom
Top achievements
Rank 1
Share this question
or