Esempio n. 1
0
 public TestPlanVew(TestDescription test, IEnumerable<ParChild> processings)
 {
     Debug.Assert(test != null);
     Debug.Assert(processings != null);
     Test = test;
     Processings = processings;
 }
Esempio n. 2
0
 private void getRemarksInfo()
 {
     vm.TestDescriptionList.Clear();
     try
     {
         XElement rooEl = XElement.Load(@"./configfiles/RemarksInfo.xml");
         var      xmlTestDescriptionList = rooEl.Elements("TestDescription");
         foreach (var testDescription in xmlTestDescriptionList)
         {
             TestDescription desp = new TestDescription();
             desp.DescType  = TestStepFactory.GetAttibute(testDescription, "type");
             desp.DescName  = TestStepFactory.GetAttibute(testDescription, "displayName");
             desp.DescValue = TestStepFactory.GetAttibute(testDescription, "value");
             string source = TestStepFactory.GetAttibute(testDescription, "source");
             if (!string.IsNullOrWhiteSpace(source))
             {
                 desp.DescSource = source.Split(',').ToList();
             }
             vm.TestDescriptionList.Add(desp);
         }
         getRemarksUserControl();
     }
     catch (Exception ex)
     {
         DataUtils.LOGINFO.WriteError(ex.Message + Environment.NewLine + ex.StackTrace + Environment.NewLine + ex.Source);
     }
 }
Esempio n. 3
0
        public void StartTest()
        {
            string className;

            className = TestContext.CurrentContext.Test.ClassName;
            className = className.Substring(className.LastIndexOf(".") + 1);
            string TestFullName = TestContext.CurrentContext.Test.FullName;
            string TestName     = TestFullName.Substring(TestFullName.IndexOf(".", TestFullName.IndexOf(".") + 1) + 1);
            string TestDescription;

            try
            {
                TestDescription = TestContext.CurrentContext.Test.Properties.Get("Description").ToString();
                TestDescription = "<br><font size='1'>" + TestDescription + "</font>";
            }
            catch (System.Exception)
            {
                TestDescription = "";
            }
            ExtentReportUtil.Test = ExtentReportUtil.extent.CreateTest(TestName + " " + TestDescription);
            if (TestDescription.Contains("API"))
            {
            }
            else
            {
                new Common().LaunchBrowser(GlobalVariables.Browser)
                .NavigateTo(GlobalVariables.URL);
            }
            testData = new XMLTestDataReader();
            //testData.SetXMLName(className);
            GlobalVariables.testCaseID = TestContext.CurrentContext.Test.MethodName;
        }
Esempio n. 4
0
        public void TestWithNoBlob()
        {
            var            test      = new TestDescription(MethodBase.GetCurrentMethod().Name, this.GetType().Name);
            ImageGenerator generator = new ImageGenerator(test.Name);
            var            img       = generator.RenderImage();

            TestImageHelper.SaveBitmap(test.FileName_Image, img);

            Sink.ResetPoints();
            var sut     = new MarkerScanner(Sink.PromptNewMessage_Handler, Sink.OnAnchorSetEvent, Sink.OnMovingTipSetEvent);
            var profile = new TargetProfile()
            {
                Centre = new BlobCentre()
                {
                    X = 300, Y = 300
                }, Color = System.Drawing.Color.FromArgb(255, 255, 255)
            };

            Sink.MyLog.Clear();
            var pImg = sut.TryToSetAnchor(img, profile);

            TestImageHelper.SaveBitmap(test.FileName_Processed, pImg as BitmapSource);

            Assert.IsTrue(Sink.MyLog.Count > 2);
            Assert.IsTrue(Sink.MyLog[Sink.MyLog.Count - 2].Contains("Unable to find reference point with size"));
            Assert.IsTrue(Sink.MyLog[Sink.MyLog.Count - 1].Contains("No suitable marker for Anchor point not found"));

            Assert.AreEqual(null, sut.Profile);
        }
Esempio n. 5
0
        private void SendMutationTestToDispatcher(MutantMetaData mutation)
        {
            TestDescription testDescription = new TestDescription(Path.Combine(mutation.TestDirectory.FullName, Path.GetFileName(TestAssemblyLocation)), _testsToRun, _benchmark.TotalMs);

            _pendingTest.Add(testDescription.Uid, mutation);
            _dispatcher.SendTest(testDescription);
        }
