static void Main(string[] args)
        {
            ///////////////////////////////////////////////////////////////
            // Serialize and Deserialize TestRequest data structure

            TestElement te1 = new TestElement();

            te1.testName = "test1";
            te1.addDriver("td1.dll");
            te1.addCode("tc1.dll");
            te1.addCode("tc2.dll");

            TestElement te2 = new TestElement();

            te2.testName = "test2";
            te2.addDriver("td2.dll");
            te2.addCode("tc3.dll");
            te2.addCode("tc4.dll");

            TestRequest tr = new TestRequest();

            tr.author = "Jim Fawcett";
            tr.tests.Add(te1);
            tr.tests.Add(te2);
            string trXml = tr.ToXml();

            Console.Write("\n  Serialized TestRequest data structure:\n\n  {0}\n", trXml);

            TestRequest newRequest = trXml.FromXml <TestRequest>();
            string      typeName   = newRequest.GetType().Name;

            Console.Write("\n  deserializing xml string results in type: {0}\n", typeName);
            Console.Write(newRequest);
            Console.WriteLine();
        }
Beispiel #2
0
        /*----< Generates new build request >----------------*/

        private void Create_Click(object sender, RoutedEventArgs e)
        {
            List <String> testCases = new List <String>();
            List <String> drivers   = new List <String>();

            if (rightDriverBox.Items.Count <= 0)
            {
                MessageBox.Show("Please select and add a Test Driver");
                return;
            }
            else if (rightTCBox.Items.Count <= 0)
            {
                MessageBox.Show("Please select and add atleast one testcode");
                return;
            }
            else
            {
                foreach (String testcase in rightTCBox.Items)
                {
                    testCases.Add(System.IO.Path.GetFileName(testcase));
                }
                foreach (String driver in rightDriverBox.Items)
                {
                    drivers.Add(System.IO.Path.GetFileName(driver));
                }
                if (tr == null)
                {
                    tr = new TestRequest();
                }
                TestElement testElement = new TestElement();
                testElement.addDriver(drivers[0]);
                foreach (string testcode in testCases)
                {
                    testElement.addCode(testcode);
                }
                testElement.testName = "test" + testNo;
                testNo++;
                tr.author = "Jim Fawcett";
                tr.tests.Add(testElement);
            }
            String xml = tr.ToXml();

            Console.Write("\n\nThe created XML is:\n" + xml + "\n");
            createdBuildRequest.Clear();
            createdBuildRequest.Text = xml;
        }
Beispiel #3
0
        /*----< Returns a test request for test harness >----------------*/

        public string create_testrequest(List <LogData> test, string path, string name)
        {
            Console.Write("\n \nConstructing Test Request for TestHarness");
            List <TestElement> te = new List <TestElement>();

            foreach (LogData test1 in test)
            {
                if (test1.status.Equals("Build Success"))
                {
                    TestElement te1 = new TestElement();
                    te1.testName = test1.testname;
                    te1.addDriver(Path.GetFileNameWithoutExtension(test1.testDriver) + ".dll");
                    te.Add(te1);
                }
            }
            TestRequest tr = new TestRequest();

            tr.author = name;
            for (int i = 0; i < te.Count; i++)
            {
                tr.tests.Add(te[i]);
            }
            string trXml;

            if (tr.tests.Count >= 1)
            {
                trXml = tr.ToXml();
                File.WriteAllText(path + "/TestRequesttoHarness.xml", trXml);
                Console.Write("\n \nTestRequest for the TestHarness:\n {0}\n", trXml);
                return(trXml);
            }
            else
            {
                Console.Write("\n *******Build failed so stopping further execution******** ");
                return("");
            }
        }