Ejemplo n.º 1
0
		public static Test Create (string id, string input_file, string master_file, XmlNode node)
		{
			string generated_html = String.Concat (input_file, ".g.htm");

			//
			// For now, let's regen every time, in the future we can enable this optimization
			//
			//if (File.Exists (generated_html)
			//
			
			GenerateHtmlFile (generated_html, input_file);
			Test test = new HtmlTest (id, generated_html, master_file, node);

			// Some tests dont actually have xaml files
			if (!File.Exists (input_file))
				test.SetToIgnore (String.Format ("Xaml file does not exist: {0}", input_file));

			return test;
		}
Ejemplo n.º 2
0
        public static Test Create(string id, string input_file, string master_file, XmlNode node)
        {
            string generated_html = String.Concat(input_file, ".g.htm");

            //
            // For now, let's regen every time, in the future we can enable this optimization
            //
            //if (File.Exists (generated_html)
            //

            GenerateHtmlFile(generated_html, input_file);
            Test test = new HtmlTest(id, generated_html, master_file, node);

            // Some tests dont actually have xaml files
            if (!File.Exists(input_file))
            {
                test.SetToIgnore(String.Format("Xaml file does not exist: {0}", input_file));
            }

            return(test);
        }
Ejemplo n.º 3
0
Archivo: Test.cs Proyecto: dfr0/moon
		public static Test Create (string base_directory, XmlNode node)
		{
			Test test;
			string id = null;
			string input_file = null;
			string master_file = null;
			string extension = null;
			bool remote = false;
			bool unittest = false;
			
			if (node.Attributes ["id"] != null)
				id = node.Attributes ["id"].Value;
			
			if (node.Attributes ["remote"] != null && bool.Parse (node.Attributes ["remote"].Value))
				remote = true;

			if (node.Attributes ["unittest"] != null)
				bool.TryParse (node.Attributes ["unittest"].Value, out unittest);
			
			if (node.Attributes ["inputFile"] != null) {
				input_file = node.Attributes ["inputFile"].Value;
				if (!remote)
					input_file = Path.Combine (base_directory, input_file);
			}

			if (node.Attributes ["masterFile"] != null)
				master_file = Path.Combine (base_directory, node.Attributes ["masterFile"].Value);
			else if (node.Attributes ["masterFile10"] != null)
				master_file = Path.Combine (base_directory, node.Attributes ["masterFile10"].Value);

			if (id == null || input_file == null || master_file == null)
				return null;

			if (remote) // Treat all remote files as html files
				extension = ".html";
			else
				extension = Path.GetExtension (input_file);
			
			switch (extension) {
			case ".xaml":
				test = XamlTest.Create (id, input_file, master_file, node);
				break;
			case ".htm":
			case ".html":
				test = new HtmlTest (id, input_file, master_file, node);
				break;
			default:
				Console.Error.WriteLine ("The test {0} is invalid, the test has to have a htm(l) or xaml extension.", input_file);
				return null;
			}
			
			test.base_directory = base_directory;
			test.remote = remote;
			test.unittest = unittest;
			
			if (node.Attributes ["knownFailure"] != null && Boolean.Parse (node.Attributes ["knownFailure"].Value)) {
				test.known_failure = true;
				if (node.Attributes ["failureReason"] != null)
					test.known_failure_reason = node.Attributes ["failureReason"].Value;
			} else if (node.Attributes ["ignore"] != null && Boolean.Parse (node.Attributes ["ignore"].Value)) {
				test.SetToIgnore (String.Format ("Ignore specified in drtlist{0}",
						node.Attributes ["ignoreReason"] != null ? " -- " + node.Attributes ["ignoreReason"].Value + "." : "."));
			}

			if (node.Attributes ["timeout"] != null)
				test.timeout = Int32.Parse (node.Attributes ["timeout"].Value);

			if (node.Attributes ["imageCompareTolerance"] != null)
				test.image_compare_tolerance = Double.Parse (node.Attributes ["imageCompareTolerance"].Value);

			if (node.Attributes ["categories"] != null)
				test.SetCategories (node.Attributes ["categories"].Value);
			
			if (node.Attributes ["xspExecDir"] != null)
				test.xsp_exec_dir = node.Attributes ["xspExecDir"].Value;

			if (node.Attributes ["codebehind"] != null)
				test.codebehind = node.Attributes ["codebehind"].Value;

			
			if (node.Attributes ["location"] != null) {
				test.location = node.Attributes ["location"].Value;
				test.LocationPort = AvailableLocationPort++;
				test.remote = true;
			}
			
			return test;
		}
