Example #1
0
        public string RunTest(
            string testFile,
            List <string> testsToRun,
            string resultLogFile,
            string errorLogFile,
            string failedConfFile,
            int numRetriesOnFailure,
            TestSuiteLoggerParams loggerParams,
            TestRange testRange,
            List <string> cliArgs,
            int testTimeout)
        {
            mLog.InfoFormat("Request to run tests on file [{0}]", testFile);

            if (mAutomatedLauncher != null)
            {
                string msg = "Can't launch another test suite because a test suite is currently running";
                mLog.Error(msg);
                return(msg);
            }

            mAutomatedLauncher = new PNUnitAutomatedLauncher(mListenAddress);

            return(mAutomatedLauncher.RunTest(
                       testFile,
                       testsToRun,
                       resultLogFile,
                       errorLogFile,
                       failedConfFile,
                       numRetriesOnFailure,
                       loggerParams,
                       testRange,
                       cliArgs == null ? null : cliArgs.ToArray(),
                       testTimeout));
        }
Example #2
0
        internal string RunTest(
            string testFile,
            List <string> testsToRun,
            string resultLogFile,
            string errorLogFile,
            string failedConfFile,
            int numRetriesOnFailure,
            TestSuiteLoggerParams loggerParams,
            TestRange testRange,
            string[] cliArgs,
            int testTimeout)
        {
            mLoggerParams = loggerParams;

            try
            {
                mGroup = TestConfLoader.LoadFromFile(testFile, cliArgs);

                if ((mGroup == null) || (mGroup.ParallelTests.Count == 0))
                {
                    mLog.WarnFormat("[{0}] no tests to run", testFile);
                    return("No tests to run");
                }

                mTestsList = testsToRun;

                if (testRange == null)
                {
                    testRange = new TestRange(0, mGroup.ParallelTests.Count - 1);
                }

                if (testRange.EndTest >= mGroup.ParallelTests.Count)
                {
                    testRange.EndTest = mGroup.ParallelTests.Count - 1;
                }

                mUserValues = CliArgsReader.GetUserValues(cliArgs);

                mLauncherArgs = new LauncherArgs();

                mLauncherArgs.ResultLogFile    = resultLogFile;
                mLauncherArgs.ErrorLogFile     = errorLogFile;
                mLauncherArgs.FailedConfigFile = failedConfFile;
                mLauncherArgs.RetryOnFailure   = numRetriesOnFailure;
                mLauncherArgs.MaxRetry         = numRetriesOnFailure;
                mLauncherArgs.TestRange        = testRange;
                mLauncherArgs.TestsTimeout     = testTimeout;

                System.Threading.ThreadPool.QueueUserWorkItem(
                    new System.Threading.WaitCallback(Run));

                return(string.Format(
                           "Trying to launch {0} tests",
                           mGroup.ParallelTests.Count));
            }
            catch (Exception e)
            {
                mLog.ErrorFormat("RunTest error {0}", e.Message);
                mLog.Debug(e.StackTrace);
                return(e.Message);
            }
        }