Esempio n. 6
0
        public void CanAddTemplates()
        {
            var test = new TestDescription();

            test.AddTemplate("Foo {{bar}}");
            Assert.Equal("Foo {{bar}}", test.Templates[0].Template);
        }
Esempio n. 7
0
 public TestPlanVew(TestDescription test, IEnumerable <ParChild> processings)
 {
     Debug.Assert(test != null);
     Debug.Assert(processings != null);
     Test        = test;
     Processings = processings;
 }
Esempio n. 8
0
        public void CanAddDescriptors()
        {
            var test = new TestDescription();

            test.AddDescriptor("color", new string[] { "red", "green", "blue" });
            Assert.Equal(new string[] { "red", "green", "blue" }, test.Descriptors["color"]);
        }
        public void TestWithNoPreset()
        {
            var            test      = new TestDescription(MethodBase.GetCurrentMethod().Name, this.GetType().Name);
            ImageGenerator generator = new ImageGenerator(test.Name);
            var            img       = generator.RenderImage();

            TestImageHelper.SaveBitmap(test.FileName_Image, img);

            Sink.ResetPoints();
            var sut     = new MarkerScanner(Sink.PromptNewMessage_Handler, Sink.OnAnchorSetEvent, Sink.OnMovingTipSetEvent);
            var profile = new TargetProfile()
            {
                Centre = new BlobCentre()
                {
                    X = 300, Y = 300
                }, Color = System.Drawing.Color.FromArgb(255, 255, 255)
            };

            Sink.MyLog.Clear();
            var pImg = sut.ProcessImage(img, 3);

            TestImageHelper.SaveBitmap(test.FileName_Processed, pImg as BitmapSource);

            Assert.IsTrue(Sink.MyLog.Count == 1);
            Assert.IsTrue(Sink.MyLog[0].Contains("Anchor point not found. Please specify Anchor point first"));

            Assert.AreEqual(null, sut.Profile);
        }
        public void TestWithCorrectPreset()
        {
            var            test      = new TestDescription(MethodBase.GetCurrentMethod().Name, this.GetType().Name);
            ImageGenerator generator = new ImageGenerator(test.Name);
            Marker         vAncor    = new Marker()
            {
                Center   = ImageGenerator.DefaultCentre,
                Diameter = 60,
                Fill     = Colors.Green,
                Border   = Colors.Gray
            };

            generator.AddMarkerToImage(vAncor);

            Marker vTip = new Marker()
            {
                Center   = ImageGenerator.DefaultCentre + new Vector(0, ImageGenerator.DefaultRadius),
                Diameter = 100,
                Fill     = Colors.Blue,
                Border   = Colors.Gray
            };

            generator.AddMarkerToImage(vTip);

            var img = generator.RenderImage();

            TestImageHelper.SaveBitmap(test.FileName_Image, img);

            var sut      = new MarkerScanner(Sink.PromptNewMessage_Handler, Sink.OnAnchorSetEvent, Sink.OnMovingTipSetEvent);
            var aProfile = new TargetProfile()
            {
                Centre = new BlobCentre(vAncor.Center, 0), Color = Extensions.SetColor(vAncor.Fill)
            };
            var mtProfile = new TargetProfile()
            {
                Centre = new BlobCentre(vTip.Center, 0), Color = Extensions.SetColor(vTip.Fill)
            };

            Sink.MyLog.Clear();
            Sink.ResetPoints();
            sut.TryToSetAnchor(img, aProfile);
            sut.TryToSetTip(img, mtProfile);

            var pImg = sut.ProcessImage(img, 1);

            TestImageHelper.SaveBitmap(test.FileName_Processed, pImg as BitmapSource);

            Assert.AreEqual(vAncor.Center.X, Sink.Anchor.C.X, 2);
            Assert.AreEqual(vAncor.Center.Y, Sink.Anchor.C.Y, 2);
            Assert.AreEqual(vAncor.Diameter, Sink.Anchor.D, 2);

            Assert.AreEqual(aProfile.Centre.X, sut.Profile.Anchor.Initial.Centre.X);
            Assert.AreEqual(aProfile.Centre.Y, sut.Profile.Anchor.Initial.Centre.Y);
            Assert.AreEqual(aProfile.Centre.D, sut.Profile.Anchor.Initial.Centre.D);

            Assert.AreEqual(vTip.Center.X, Sink.MovingTip.C.X, 2);
            Assert.AreEqual(vTip.Center.Y, Sink.MovingTip.C.Y, 2);
            Assert.AreEqual(vTip.Diameter, Sink.MovingTip.D, 2);
        }