Ejemplo n.º 4
0
Archivo: Test.cs Proyecto: ynkbt/moon
        public static Test Create(string base_directory, XmlNode node)
        {
            Test   test;
            string id          = null;
            string input_file  = null;
            string master_file = null;
            string extension   = null;
            bool   remote      = false;
            bool   unittest    = false;

            if (node.Attributes ["id"] != null)
            {
                id = node.Attributes ["id"].Value;
            }

            if (node.Attributes ["remote"] != null && bool.Parse(node.Attributes ["remote"].Value))
            {
                remote = true;
            }

            if (node.Attributes ["unittest"] != null)
            {
                bool.TryParse(node.Attributes ["unittest"].Value, out unittest);
            }

            if (node.Attributes ["inputFile"] != null)
            {
                input_file = node.Attributes ["inputFile"].Value;
                if (!remote)
                {
                    input_file = Path.Combine(base_directory, input_file);
                }
            }

            if (node.Attributes ["masterFile"] != null)
            {
                master_file = Path.Combine(base_directory, node.Attributes ["masterFile"].Value);
            }
            else if (node.Attributes ["masterFile10"] != null)
            {
                master_file = Path.Combine(base_directory, node.Attributes ["masterFile10"].Value);
            }

            if (id == null || input_file == null || master_file == null)
            {
                return(null);
            }

            if (remote)             // Treat all remote files as html files
            {
                extension = ".html";
            }
            else
            {
                extension = Path.GetExtension(input_file);
            }

            switch (extension)
            {
            case ".xaml":
                test = XamlTest.Create(id, input_file, master_file, node);
                break;

            case ".htm":
            case ".html":
                test = new HtmlTest(id, input_file, master_file, node);
                break;

            default:
                Console.Error.WriteLine("The test {0} is invalid, the test has to have a htm(l) or xaml extension.", input_file);
                return(null);
            }

            test.base_directory = base_directory;
            test.remote         = remote;
            test.unittest       = unittest;

            if (node.Attributes ["knownFailure"] != null && Boolean.Parse(node.Attributes ["knownFailure"].Value))
            {
                test.known_failure = true;
                if (node.Attributes ["failureReason"] != null)
                {
                    test.known_failure_reason = node.Attributes ["failureReason"].Value;
                }
            }
            else if (node.Attributes ["ignore"] != null && Boolean.Parse(node.Attributes ["ignore"].Value))
            {
                test.SetToIgnore(String.Format("Ignore specified in drtlist{0}",
                                               node.Attributes ["ignoreReason"] != null ? " -- " + node.Attributes ["ignoreReason"].Value + "." : "."));
            }

            if (node.Attributes ["timeout"] != null)
            {
                test.timeout = Int32.Parse(node.Attributes ["timeout"].Value);
            }

            if (node.Attributes ["imageCompareTolerance"] != null)
            {
                test.image_compare_tolerance = Double.Parse(node.Attributes ["imageCompareTolerance"].Value);
            }

            if (node.Attributes ["categories"] != null)
            {
                test.SetCategories(node.Attributes ["categories"].Value);
            }

            if (node.Attributes ["xspExecDir"] != null)
            {
                test.xsp_exec_dir = node.Attributes ["xspExecDir"].Value;
            }

            if (node.Attributes ["codebehind"] != null)
            {
                test.codebehind = node.Attributes ["codebehind"].Value;
            }


            if (node.Attributes ["location"] != null)
            {
                test.location     = node.Attributes ["location"].Value;
                test.LocationPort = AvailableLocationPort++;
                test.remote       = true;
            }

            return(test);
        }