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:
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!
Thanks!
6 Answers, 1 is accepted
0
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:\):
Then in OnAfterTestCompleted method, you would just need:
I look forward to hearing back from you.
Regards,
Mario
Telerik
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
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
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
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
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
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
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:
Should this be located elsewhere?
Thanks!
'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
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
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