How to detect event "Run All Tests from Solution" and monitor progress

I'd like to do set-up issues for my tests when the user invokes "Run All Tests from Solution" and I'm trying to figure out how to use your open API.
Cannot find appropriate documentation. Could you please help me with some C# example how to:

(1) Detect the event "Run All Tests from Solution" via code

(2) Determine progress of test suite (number of tests run, running/finished etc).

1 comment
Comment actions Permalink

Hello Jonas,

JK> (1) Detect the event "Run All Tests from Solution" via code

To intercept actions, you install your own action handler for the same action-id.
Like this:

[ActionHandler("UnitTest.RunSolution")]
internal class MyRunSolution : IActionHandler
{
public bool Update(IDataContext context, ActionPresentation presentation,
DelegateUpdate nextUpdate)
{
return nextUpdate();
}
public void Execute(IDataContext context, DelegateExecute nextExecute)
{
// before execute
nextExecute();
// session is populated and started (may be still building)
}
}

JK> (2) Determine progress of test suite (number of tests run,
JK> running/finished etc).

See UnitTestManager component, find session you want or just get current,
use UnitTestSession.GetStatusCount.

Sincerely,
Ilya Ryzhenkov

JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


0

Please sign in to leave a comment.