Exemple #1
0
        private void lblLoadAssembly_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (_pluginLoader.TestRunnersPluginList.Count <= 0)
            {
                MessageBox.Show(string.Format(@"No test framework plugins found. Make sure you have a test framework plugin at {0} before opening the runner",
                                              Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Plugins\TestRunners")), @"Missing plugin", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            ResetTestExecution();
            DisableOrEnableControls(false);
            try
            {
                cmbxFilter.SelectedIndex = 0;

                var fileDialog = new OpenFileDialog {
                    DefaultExt = ".dll", CheckFileExists = true, Multiselect = false
                };

                var foundAssembly = fileDialog.ShowDialog();

                if (foundAssembly != DialogResult.OK)
                {
                    return;
                }

                var assemblyFile = fileDialog.FileName;

                _testFrameworkRunner.SetAssemblyPath(assemblyFile);

                _rcRunner.SetTestRunner(_testFrameworkRunner);

                _rcRunner.SetPluginLoader(_pluginLoader);

                _rcRunner.LoadAssembly();

                cmbxAttributes.Items.Clear();

                foreach (var attributes in _rcRunner.CustomAttributesList)
                {
                    cmbxAttributes.Items.Add(attributes);
                }

                for (var i = 0; i < cmbxAttributes.Items.Count; i++)
                {
                    cmbxAttributes.SetItemChecked(i, true);
                }

                LoadTestScriptListToView(_rcRunner.TestClassesList);

                LoadClassList(_rcRunner.TestClassesList);

                lblTotalScripts.Text = @"Total: " + _rcRunner.TestClassesList.Count;
            }
            finally
            {
                DisableOrEnableControls(true);
            }
        }
Exemple #2
0
        private static bool PrepareforRun(string runnerName, string assembly)
        {
            PluginLoader.LoadTestExecutionPlugins();

            PluginLoader.LoadTestRunnerAssembly(runnerName);

            var testFrameworkRunner = PluginLoader.TestRunnersPluginList.FirstOrDefault();

            if (testFrameworkRunner == null)
            {
                return(false);
            }

            testFrameworkRunner.SetAssemblyPath(assembly);

            var testResultsFolder = CreateTestResultsFolder();

            testFrameworkRunner.SetTestResultsFolder(testResultsFolder);

            RCRunnerAPI.SetTestRunner(testFrameworkRunner);

            RCRunnerAPI.SetPluginLoader(PluginLoader);

            RCRunnerAPI.LoadAssembly();

            return(true);
        }