Beispiel #1
0
        public virtual PerfTestResults run()
        {
            PerfTestRunner testRunner = new PerfTestRunner(perfTest, perfTestConfiguration);

            try
            {
                PerfTestResults results = testRunner.execute().get();
                resultRecorder.Results = results;
                return(results);
            }
            catch (ExecutionException e)
            {
                if (e.InnerException != null)
                {
                    Exception cause = e.InnerException;
                    if (cause is Exception)
                    {
                        throw (Exception)cause;
                    }
                    else
                    {
                        throw new PerfTestException(cause);
                    }
                }
                else
                {
                    throw new PerfTestException(e);
                }
            }
            catch (Exception e)
            {
                throw new PerfTestException(e);
            }
        }
Beispiel #2
0
        protected internal virtual void init()
        {
            results = new PerfTestResults(configuration);

            doneMonitor = new object();
            isDone      = false;

            // init test watchers
            string testWatchers = configuration.TestWatchers;

            if (!string.ReferenceEquals(testWatchers, null))
            {
                watchers = new List <PerfTestWatcher>();
                string[] watcherClassNames = testWatchers.Split(",", true);
                foreach (string watcherClassName in watcherClassNames)
                {
                    if (watcherClassName.Length > 0)
                    {
                        object watcher = ReflectUtil.instantiate(watcherClassName);
                        if (watcher is PerfTestWatcher)
                        {
                            watchers.Add((PerfTestWatcher)watcher);
                        }
                        else
                        {
//JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method:
                            throw new PerfTestException("Test watcher " + watcherClassName + " must implement " + typeof(PerfTestWatcher).FullName);
                        }
                    }
                }
            }
            // add activity watcher
            if (configuration.WatchActivities != null)
            {
                if (watchers == null)
                {
                    watchers = new List <PerfTestWatcher>();
                }
                watchers.Add(new ActivityPerfTestWatcher(configuration.WatchActivities));
            }
            configuration.StartTime = new DateTime(DateTimeHelper.CurrentUnixTimeMillis());
        }