Esempio n. 11
0
        protected virtual void OnTranslated(TestDescription testdescription, string xml)
        {
            TranslatedInputDocumentDelegate handler = Translated;

            if (handler != null)
            {
                handler(testdescription, xml);
            }
        }
Esempio n. 12
0
        protected virtual void OnDocumentParsed(TestDescription td, string xml)
        {
            TranslatedInputDocumentDelegate handler = InputDocumentTranslated;

            if (handler != null)
            {
                handler(td, xml);
            }
        }
Esempio n. 13
0
        protected virtual void OnTestDescriptionChanged(TestDescription testdescription)
        {
            ProjectTestDescriptionChangedDeligate handler = TestDescriptionChanged;

            if (handler != null)
            {
                handler(testdescription);
            }
        }
Esempio n. 14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HackedBaseActorTest"/> class.
 /// </summary>
 /// <param name="description">
 /// The description.
 /// </param>
 protected HackedBaseActorTest(TestDescription description) : base(description.System)
 {
     description.Container.Register(Component.For<IActorRef>().Instance(this.TestActor).Named("testActor").LifestyleTransient());
     description.Container.Register(Component.For<IWindsorContainer>().Instance(description.Container).LifestyleSingleton());
     description.Container.Register(Component.For<ActorSystem>().Instance(this.Sys).LifestyleSingleton());
     description.Container.Register(Component.For<Config>().Instance(this.Sys.Settings.Config).LifestyleSingleton());
     this.WindsorContainer = description.Container;
     ServiceLocator.SetLocatorProvider(() => new WindsorServiceLocator(this.WindsorContainer));
 }
Esempio n. 15
0
        public void TestWithTwoBlobAndOtherCorrectPosition()
        {
            var            test      = new TestDescription(MethodBase.GetCurrentMethod().Name, this.GetType().Name);
            ImageGenerator generator = new ImageGenerator(test.Name);
            Marker         vAncor    = new Marker()
            {
                Center   = new Point(300, 400),
                Diameter = 60,
                Fill     = Colors.Green,
                Border   = Colors.Gray
            };

            generator.AddMarkerToImage(vAncor);

            Marker vTip = new Marker()
            {
                Center   = new Point(900, 800),
                Diameter = 100,
                Fill     = Colors.Green,
                Border   = Colors.Gray
            };

            generator.AddMarkerToImage(vTip);

            var img = generator.RenderImage();

            TestImageHelper.SaveBitmap(test.FileName_Image, img);

            Sink.ResetPoints();
            var sut     = new MarkerScanner(Sink.PromptNewMessage_Handler, Sink.OnAnchorSetEvent, Sink.OnMovingTipSetEvent);
            var profile = new TargetProfile()
            {
                Centre = new BlobCentre()
                {
                    X = 900, Y = 800
                }, Color = Extensions.SetColor(vAncor.Fill)
            };

            Sink.MyLog.Clear();
            var pImg = sut.TryToSetAnchor(img, profile);

            TestImageHelper.SaveBitmap(test.FileName_Processed, pImg as BitmapSource);

            Assert.IsTrue(Sink.MyLog[Sink.MyLog.Count - 1].Contains("Anchor point set - Remaining dot preset as moving tip"));
            Assert.AreEqual(900, Sink.Anchor.C.X, 2);
            Assert.AreEqual(800, Sink.Anchor.C.Y, 2);
            Assert.AreEqual(100, Sink.Anchor.D, 2);

            Assert.AreEqual(profile.Centre.X, sut.Profile.Anchor.Initial.Centre.X);
            Assert.AreEqual(profile.Centre.Y, sut.Profile.Anchor.Initial.Centre.Y);
            Assert.AreEqual(profile.Centre.D, sut.Profile.Anchor.Initial.Centre.D);

            Assert.AreEqual(300, Sink.MovingTip.C.X, 2);
            Assert.AreEqual(400, Sink.MovingTip.C.Y, 2);
            Assert.AreEqual(60, Sink.MovingTip.D, 2);
        }
