Query on customizing Test Results

6 posts, 0 answers
  1. Gaurav
    Gaurav avatar
    21 posts
    Member since:
    Apr 2011

    Posted 23 Apr 2011 Link to this post

    Hi Team,

    I am just started studing on trial version of Web UI Test studio Developer editions. I am created a WebUI script(Keyword view) in VS 2010. When we run the script from the keyword view, then it generates the log(Test result) which contains status of each step. I am adding my custom message in the log using Log.Writeline(). But my custom message is displayed along with system generated log messages.

    My requirement: I just want to see only messages which i add it manually using Log.writline(). Means i just wan to have a separate section for my own test result messages. Is this possible with keyword view?

    I know i can achieve this requirement if i convert the test in MSTest. But how to do it in keyword view?
  2. Stoich
    Admin
    Stoich avatar
    1 posts

    Posted 25 Apr 2011 Link to this post

    Hi Gaurav,
          you can't really change the way the Log is structured. However, there are many easily implementable alternatives that you can use.

    I would suggest that you initialize a StreamWriter object in the BaseWebAiiTest class (see screenshot 1). For instance:
    System.IO.StreamWriter file = new System.IO.StreamWriter("c:\\test.txt", true);
    You will be able to write to this StreamWriter from every step (i.e. function) in the class (i.e. the test) like so:
    file.Write("This is some content");
    Then when you're done with the StreamWriter just flush it and close it in a step:
    file.Flush();
    file.Close();

    Hope to hear from you soon.

    All the best,
    Stoich
    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
  3. Gaurav
    Gaurav avatar
    21 posts
    Member since:
    Apr 2011

    Posted 27 Apr 2011 Link to this post

    Thanks for the reply.

    I have some queries based on your reply.

    1. We have to store our customized messages in file, if we dont want to mix our messages with Log. Right?
    2. If i want to access the Log generated for teleric tool, what is the best way? I mean if i want to send the log over email, is this possible?

    3. If i have to use the command "file.Write("sample Successfull message")" then i have to write in .cs method. RIght? if yes then i believe, i will have to create separate custom method for each of each of following "file.Write" command, Let me show you one example.

    For example My script is like this.

    Records steps on section A of one page
    file.Write("Section A done"); //Need to create custom method1 for this line
    Records steps on section B of one page
    file.Write("Section B done");//Need to create custom method2 for this line
    Records steps on section C of one page
    file.Write("Section C done");//Need to create custom method3 for this line

    If my above assumptions are correct then there will be many custom methods, if there are many custom message to be stored in file.

    Kindly help me out. Incase of providing  straight answer to above question you can also provide me help document which can help me resovle above queries.






  4. Gaurav
    Gaurav avatar
    21 posts
    Member since:
    Apr 2011

    Posted 03 May 2011 Link to this post

    HI Team,

    Any anwser on my queries? Kindly help me out.
  5. Stoich
    Admin
    Stoich avatar
    1 posts

    Posted 03 May 2011 Link to this post

    Hi Gaurav,
       I apologize for the late reply.

    1. We have to store our customized messages in file, if we dont want to mix our messages with Log. Right?
    Yes, this is correct.
    2. If i want to access the Log generated for teleric tool, what is the best way? I mean if i want to send the log over email, is this possible?
    It's definitely possible but you'll need to implement write your own logic in order to do it. Check out this blog post:
    http://blogs.telerik.com/blogs/posts/10-10-28/tweet_your_test_results_from_webui_test_studio.aspx
    and also this KB article:
    http://www.telerik.com/automated-testing-tools/support/kb/executing-custom-scripts-before-after-your-test-runs.aspx
    Test Studio's (Stand alone) Scheduling feature is also capable of sending emails with test results.

    3. If i have to use the command "file.Write("sample Successfull message")" then i have to write in .cs method. RIght? if yes then i believe, i will have to create separate custom method for each of each of following "file.Write" command, Let me show you one example.
    Yes, that's basically correct unless your test doesn't use normal (i.e. non-coded) steps. But similarly you would need separate coded steps (i.e. methods) for the different lines of Log.Writeln().

    I hope this helps.

    Best wishes,
    Stoich
    the Telerik team
    Do you think you know all the new features coming out in Test Studio R1 2011? Think again - we have some surprises and will share them with you in the What's New in Test Studio R1 2011 Webinar on May 12th.
    Register Today!
  6. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 03 May 2011 Link to this post

    Hello Gaurav,

    To access the test result log you'll want to use the OnAfterTestCompleted as documented in http://blogs.telerik.com/blogs/posts/10-10-28/tweet_your_test_results_from_webui_test_studio.aspx. The log can be read out of result.Message inside that function.

    All the best,
    Cody
    the Telerik team
    Do you think you know all the new features coming out in Test Studio R1 2011? Think again - we have some surprises and will share them with you in the What's New in Test Studio R1 2011 Webinar on May 12th.
    Register Today!
Back to Top
  Cast Your Vote at DevPro Connections! Cast Your Vote at  Win IT Pro Connections!