Custom assembly for Tests

2 posts, 0 answers
  1. Stuart
    Stuart avatar
    4 posts
    Member since:
    Mar 2015

    Posted 29 May 2015 Link to this post

    I'm writing custom classes to handle common test steps and was wondering how to utilize the ArtOfTest logging so that when a code step calls one of the classes, the class can log messages to the test log so that all the log information is available.

     

    I've tried adding Manager and setting the createlog to true - but I'm not seeing log output to the test log.

     

     

     

  2. Ivaylo
    Admin
    Ivaylo avatar
    750 posts

    Posted 03 Jun 2015 Link to this post

    Hello Stuart,

    You can proceed by creating the following class:

    public class Common
       {
           public Common(Manager manager)
           {
               this.TestManger = manager;
           }
     
           public Manager TestManger { get; set; }
     
           public void TestMethod()
           {
               this.TestManger.Log.WriteLine("Common Logging!");
           }
       }

    Then in your unit test you can use the following in order to use the common logging:

    Common commonClass = new Common(Manager.Current);
    commonClass.TestMethod();

    Hope this helps.

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