コード例 #1
0
 public void generateLog(TestElement t, string result, string author)
 {
     this.TestResult = result;
     this.author     = author;
     this.testDriver = t.testDriver;
     this.testName   = t.testName;
     this.timeStamp  = DateTime.Now;
     foreach (string lib in t.testCodes)
     {
         this.testCode.Add(lib);
         this.testCodes += "  " + lib;
     }
 }
コード例 #2
0
        public static string createTestRequest(string testDriver, string testCode)
        {
            count++;
            TestElement te = new TestElement("test" + count);

            te.addDriver(testDriver);
            te.addCode(testCode);
            TestRequest tr = new TestRequest();

            tr.author = "Karthik Bangera";
            tr.tests.Add(te);
            return(tr.ToXml());
        }
コード例 #3
0
        public static string makeTestRequest(string author)
        {
            TestElement te1 = new TestElement("test1");

            te1.addDriver("TestDriver3.dll");
            te1.addCode("CodeToTest3.dll");

            TestRequest tr = new TestRequest();

            tr.author = author;
            tr.tests.Add(te1);
            return(tr.ToXml());
        }
コード例 #4
0
        //----< message creator >----------------------------------------

        /*
         * This is a placeholder using types defined in CommChannelDemo.MessageTest
         * You need a more efficient mechanism for creating messages.
         * Here's a suggestion:
         * - create MessageBody class for each message body type.
         * - use serializer, as demoed in TestDeserializer, to generate the
         *   body XML.
         * - On the other end deserialize, using the MessageBody type.
         */
        public string makeTestRequest()
        {
            TestElement te1 = new TestElement("test1");

            te1.addDriver("td1.dll");
            te1.addCode("t1.dll");
            te1.addCode("t2.dll");
            TestElement te2 = new TestElement("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);
            return(tr.ToXml());
        }
コード例 #5
0
        static void Main(string[] args)
        {
            Message msg = new Message();

            msg.to     = "http://localhost:8080/ICommunicator";
            msg.from   = "http://localhost:8081/ICommunicator";
            msg.author = "Bangera";
            msg.type   = "TestRequest";

            Console.Write("\n  Testing Message with Serialized TestRequest");
            Console.Write("\n ---------------------------------------------\n");
            TestElement te1 = new TestElement("test1");

            te1.addDriver("td1.dll");
            te1.addCode("tc1.dll");
            te1.addCode("tc2.dll");
            TestElement te2 = new TestElement("test2");

            te2.addDriver("td2.dll");
            te2.addCode("tc3.dll");
            te2.addCode("tc4.dll");
            TestRequest tr = new TestRequest();

            tr.author = "Karthik Bangera";
            tr.tests.Add(te1);
            tr.tests.Add(te2);
            msg.body = tr.ToXml();

            Console.Write("\n  Serialized TestRequest:");
            Console.Write("\n -------------------------\n");
            Console.Write(msg.body.shift());

            Console.Write("\n  TestRequest Message:");
            Console.Write("\n ----------------------");
            msg.showMsg();

            Console.Write("\n  Testing Deserialized TestRequest");
            Console.Write("\n ----------------------------------\n");
            TestRequest trDS = msg.body.FromXml <TestRequest>();

            Console.Write(trDS.showThis());
        }
コード例 #6
0
        //----------- Parses the xml string -----------
        public TestRequest parse(String xml)
        {
            try
            {
                //parses the xml string.
                doc_ = XDocument.Parse(xml);
                if (doc_ != null)
                {
                    string author = doc_.Descendants("author").First().Value;
                    tr.author = author;

                    // Console.WriteLine("\n--> Inside Parser. Current Domain : {0}", AppDomain.CurrentDomain.FriendlyName);
                    XElement[] xtests   = doc_.Descendants("TestElement").ToArray();
                    int        numTests = xtests.Count();
                    foreach (var xtest in xtests)
                    {
                        TestElement test = new TestElement();
                        test.testName   = xtest.Element("testName").Value;
                        test.testDriver = xtest.Element("testDriver").Value;
                        XElement xtestCodes = xtest.Element("testCodes");
                        IEnumerable <XElement> xLibraries = xtestCodes.Elements("string");
                        foreach (var lib in xLibraries)
                        {
                            test.testCodes.Add(lib.Value);
                        }
                        tr.tests.Add(test);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("\n\n-->##### Exception caught in Parser: {0}", ex.Message);
                tr = null;       //Passes null to the test list (List<Test>) if any error encountered while parsing.
                Console.WriteLine("\n\n-->Assigned NULL to test case List");
                Console.WriteLine("\n\n-->*** XML FILE needs to be fixed!!");
            }


            // Console.WriteLine("\n--> Exiting Parser & returning <Test List>. Current Domain : {0}", AppDomain.CurrentDomain.FriendlyName);
            return(tr);
        }
コード例 #7
0
        public static string makeTestRequest(string testDriver, string testCode)
        {
            //TestElement te1 = new TestElement("test1");
            //te1.addDriver("TestDriver1.dll");
            //te1.addCode("CodeToTest1.dll");
            //TestElement te2 = new TestElement("test2");
            //te2.addDriver("TestDriver2.dll");
            //te2.addCode("CodeToTest2.dll");
            //TestRequest tr = new TestRequest();
            //tr.author = "Karthik Bangera";
            //tr.tests.Add(te1);
            //tr.tests.Add(te2);
            //return tr.ToXml();
            count++;
            TestElement te = new TestElement("test" + count);

            te.addDriver(testDriver);
            te.addCode(testCode);
            TestRequest tr = new TestRequest();

            tr.author = "Karthik Bangera";
            tr.tests.Add(te);
            return(tr.ToXml());
        }