예제 #1
0
파일: RepoMock.cs 프로젝트: nagraw01/SMA
        //function to create a build request based on the message args from client
        private void createRequest(CommMessage rcvMsg)
        {
            List<TestDriver> testD = new List<TestDriver>();

            foreach (string testCase in rcvMsg.arguments)
            {
                TestDriver td1 = new TestDriver();
                List<string> tested = new List<string>();

                XElement doc = XElement.Parse(testCase);
                foreach (XElement element in doc.Elements())
                {
                    if (element.Name == "driver")
                    {
                        td1.driverName = element.Value;
                    }
                    else
                    {
                        tested.Add(element.Value);
                    }
                }
                td1.testedFiles = tested;
                testD.Add(td1);
            }
            TestRequest tr = new TestRequest();
            string fileName = "TestRequest" + testReqCount.ToString() + ".xml";
            string fileSpec = System.IO.Path.Combine(storagePath, fileName);
            fileSpec = System.IO.Path.GetFullPath(fileSpec);
            tr.author = "Nishant Agrawal";
            tr.testDrivers = testD;
            tr.makeRequest();
            tr.saveXml(fileSpec);
            testReqCount++;
            Console.WriteLine("\nTest Request successfully built and saved on repo...\n----------------------------------------------------\n");
        }
예제 #2
0
파일: Builder.cs 프로젝트: nagraw01/SMA
        //function to create a test request to send to test harness
        private string createTestRequest()
        {
            List <TestDriver> testD = new List <TestDriver>();

            int i = 0;

            foreach (TestDriver driver in tr2.testDrivers)
            {
                driver.libName = testRequestDll[i];
                i++;
            }
            TestRequest trTemp   = new TestRequest();
            string      fileName = "TestExecRequest" + port + execCount + ".xml";
            string      fileSpec = System.IO.Path.Combine(builderPath, fileName);

            fileSpec = System.IO.Path.GetFullPath(fileSpec);

            trTemp.author      = tr2.author;
            trTemp.testDrivers = tr2.testDrivers;
            trTemp.makeTestHRequest();
            trTemp.saveXml(fileSpec);
            execCount++;

            Console.WriteLine("\nTest Request successfully built and saved on builder storage...\n----------------------------------------------------\n");
            return(fileName);
        }
예제 #3
0
        //function to create a request after desired drivers and tested files have been added
        private void buildrequestfunc()
        {
            TestRequest tr       = new TestRequest();
            string      fileName = "TestRequest.xml";
            string      fileSpec = System.IO.Path.Combine(rp.storagePath, fileName);

            fileSpec = System.IO.Path.GetFullPath(fileSpec);

            tr.author      = "Nishant Agrawal";
            tr.testDrivers = testD;
            tr.makeRequest();
            tr.saveXml(fileSpec);

            testD.Clear();
        }
예제 #4
0
 static void Main(string[] args)
 {
   Console.Write("\n  Testing TestRequest");
   Console.Write("\n =====================");
   string savePath = "../../test/";
   string fileName = "TestRequest1.xml";
   if (!System.IO.Directory.Exists(savePath))
     System.IO.Directory.CreateDirectory(savePath);
   string fileSpec = System.IO.Path.Combine(savePath, fileName);
   fileSpec = System.IO.Path.GetFullPath(fileSpec);
   TestRequest tr = new TestRequest();
   tr.author = "Nishant Agrawal";
     TestDriver td1 = new TestDriver();
     td1.driverName = "td1.cs";
     td1.testedFiles.Add("tf1.cs");
     td1.testedFiles.Add("tf2.cs");
     tr.testDrivers.Add(td1);
   tr.makeRequest();
   Console.Write("\n{0}", tr.doc.ToString());
   Console.Write("\n  saving to \"{0}\"", fileSpec);
   tr.saveXml(fileSpec);
   Console.Write("\n  reading from \"{0}\"", fileSpec);
   TestRequest tr2 = new TestRequest();
   tr2.loadXml(fileSpec);
   Console.Write("\n{0}", tr2.doc.ToString());
   Console.Write("\n");
   tr2.parse("author");
   Console.Write("\n  author is \"{0}\"", tr2.author);
   tr2.parse("dateTime");
   Console.Write("\n  dateTime is \"{0}\"", tr2.dateTime);
   tr2.parseDr("test");
   Console.Write("\n  testedFiles are:");
   foreach(TestDriver td in tr2.testDrivers)
   {                Console.Write("\n  testDriver is \"{0}\"", td.driverName);
             foreach (string file in td.testedFiles)
         {
             Console.Write("\n    \"{0}\"", file);
         }           
   }
   Console.Write("\n\n");
 }