// To be used only by the runner public PNUnitServices(object info, object consoleAccess) { mInfo = info as PNUnitTestInfo; mConsoles = new ArrayList(); mConsoles.Add(consoleAccess as ITestConsoleAccess); mInstance = this; }
public PNUnitTestRunner( PNUnitTestInfo info, AgentConfig config) { mConfig = config; mPNUnitTestInfo = info; mbUseDomainPool = config.UseDomainPool; }
public void RunTest(PNUnitTestInfo info) { mLog.InfoFormat( "RunTest called for Test {0}, AssemblyName {1}, TestToRun {2}", info.TestName, info.AssemblyName, info.TestToRun); mTestCounter.Increment(); new PNUnitTestRunner(info, mConfig).Run(); }
// To be used only by the runner public PNUnitServices( PNUnitTestInfo info, IPNUnitServices services, ITestConsoleAccess consoleAccess, ITestLogInfo testLogInfo) { mInfo = info; mServices = services; mConsoles = new ArrayList(); mConsoles.Add(consoleAccess); mTestLogInfo = testLogInfo; mInstance = this; }
// To be used only by the runner public PNUnitServices(object info, object consoleaccess) { mInfo = info as PNUnitTestInfo; mConsole = consoleaccess as ITestConsoleAccess; mInstance = this; }
private void ThreadProc() { log.DebugFormat( "Thread created for TestGroup {0} with {1} tests", mTestGroup.Name, mTestGroup.Tests.Length); mFinish = new ManualResetEvent(false); mBarriers = new Hashtable(); mBarriersOfTests = new Hashtable(); init = false; RemotingServices.Marshal(this, mTestGroup.Name); mLaunchedTests = 0; foreach( TestConf test in mTestGroup.Tests ) { if( test.Machine.StartsWith(agentkey) ) test.Machine = mTestGroup.Agents[int.Parse(test.Machine.Substring(agentkey.Length))]; Launcher.Log(string.Format("Starting {0} test {1} on {2}", mTestGroup.Name, test.Name, test.Machine)); // contact the machine try { IPNUnitAgent agent = (IPNUnitAgent) Activator.GetObject( typeof(IPNUnitAgent), string.Format( "tcp://{0}/{1}", test.Machine, PNUnit.Framework.Names.PNUnitAgentServiceName)); lock( mResultLock ) { ++mLaunchedTests; } PNUnitTestInfo testToRun = new PNUnitTestInfo( test.Name, test.Assembly, test.TestToRun, test.TestParams, this, test.StartBarrier, test.EndBarrier, test.WaitBarriers); testToRun.UserValues = mUserValues; agent.RunTest(testToRun); } catch( Exception e ) { Launcher.LogError(string.Format( "An error occurred trying to contact {0} [{1}]", test.Machine, e.Message)); lock( mResultLock ) { --mLaunchedTests; } } } log.DebugFormat("Thread going to wait for results for TestGroup {0}", mTestGroup.Name); if( HasToWait() ) // wait for all tests to end mFinish.WaitOne(); log.DebugFormat("Thread going to wait for NotifyResult to finish for TestGroup {0}", mTestGroup.Name); Thread.Sleep(500); // wait for the NotifyResult call to finish RemotingServices.Disconnect(this); log.DebugFormat("Thread going to finish for TestGroup {0}", mTestGroup.Name); }
// To be used only by the runner public PNUnitServices(object info, object consoleaccess) { mInfo = info as PNUnitTestInfo; mConsole = consoleaccess as ITestConsoleAccess; mInstance = this; }
public PNUnitTestRunner(PNUnitTestInfo info, AgentConfig config) { mConfig = config; mPNUnitTestInfo = info; }
private TestResult BuildResult( TestResult result, TestConsoleAccess consoleAccess, PNUnitTestInfo testInfo) { //the test namespace contains errors if( result == null ) { TestName testName = new TestName(); testName.Name = testInfo.TestName; string errormsg = "The test {0} couldn't be found in the assembly {1}"; result = new PNUnitTestResult(testName, string.Empty); result.Failure( string.Format(errormsg, testInfo.TestToRun, testInfo.AssemblyName), string.Empty); return result; } if( !result.IsSuccess /*|| ReturnTestOutput()*/ ) return new PNUnitTestResult(result, consoleAccess.GetTestOutput()); else return result; }