Exemplo n.º 1
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");
    }
Exemplo n.º 2
0
        //method to create test request
        public void createRequest(string fileName, List <TestDriver> driver)
        {
            TestRequest tr = new TestRequest();

            string fileSpec = System.IO.Path.Combine(rp.storagePath, fileName);

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

            tr.author      = "Nishant Agrawal";
            tr.testDrivers = driver;

            tr.makeRequest();
            tr.saveXml(fileSpec);
        }