Handling Step Failure and Reporting

2 posts, 0 answers
  1. Jelarg
    Jelarg avatar
    1 posts
    Member since:
    Apr 2012

    Posted 25 Apr 2012 Link to this post

    Hi Telerik Team,

    I have several question concerning handling test step failure and test results reporting.

    I'm running child tests from the parent test using "Test as Step" functionality. I need to handle situation when some of these steps failed (write error message, make screenshot). As I know there is "OnStepFailure" method that should be called when some step failed:
    But when I used this method in my parent test this method doesn't called at all.
    What I should do to handle test step failure when test as step failed (even with ContinueOnFailure option)? Also I'm interesting on how to handle failures from parent test when failed some step inside his child test (Test As Step).

    When I'm running tests from TestStudio Express VS plugin generated Visual Studio .trx reports file.
    1) How to customize such report? How to attach or bind application logs and screenshots to this report? Is TestStudio supported functionality to make and arrange screenshot for each executed test step (for visual representation of whole execution flow) ?
    2) How to generate separated *.trx reports for each iteration inside Data Driven Test (not all in one)? Maybe there is method like result.ExportToResultFile(@"C:\", result.TestName); but for VS *.trx reports?
    3) Is there is ability to change settings or bind another external data source at the start of test execution?

  2. Anthony
    Anthony avatar
    19 posts

    Posted 30 Apr 2012 Link to this post

    Hello Jelarg,

    The code in the Execution Extensions article is not intended to be used directly in the code-behind file of a test. You must write your own class and create your own DLL totally separate from the coded steps. Once created, copy the DLL into the C:\Program Files (x86)\Telerik\Test Studio\Bin\Plugins folder. You don't need to restart Test Studio for it to be picked up. The next time you execute a test, it will pull in that DLL, look for the extension methods, and call them.

    I tested this procedure and OnStepFailure was properly called when a step failed in the parent and the child test.

    1. The .trx is a Visual Studio file and not created by the Test Studio VS plugin. If you'd like to alter it further, that requires a custom solution. Here is a basic example on how to convert it to HTML.

    A Test Studio test contains a Storyboard that is captured when you originally record the test. Test Studio does not automatically capture an image for each executed test step (only for failed steps). To retrieve an image at a specific point in your test, insert a Capture step.

    2. Again, Test Studio has no control of the .trx file generated in Visual Studio. If you wish to divide the contents of the report into separate pieces, that will require a custom solution.

    3. The second half of the Execution Extensions article demonstrates using the OnInitializeDataSource method. This is how to bind another data source at the start of test execution.

    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
Back to Top