Exemple #1
0
 public IEnumerable<TestResult> Run(Plugin plugin, string id, RunSettings settings)
 {
     _directories.Add(Path.GetDirectoryName(settings.Assembly.Assembly));
     _directories.Add(Path.GetDirectoryName(plugin.Assembly));
     Logger.Write("About to create plugin {0} in {1} for {2}", plugin.Type, plugin.Assembly, id);
     var runner = getRunner(plugin);
     try
     {
         if (runner == null)
             return _results;
         Logger.Write("Matching plugin identifier ({0}) to test identifier ({1})", runner.Identifier, id);
         if (!runner.Identifier.ToLower().Equals(id.ToLower()))
             return _results;
         Logger.Write("Checking whether assembly contains tests for {0}", id);
         if (!runner.ContainsTestsFor(settings.Assembly.Assembly))
             return _results;
         Logger.Write("Starting test run");
         return runner.Run(settings);
     }
     catch
     {
         throw;
     }
     finally
     {
         AppDomain.CurrentDomain.AssemblyResolve -= CurrentDomain_AssemblyResolve;
     }
 }
 public SubDomainRunner(Plugin plugin, string id, IEnumerable<string> categories, AssemblyOptions assembly, bool shouldLog)
 {
     _plugin = plugin;
     _id = id;
     _categories = categories;
     _assembly = assembly;
     _shouldLog = shouldLog;
 }
 public SubDomainRunner(Plugin plugin, string id, IEnumerable<string> categories, AssemblyOptions assembly, bool shouldLog, string pipeName, bool compatibilityMode)
 {
     _plugin = plugin;
     _id = id;
     _categories = categories;
     _assembly = assembly;
     _shouldLog = shouldLog;
     _pipeName = pipeName;
     _compatibilityMode = compatibilityMode;
 }
 private IAutoTestNetTestRunner getRunner(Plugin plugin)
 {
     try
     {
         return plugin.New();
     }
     catch (Exception ex)
     {
         _results.Add(ErrorHandler.GetError(plugin.Type, ex));
     }
     return null;
 }
 public IEnumerable<TestResult> Run(bool startLogger, Plugin plugin, string id, RunSettings settings)
 {
     if (startLogger)
         Logger.SetLogger(new ConsoleLogger());
     IEnumerable<TestResult> resultSet = null;
     var directories = new List<string>();
     directories.Add(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
     directories.Add(Path.GetDirectoryName(settings.Assembly.Assembly));
     directories.Add(Path.GetDirectoryName(plugin.Assembly));
     using (var resolver = new AssemblyResolver(directories.ToArray()))
     {
         Logger.Write("About to create plugin {0} in {1} for {2}", plugin.Type, plugin.Assembly, id);
         var runner = getRunner(plugin);
         var currentDirectory = Environment.CurrentDirectory;
         try
         {
             if (runner == null)
                 return _results;
             using (var server = new PipeServer(settings.PipeName))
             {
                 Logger.Write("Matching plugin identifier ({0}) to test identifier ({1})", runner.Identifier, id);
                 if (!runner.Identifier.ToLower().Equals(id.ToLower()) && !id.ToLower().Equals("any"))
                     return _results;
                 Logger.Write("Checking whether assembly contains tests for {0}", id);
                 if (!settings.Assembly.IsVerified && !runner.ContainsTestsFor(settings.Assembly.Assembly))
                     return _results;
                 Logger.Write("Initializing channel");
                 runner.SetLiveFeedbackChannel(new TestFeedbackProvider(server));
                 var newCurrent = Path.GetDirectoryName(settings.Assembly.Assembly);
                 Logger.Write("Setting current directory to " + newCurrent);
                 Environment.CurrentDirectory = newCurrent;
                 Logger.Write("Starting test run");
                 resultSet = runner.Run(settings);
             }
         }
         catch
         {
             throw;
         }
         finally
         {
             Environment.CurrentDirectory = currentDirectory;
         }
     }
     return resultSet;
 }
 public IEnumerable<TestResult> Run(Plugin plugin, RunSettings options)
 {
     return plugin.New().Run(options);
 }
 public void SetUp()
 {
     int a = 3;
     _plugin = new Plugin(typeof(Runner).Assembly.Location, typeof(Runner).FullName);
     _runner = _plugin.New();
 }
 private RunnerOptions getTests(Plugin plugin, TestRunInfo[] runInfos)
 {
     var instance = plugin.New();
     if (instance == null)
         return null;
     var infos = runInfos.Where(x => instance.ContainsTestsFor(x.Assembly));
     if (infos.Count() == 0)
         return null;
     return getRunnerOptions(infos, instance);
 }