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

Custom assembly for Tests

1 Answer 69 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Stuart
Top achievements
Rank 2
Stuart asked on 29 May 2015, 04:28 PM

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.

 

 

 

1 Answer, 1 is accepted

Sort by
0
Ivaylo
Telerik team
answered on 03 Jun 2015, 10:28 AM
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
 
Tags
General Discussions
Asked by
Stuart
Top achievements
Rank 2
Answers by
Ivaylo
Telerik team
Share this question
or