Exemple #1
0
        public void CanUseSetParametersWithStartStepEnd()
        {
            var args = new[]
            {
                "-channelName channel",
                "-suiteLib suiteAssembly",
                "-suiteType testerType",
                "-subjectAssm subjectAssembly",
                "-subjecType testedObjectType",
                "-testMethod testMethodName",
                "-start 0",
                "-step 1",
                "-end 10"
            };

            var parameters = new StartParameters(args);
            parameters.ChannelName.Should().Be("channel");
            parameters.SuiteAssembly.Should().Be("suiteAssembly");
            parameters.SuiteType.Should().Be("testerType");
            parameters.SubjectAssembly.Should().Be("subjectAssembly");
            parameters.SubjectType.Should().Be("testedObjectType");
            parameters.TestMethod.Should().Be("testMethodName");
            parameters.Start.Should().Be("0");
            parameters.Step.Should().Be("1");
            parameters.End.Should().Be("10");
        }
Exemple #2
0
        public static void Main(string[] args)
        {
#if DEBUG
            //Debugger.Launch();
#endif
            Thread.Sleep(10000);
            AppDomain.CurrentDomain.AssemblyLoad       += AssembliesManager.Loaded;
            AppDomain.CurrentDomain.AssemblyResolve    += AssembliesManager.Resolve;
            AppDomain.CurrentDomain.UnhandledException += CurrentDomainUnhandledException;

            var startParameters = new StartParameters(args);

            channelName = startParameters.ChannelName;

            AssembliesManager.LoadAssembly(startParameters.TesterAssembly);

            if (string.IsNullOrEmpty(channelName))
            {
                SendError(new Exception("Channel name for interprocess communication was not set."));
                return;
            }
            try
            {
                ExperimentScope.Start(startParameters);
            }
            catch (Exception ex)
            {
                SendError(ex);
            }
        }
Exemple #3
0
        public static void Main(string[] args)
        {
            #if DEBUG
            //Debugger.Launch();
            #endif
            Thread.Sleep(10000);
            AppDomain.CurrentDomain.AssemblyLoad += AssembliesManager.Loaded;
            AppDomain.CurrentDomain.AssemblyResolve += AssembliesManager.Resolve;
            AppDomain.CurrentDomain.UnhandledException += CurrentDomainUnhandledException;

            var startParameters = new StartParameters(args);

            channelName = startParameters.ChannelName;

            AssembliesManager.LoadAssembly(startParameters.TesterAssembly);

            if (string.IsNullOrEmpty(channelName))
            {
                SendError(new Exception("Channel name for interprocess communication was not set."));
                return;
            }
            try
            {
                ExperimentScope.Start(startParameters);
            }
            catch (Exception ex)
            {
                SendError(ex);
            }
        }
        public static void Start(StartParameters startParameters)
        {
            using (var testObserver = new TestObserver(startParameters.ChannelName))
            {
                var suite = AssemblyLoader.CreateInstance <PerfTestSuite>(
                    startParameters.SuiteAssembly, startParameters.SuiteType);

                var subject = AssemblyLoader.CreateInstanceFullyQualifiedName(
                    startParameters.SubjectAssembly, startParameters.SubjectType);

                var start = startParameters.Start;
                var step  = startParameters.Step;
                var end   = startParameters.End;

                if (suite != null && subject != null)
                {
                    var test = suite.Tests.First(x => x.TestMethodName == startParameters.TestMethod && x.TestedType == subject.GetType());

                    PerfTestResultFactory.Instance.Init(test.TestId);

                    var runner = new TestRunner(
                        delegate(int idx) { suite.SetUp(idx, subject); },
                        delegate { test.Test(subject); },
                        delegate { suite.TearDown(subject); },
                        delegate(int idx) { return(suite.GetRunDescriptor(idx)); },
                        string.IsNullOrEmpty(start) ? 0 : int.Parse(start),
                        string.IsNullOrEmpty(step) ? 1 : int.Parse(step),
                        string.IsNullOrEmpty(end) ? suite.DefaultTestCount : int.Parse(end),
                        startParameters.IgnoreFirstRunDueToJITting,
                        startParameters.TriggerGCBeforeEachTest);

                    runner.Subscribe(testObserver);
                    testObserver.OnCompleted();
                }
                else
                {
                    testObserver.OnError(new Exception());
                }
            }
        }
Exemple #5
0
        public static void Start(StartParameters startParameters)
        {
            using (var testObserver = new TestObserver(startParameters.ChannelName))
            {
                var suite = AssemblyLoader.CreateInstance<PerfTestSuite>(
                    startParameters.SuiteAssembly, startParameters.SuiteType);

                var subject = AssemblyLoader.CreateInstanceFullyQualifiedName(
                    startParameters.SubjectAssembly, startParameters.SubjectType);

                var start = startParameters.Start;
                var step = startParameters.Step;
                var end = startParameters.End;

                if (suite != null && subject != null)
                {
                    var test = suite.Tests.First(x => x.TestMethodName == startParameters.TestMethod && x.TestedType == subject.GetType());

                    PerfTestResultFactory.Instance.Init(test.TestId);

                    var runner = new TestRunner(
                        delegate(int idx) { suite.SetUp(idx, subject); },
                        delegate { test.Test(subject); },
                        delegate { suite.TearDown(subject); },
                        delegate(int idx) { return suite.GetRunDescriptor(idx); },
                        string.IsNullOrEmpty(start) ? 0 : int.Parse(start),
                        string.IsNullOrEmpty(step) ? 1 : int.Parse(step),
                        string.IsNullOrEmpty(end) ? suite.DefaultTestCount : int.Parse(end),
                        startParameters.IgnoreFirstRunDueToJITting,
                        startParameters.TriggerGCBeforeEachTest);

                    runner.Subscribe(testObserver);
                    testObserver.OnCompleted();
                }
                else
                {
                    testObserver.OnError(new Exception());
                }
            }
        }