Getting CurrentTestContainer ReportLevel

Class library usage, coding and language questions.
cpalex
Posts: 36
Joined: Sat Feb 17, 2018 12:37 am

Getting CurrentTestContainer ReportLevel

Post by cpalex » Mon May 18, 2020 5:54 pm

I have some code I would like to run, only if the current report level is Debug.

I can use the current test suite debug level in the TestSuite.Current.ReportLevel, but since each container or test case can have a level other than Inherit, I need to know the actual report level of the test container.

While debugging, I can see the local variable of ReportLevel for the TestSuite.Current.CurrentTestContainer, but I cannot actually use it in code

What would be the proper way to tell what the current report level was?

User avatar
Stub
Posts: 341
Joined: Fri Jul 15, 2016 1:35 pm

Re: Getting CurrentTestContainer ReportLevel

Post by Stub » Tue May 19, 2020 8:20 am

What do you mean by, "I cannot actually use it in code"?

If it's "Inherit" can you recurse up the ParentContainer hierarchy until you find the report level it's inheriting?