Hi Sathish,
I fear I must be communicating unlearly. Let's try again...
You cannot successfully do it that way. It isn't supported and will
never be supported. Additionally, it's really not such a good idea to
make test code responsible for collecting data about itself. It's
outside of the responsibility of the test. And anyway, some test data
is not really available until the test is finished. You are collecting
data before the test is finished.
Since you are using the engine, all the information you need is
available to the listener that you give to the runner when executing
the tests. You merely have to implement ITestEventListener in order to
get everything you like. As a bonus, you will be doing using our
published API rather than an internal class that may change at any
time.
Because NUnit has not had a public/published API in the past, many
people have fallen into the habit of using internal classes for this
sort of thing. It's a bad idea. In fact, this whole discussion is
suggesting to me that we should probably stop exposing such Types
publicly. We do it because NUnit has existed for a long time and it
was not possible in the past to test internal members. However now it
is and we use InternalsVisibleTo for our tests. The
TestExecutionContext could easily disappear from your view tomorrow!
Charlie
On Fri, Apr 15, 2016 at 8:42 AM, Sathishkumar Kaliavaradhan