Esempio n. 16
0
 private static void RunDescribedTests(TestDescription testDescription)
 {
     if (testDescription.TestsToRun.Count == 0)
     {
         RunAllTests(testDescription);
     }
     else
     {
         RunSpecifiedTests(testDescription);
     }
 }
Esempio n. 17
0
        protected virtual void OnTestDescriptionCreated(TestDescription td, string xml)
        {
            LogManager.SourceInfo(ATMLTranslator.SOURCE, "The Test Description has been created and is ready for use.");
            TranslatedInputDocumentDelegate handler = InputDocumentTranslated;

            if (handler != null)
            {
                handler(td, xml);
            }
            OnAixmlTranslationCompleted(xml);
        }
Esempio n. 18
0
 private void OnProjectClosed()
 {
     _testDescription = null;
     _xmlDocument     = null;
     _requiredSignals.Clear();
     //_selectedTestStations.Clear();
     _sensors.Clear();
     _monitors.Clear();
     _sources.Clear();
     OnClosed();
 }
Esempio n. 19
0
        private long SeparatedProcessBench()
        {
            TestDescription toBench     = new TestDescription(_testAssemblyLocation, testsName, -1);
            TestDescription benchedTest = null;

            using (TestsBenchmarker benchProc = new TestsBenchmarker())
            {
                benchedTest = benchProc.Bench(toBench);
            }
            TestsPass = benchedTest.TestsPass;
            return(benchedTest.TotalMsBench);
        }
        private void OnTestDescriptionChanged(TestDescription testDescription)
        {
            lvSignals.Items.Clear();
            lvSignals.ShowGroups = true;
            Dictionary <string, ListViewGroup> groups = new Dictionary <string, ListViewGroup>();

            if (testDescription != null)
            {
                foreach (SignalRequirementsSignalRequirement signalRequirement in testDescription.SignalRequirements)
                {
                    if (signalRequirement.TsfClass != null && !"SHORT".Equals(signalRequirement.TsfClass.tsfClassName))
                    {
                        ListViewGroup grp;
                        if (groups.ContainsKey(signalRequirement.TsfClass.tsfClassName))
                        {
                            grp = groups[signalRequirement.TsfClass.tsfClassName];
                        }
                        else
                        {
                            grp = new ListViewGroup(signalRequirement.TsfClass.tsfClassName);
                            groups.Add(signalRequirement.TsfClass.tsfClassName, grp);
                            lvSignals.Groups.Add(grp);
                        }

                        ListViewItem lvi = new ListViewItem(signalRequirement.TsfClass.tsfLibraryID);
                        lvi.SubItems.Add(signalRequirement.TsfClass.tsfClassName);
                        StringBuilder sb = new StringBuilder();
                        foreach (SignalRequirementsSignalRequirementTsfClassAttribute attribute in signalRequirement.TsfClassAttribute)
                        {
                            sb.Append(string.Format("{0}={1}, ", attribute.Name.Value, attribute.Value));
                        }
                        if (sb.ToString().EndsWith(", "))
                        {
                            sb.Length = sb.Length - 2;
                        }
                        lvi.SubItems.Add(sb.ToString());
                        lvi.Tag   = signalRequirement;
                        lvi.Group = grp;
                        lvSignals.Items.Add(lvi);
                    }
                }

                foreach (ActionType actionType in testDescription.DetailedTestInformation.Actions)
                {
                    foreach (ActionTypeLocalSignal localSignal in actionType.LocalSignals)
                    {
                    }
                }

                lvSignals.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
            }
        }
Esempio n. 21
0
        private string CreateImageHtmlWithLinkToSideBySide(TestDescription test, DirectoryManager dirManager)
        {
            CopyImagesToReportOutputDir(test, dirManager);

            string html = "";

            var diffImageFileName = dirManager.GetDiffImageFileName(test.Name);
            var imageHtml         = _htmlSupport.CreateImageHtml(diffImageFileName, "diff image");

            html += _htmlSupport.GetLink(imageHtml, dirManager.GetSideBySideFilename(test));

            return(html);
        }
