Ejemplo n.º 1
0
 public TestGroup(TestGroup root, Sputnik.TestCase testCase)
 {
     this.selected   = false;
     this.root       = root;
     this.TestCase   = testCase;
     this.TestGroups = new TestGroup[0];
 }
Ejemplo n.º 2
0
 public TestGroup(TestGroup root, Sputnik.TestCase testCase)
 {
     this.selected = false;
     this.root = root;
     this.TestCase = testCase;
     this.TestGroups = new TestGroup[0];
 }
Ejemplo n.º 3
0
        private void AddFailed(TestGroup test, string error, bool regression)
        {
            var testCase = test.TestCase;

            Dispatcher.Invoke(new Action(() => this.FailedTests.Add(new FailedTest
            {
                Name       = testCase.TestName,
                Path       = testCase.FullPath,
                Assertion  = testCase.Assertion,
                Exception  = error,
                TestGroup  = test,
                Regression = regression,
            })));
        }
Ejemplo n.º 4
0
        public MainWindow()
        {
            this.FailedTests = new ObservableCollection <FailedTest>();

            InitializeComponent();

            this.ignoreTests.Add("S15.5.4.14_A1_T6");
            this.ignoreTests.Add("S15.5.4.14_A1_T7");
            this.ignoreTests.Add("S15.5.4.14_A1_T8");
            this.ignoreTests.Add("S15.5.4.14_A1_T9");
            this.ignoreTests.Add("S15.5.4.14_A2_T7");
            this.ignoreTests.Add("S15.5.4.8_A1_T11");
            this.ignoreTests.Add("S15.5.4.11_A3_T1");
            this.ignoreTests.Add("S15.5.4.11_A3_T2");
            this.ignoreTests.Add("S15.5.4.11_A3_T3");
            this.ignoreFixtures.Add("Unicode\\Unicode_218\\");

            this.worker.DoWork                    += this.RunTests;
            this.worker.ProgressChanged           += this.Worker_ProgressChanged;
            this.worker.RunWorkerCompleted        += new RunWorkerCompletedEventHandler(Worker_RunWorkerCompleted);
            this.worker.WorkerReportsProgress      = true;
            this.worker.WorkerSupportsCancellation = true;

            var rootPath = Path.Combine(new DirectoryInfo(GetExecutableDirectory()).Parent.Parent.FullName, "sputnik-v1");

            libPath = Path.Combine(rootPath, "lib");
            var testsPath = Path.Combine(rootPath, "tests");

            this.rootTestGroup = new TestGroup(null, null)
            {
                Name = "Sputnik v1"
            };
            rootTestGroup.TestGroups = GenerateTestsList(rootTestGroup, testsPath, testsPath);
            this.TestGroups          = new[] { rootTestGroup };

            this.LoadResults();

            IronJS.Support.Debug.registerExprPrinter(this.ExprPrinter);
        }
Ejemplo n.º 5
0
        private IList <TestGroup> GatherTests(TestGroup rootTestGroup, Func <TestGroup, bool> hierarchicalCriteria)
        {
            Func <TestGroup, IList <TestGroup> > gatherTests = null;

            gatherTests = rootGroup =>
            {
                if (rootGroup.TestCase != null)
                {
                    return(new[] { rootGroup });
                }

                var groups = new List <TestGroup>();
                foreach (var group in rootGroup.TestGroups.Where(hierarchicalCriteria))
                {
                    groups.AddRange(gatherTests(group));
                }

                return(groups);
            };

            return(gatherTests(rootTestGroup));
        }
Ejemplo n.º 6
0
        private IList <TestGroup> GenerateTestsList(TestGroup root, string basePath, string path)
        {
            var groups = new List <TestGroup>();

            foreach (var dir in Directory.GetDirectories(path))
            {
                if (this.ignoreFixtures.Any(i => (dir + "\\").StartsWith(Path.Combine(basePath, i))))
                {
                    continue;
                }

                var group = new TestGroup(root, null)
                {
                    Name = Path.GetFileName(dir),
                };
                group.TestGroups = this.GenerateTestsList(group, basePath, dir);
                groups.Add(group);
            }

            foreach (var file in Directory.GetFiles(path, "*.js"))
            {
                if (this.ignoreTests.Contains(Path.GetFileNameWithoutExtension(file)))
                {
                    continue;
                }

                var testCase = new TestCase(basePath, file);
                var group    = new TestGroup(root, testCase)
                {
                    Name = testCase.TestName,
                };
                groups.Add(group);
            }

            return(groups);
        }