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

What is the code to open test result file after execution

6 Answers 154 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Alan
Top achievements
Rank 2
Alan asked on 13 Dec 2013, 04:48 PM
Hello,

In the OnAfterTestCompleted method, I would like to have code to open the test result file after a failure.  When the file is saved, how can I access the unique 18-digit id?  I first export the result to a network location.  Here is what I have so far:

result.ExportToResultFile("z:\\", "Smoke Test");
System.Diagnostics.Process.Start("z:\\Smoke Test 130314192986639898.aiiresult");

This opens that one specific result, however I haven't found anything in the TestResult class that I think would do the trick to get that unique ID.  Anything else I can try?

Thanks!

6 Answers, 1 is accepted

Sort by
0
Mario
Telerik team
answered on 18 Dec 2013, 07:51 PM
Hi Alan,

Thank you for contacting Telerik Support.

From a high level perspective of this problem, could you help us to understand why you are looking to use the OnAfterTestCompleted as opposed to the OnAfterTestListCompleted method in your scenario. It would be the preferred method to use test lists for such purposes.

For instance, if you run this smoke test inside a test list via command line (output results to Z:\):
artoftest.runner.exe list="C:\Users\<user>\Documents\Test Studio Pro
jects\TestProject\TestLists\smoke.aiilist" out=z:\

Then in OnAfterTestCompleted method, you would just need:

System.Diagnostics.Process.Start("Z:\\" + result.FileName + ".aiiresult");

I look forward to hearing back from you.

Regards,
Mario
Telerik
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
Alan
Top achievements
Rank 2
answered on 18 Dec 2013, 08:54 PM
Thanks Mario!  I took on code from a previous employee who used OnAfterTestCompleted.  We use a combination of test lists, command line exe, and quick runs.  I was not aware that such a method for OnAfterTestListCompleted existed but I will incorporate that into our scripts.

Alan
0
Alan
Top achievements
Rank 2
answered on 18 Dec 2013, 09:42 PM
Hello Mario,

I attempted to use "result.FileName", however that is not an option in the Intellisense and I am receiving the error below.  Is there a different property I should use?

'ArtOfTest.WebAii.Design.Execution.TestResult' does not contain a definition for 'FileName' and no extension method 'FileName' accepting a first argument of type 'ArtOfTest.WebAii.Design.Execution.TestResult' could be found.

Thank you,
Alan
0
Mario
Telerik team
answered on 18 Dec 2013, 10:21 PM
Hi Alan,

It looks like I made a mistake in my original response, near the bottom it should read '... in OnAfterTestListCompleted...', as unfortunately the FileName method does not exist in the context of a OnAfterTestCompleted result. The solution I purposed would only open the results of a  test list execution (eg. command line) after the result is created/copied on 'Z:\'.

Regards,
Mario
Telerik
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
Alan
Top achievements
Rank 2
answered on 19 Dec 2013, 10:13 PM
I am now receiving this error:

'PAS_Smoke_Tests.CA_SmokeDriver.OnAfterTestListCompleted(ArtOfTest.WebAii.Design.Execution.TestResult)': no suitable method found to override

I must not have this method in the correct location.  I put this method in the same location as the OnAfterTestListCompleted method like so:

    public class CA_SmokeDriver : BaseWebAiiTest
    {
        #region [ Dynamic Pages Reference ]
        public Pages Pages
        {}
        #endregion
         
        public override void OnAfterTestCompleted(TestResult result)
        {}
 
        public override void OnAfterTestListCompleted(TestResult result)
           {}
 
        [CodedSteps...]
}

Should this be located elsewhere?

Thanks!
0
Mario
Telerik team
answered on 19 Dec 2013, 10:26 PM
Hi Alan,

Take a look at this article on execution extensions, I believe you will find the instructions paired along with examples quite useful.

Regards,
Mario
Telerik
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
Tags
General Discussions
Asked by
Alan
Top achievements
Rank 2
Answers by
Mario
Telerik team
Alan
Top achievements
Rank 2
Share this question
or