Esempio n. 22
0
        public void SupportsNamedDescriptors()
        {
            var data = new MemoryStore();

            data.SetValue("name", "ponytail");
            var descriptors = new MemoryStore();

            descriptors.AddListItem(new MemoryStore("color", "red, green, blue"));
            data.SetValue("descriptors", descriptors);
            var subject = new TestDescription(data);

            Assert.Single(subject.Descriptors.Keys, "color");
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="HackedBaseActorTest"/> class.
        /// </summary>
        /// <param name="description">
        /// The description.
        /// </param>
        protected HackedBaseActorTest(TestDescription description) : base(description.System)
        {
            var containerBuilder = description.ContainerBuilder;

            containerBuilder.RegisterInstance(this.TestActor).As <IActorRef>().Named("testActor", typeof(IActorRef));
            this.Container = containerBuilder.Build();
            this.Sys.AddDependencyResolver(new AutoFacDependencyResolver(this.Container, this.Sys));

            if (description.Configurator.RunPostStart)
            {
                BaseInstaller.RunPostStart(containerBuilder, this.Container);
            }
        }
Esempio n. 24
0
        public void FilterMutants_FiltersNoMutants_IfTestsChanged()
        {
            // Arrange
            var diffProvider = new Mock <IDiffProvider>(MockBehavior.Loose);

            var options = new StrykerOptions()
            {
                WithBaseline   = false,
                ProjectVersion = "version"
            };

            diffProvider.Setup(x => x.ScanDiff()).Returns(new DiffResult
            {
                ChangedSourceFiles = new List <string>(),
                ChangedTestFiles   = new List <string> {
                    "C:/testfile1.cs"
                }
            });

            var tests = new TestSet();
            var test1 = new TestDescription(Guid.NewGuid(), "name1", "C:/testfile1.cs");
            var test2 = new TestDescription(Guid.NewGuid(), "name2", "C:/testfile2.cs");

            tests.RegisterTests(new[] { test1, test2 });
            diffProvider.SetupGet(x => x.Tests).Returns(tests);
            var target    = new SinceMutantFilter(diffProvider.Object);
            var testFile1 = new TestsGuidList(new [] { test1 });
            var testFile2 = new TestsGuidList(new [] { test2 });

            var expectedToStay1 = new Mutant {
                CoveringTests = testFile1
            };
            var expectedToStay2 = new Mutant {
                CoveringTests = testFile1
            };
            var newMutant = new Mutant {
                CoveringTests = testFile2
            };
            var mutants = new List <Mutant>
            {
                expectedToStay1,
                expectedToStay2,
                newMutant
            };

            // Act
            var results = target.FilterMutants(mutants, new CsharpFileLeaf(), options);

            // Assert
            results.ShouldBe(new [] { expectedToStay1, expectedToStay2 });
        }
Esempio n. 25
0
        public void LoadXML(string xmlDocument)
        {
            try
            {
                _xmlDocument = xmlDocument;
                XNamespace ad = "urn:IEEE-1671.1:2009:TestDescription";
                _document = XDocument.Load(new StringReader(_xmlDocument));

                _testDescription = TestDescription.Deserialize(_xmlDocument);

                _sources.AddRange(_document.Descendants(ad + "Source"));
                _sensors.AddRange(_document.Descendants(ad + "Sensor"));
                _monitors.AddRange(_document.Descendants(ad + "Monitor"));

                foreach (SignalRequirementsSignalRequirement signalRequirement in _testDescription.SignalRequirements)
                {
                    _requiredSignals.Add(signalRequirement.TsfClass);
                }


                foreach (ActionType action in _testDescription.DetailedTestInformation.Actions)
                {
                    var operations = action.Behavior.Item as Operations1;
                    if (operations != null)
                    {
                        foreach (OperationType operation in operations.Operation)
                        {
                            var setup = operation as OperationSetup;
                            if (setup != null)
                            {
                                var source = setup.Item as OperationSetupSource;
                                if (source != null)
                                {
                                    LogManager.SourceTrace(ATMLAllocator.SOURCE, HttpUtility.HtmlEncode(source.Any.InnerXml.Trim()));
                                    XElement signal = XElement.Parse(source.Any.InnerXml.Trim());
                                    LogManager.SourceTrace(ATMLAllocator.SOURCE, "{0}:{1}", signal.GetPrefixOfNamespace(signal.Name.Namespace),
                                                           signal.Name.NamespaceName);
                                }
                            }
                        }
                    }
                }
                OnTestDescriptionChanged(_testDescription);
            }
            catch (Exception e)
            {
                LogManager.SourceError(ATMLAllocator.SOURCE, e);
            }
        }
Esempio n. 26
0
        public void CreatingADescriptionCombinesDescriptorsAndName()
        {
            var data = new MemoryStore();

            data.SetValue("name", "ponytail");
            var descriptors = new MemoryStore();

            descriptors.AddListItem(new MemoryStore("length", new string[] { "long" }));
            descriptors.AddListItem(new MemoryStore("texture", new string[] { "braided" }));
            data.SetValue("descriptors", descriptors);
            var subject = new TestDescription(data);
            var text    = subject.CreateDescription();

            Assert.Equal(text, "long braided ponytail");
        }
Esempio n. 27
0
        private static void RunDescribedTests(TestDescription testDescription)
        {
            bool exitedInTime;
            int  exitCode;

            using (Isolated <NunitManagedTestRunnerAdaptor> runner = new Isolated <NunitManagedTestRunnerAdaptor>())
            {
                var mutantPath = testDescription.AssemblyPath;
                runner.Instance.Start(mutantPath, testDescription.TestsToRun);
                exitedInTime = runner.Instance.WaitForExit((int)(_killTimeFactor * testDescription.TotalMsBench));
                exitCode     = runner.Instance.ExitCode;
            }
            testDescription.ExitedInTime = exitedInTime;
            testDescription.TestsPass    = (exitCode == 0);
        }
Esempio n. 28
0
        private void CopyImagesToReportOutputDir(TestDescription test, DirectoryManager dirManager)
        {
            //copy images to output dir, so that the report is self-contained:
            var expectedImageFilePath = dirManager.GetExpectedImageFilePath(test);
            var diffImageFilePath     = dirManager.GetDiffImageFilePath(test.Name);
            var actualImageFilePath   = dirManager.GetActualImageFilePath(test.Name);

            var outputDir = Path.GetDirectoryName(_argProc.GetArg(ArgsProcessor.Args.OUTPUT_FILE_PATH));
            var expectedImageFilePathInOutputDir = Path.Combine(outputDir, Path.GetFileName(expectedImageFilePath));
            var actualImageFilePathInOutputDir   = Path.Combine(outputDir, Path.GetFileName(actualImageFilePath));
            var diffImageFilePathInOutputDir     = Path.Combine(outputDir, Path.GetFileName(diffImageFilePath));

            CopyFile(expectedImageFilePath, expectedImageFilePathInOutputDir);
            CopyFile(actualImageFilePath, actualImageFilePathInOutputDir);
            CopyFile(diffImageFilePath, diffImageFilePathInOutputDir);
        }
Esempio n. 29
0
        private static void RunSpecifiedTests(TestDescription testDescription)
        {
            int exitCode;

            using (Isolated <NunitManagedTestRunnerAdaptor> runner = new Isolated <NunitManagedTestRunnerAdaptor>())
            {
                var mutantPath = testDescription.AssemblyPath;
                var watch      = Stopwatch.StartNew();
                runner.Instance.Start(mutantPath, testDescription.TestsToRun);
                runner.Instance.WaitForExit();
                watch.Stop();
                testDescription.TotalMsBench = watch.ElapsedMilliseconds;
                exitCode = runner.Instance.ExitCode;
            }
            testDescription.TestsPass = (exitCode == 0);
        }
        internal void CreateSideBySideFiles(TestDescription test, string testHeaderHtml)
        {
            var dirManager = new DirectoryManager(_argProc);

            var _templateCreator = new TemplateCreator(_argProc, TemplateCreator.TemplateNameSideBySide);

            _templateCreator.SetTemplateParam(TemplateCreator.TemplateParamHeader, testHeaderHtml);
            _templateCreator.SetTemplateParam(TemplateCreator.TemplateParamExpectedImage, dirManager.GetExpectedImageFilename(test));
            _templateCreator.SetTemplateParam(TemplateCreator.TemplateParamActualImage, dirManager.GetActualImageFilename(test.Name));
            _templateCreator.SetTemplateParam(TemplateCreator.TemplateParamName, test.Name);

            string outFilename = dirManager.GetSideBySideFilename(test);
            string outFilePath = Path.Combine(dirManager.GetOutputDirectoryFullPath(), outFilename);

            _templateCreator.Save(outFilePath);
        }
Esempio n. 31
0
        internal List <TestDescription> ReadFromFilePath(string path)
        {
            List <TestDescription> tests = new List <TestDescription>();

            using (var reader = new GenericCsvFileReader(path))
            {
                int column = 0;
                try
                {
                    CsvRow row = new CsvRow();
                    while (reader.ReadRow(row))
                    {
                        if (row.Count == 0)
                        {
                            continue;
                        }

                        column = 0;
                        TestDescription test = new TestDescription()
                        {
                            Name             = CleanText(row[column++]),
                            Description      = CleanText(row[column++]),
                            DivSelector      = CleanText(row[column++]),
                            Url              = CleanText(row[column++]),
                            Query1           = CleanText(row[column++]),
                            Query2           = CleanText(row[column++]),
                            Query3           = CleanText(row[column++]),
                            TitleContains    = CleanText(row[column++]),
                            WindowWidth      = CleanTextAsInt(row[column++]),
                            WindowHeight     = CleanTextAsInt(row[column++]),
                            CropAdjustWidth  = CleanTextAsInt(row[column++]),
                            CropAdjustHeight = CleanTextAsInt(row[column++]),
                            Tolerance        = CleanTextAsDouble(row[column++]),
                            SleepTimespan    = CleanTextAsTimespan(row[column++]),
                        };
                        tests.Add(test);
                    }
                }
                catch (Exception ex)
                {
                    throw new TestConfigReaderException(reader.CurrentRow, column + 1, ex);
                }
            }

            return(tests);
        }
Esempio n. 32
0
        public void ShouldNotFilterMutantsWhereCoveringTestsContainsChangedTestFile()
        {
            // Arrange
            var testProjectPath = "C:/MyTests";
            var options         = new StrykerOptions();

            var diffProvider = new Mock <IDiffProvider>(MockBehavior.Loose);

            // If a file inside the test project is changed, a test has been changed
            var myTestPath = Path.Combine(testProjectPath, "myTest.cs");;
            var tests      = new TestSet();
            var test       = new TestDescription(Guid.NewGuid(), "name", myTestPath);

            tests.RegisterTests(new[] { test });
            diffProvider.SetupGet(x => x.Tests).Returns(tests);
            diffProvider.Setup(x => x.ScanDiff()).Returns(new DiffResult
            {
                ChangedSourceFiles = new Collection <string>
                {
                    myTestPath
                },
                ChangedTestFiles = new Collection <string>
                {
                    myTestPath
                }
            });
            var target = new SinceMutantFilter(diffProvider.Object);

            // check the diff result for a file not inside the test project
            var file = new CsharpFileLeaf {
                FullPath = Path.Combine("C:/NotMyTests", "myfile.cs")
            };
            var mutant = new Mutant
            {
                CoveringTests = new TestsGuidList(new[] { test })
            };


            // Act
            var filterResult = target.FilterMutants(new List <Mutant> {
                mutant
            }, file, options);

            // Assert
            filterResult.ShouldContain(mutant);
        }
 public async void EndTest(TestMethod method)
 {
     await Dispatcher.InvokeAsync(() =>
     {
         if (method.Excluded)
         {
             _currentTest.Color = Color.FromArgb(0xFF, 0x66, 0x66, 0x66);
             ConsoleHelper.WriteLine("Skipped");
         }
         else if (!method.Passed)
         {
             _currentTest.Color = Color.FromArgb(0xFF, 0xFF, 0x00, 0x6E);
             ConsoleHelper.WriteLine("Failed"); 
         }
         else
         {
             _currentTest.Color = Color.FromArgb(0xFF, 0x2A, 0x9E, 0x39);
             ConsoleHelper.WriteLine("Passed");
         }
         _currentTest = null;
     });
 }
        public async void StartTest(TestMethod test)
        {
            await Dispatcher.InvokeAsync(async () =>
            {
                ConsoleHelper.Write("{0}...", test.Name);
                _currentTest = new TestDescription { Name = test.Name };
                _currentGroup.Add(_currentTest);
                _tests.Add(_currentTest);

                await Dispatcher.InvokeAsync(() =>
                {
                    lstTests.ScrollIntoView(_currentTest);
                });
            });
        }
Esempio n. 35
0
 public void SetUp()
 {
     description = new TestDescription();
 }