Esempio n. 1
0
        public string[] beginLoader(string xmlstring)     // This is the entry point of loader which is called after creating AppDomain
        {
            string newpath = String.Empty;
            string status  = String.Empty;

            try
            {
                Console.WriteLine("\n Current domain: {0}" + "", AppDomain.CurrentDomain.FriendlyName);
                Console.WriteLine("\n Requirement: Executing each test request in a serialized manner, running in isolation");

                Xmltest a = new Xmltest();
                Console.WriteLine("\n Parsing testrequest");
                test = a.parse(xmlstring);    //Call to parser

                newpath = RetrieveTestDriverAndCodeFromRepository();
                //Calling function to parse the XML File
                if (test == null)
                {   //If no test cases then an execption will be thrown.
                    Console.WriteLine("\n Couldnt parse any test requests, parser failure!");
                }
                //Retrieving Test Drivers and Code from Repository
                if (newpath != null)
                {
                    ld = new Loadandrun();     // here Load and Run operation begins
                    Console.WriteLine("\n\t Test execution begins here");

                    log = ld.loadAndRun(newpath, test);  // load and run methods are called.

                    Console.WriteLine("\n\t Test execution ends here");
                    fm.saveLogsInNewFolder(test[0].author, log);
                }

                Console.WriteLine("\n Exiting Domain: {0}\n", AppDomain.CurrentDomain.FriendlyName);
            }
            catch (Exception ex)
            {
                Console.WriteLine("\n Exception Caught in loader (Child Domain): {0}", ex.Message);
            }

            foreach (string str in log.Values)
            {
                status = status + str + " ";
            }

            results[0] = status;
            results[1] = path;
            return(results);
        }
Esempio n. 2
0
        //Test stub for logger class
        static void Main(String args)
        {
            Logger log = new Logger();
            Dictionary <String, String> example = new Dictionary <String, String>();
            String xmlPath = @"..\..\..\..\Xmlfiles";

            Console.WriteLine("\n Accepting XML Files from path :{0}", xmlPath);
            DirectoryInfo          directoryInfo    = new DirectoryInfo(xmlPath);
            BlockingQueue <string> testRequestQueue = new BlockingQueue <string>();

            if (Directory.Exists(xmlPath))
            {
                string[] fileEntries = Directory.GetFiles(xmlPath);
                Console.WriteLine("\n Accepting Test Requests from Path: {0}  \n", xmlPath);
                foreach (string filename in fileEntries)
                {
                    Console.WriteLine("{0}", Path.GetFileName(filename));
                    testRequestQueue.enQ(File.ReadAllText(filename));
                }
                Console.WriteLine("\n Enqueueing all Test Requests");
                Console.WriteLine("\n Size of Blockingqueue: {0}", testRequestQueue.size());
            }
            else
            {
                Console.WriteLine("No XML was found at the path specified: {0} \n", xmlPath);
            }

            int count = testRequestQueue.size();

            while (count != 0)
            {
                Xmltest     xt   = new Xmltest();
                List <Test> test = xt.parse((String)testRequestQueue.deQ());

                foreach (Test t in test)
                {
                    log.DisplayLog(example, t, "PASS");
                }

                foreach (String l in example.Values)
                {
                    Console.WriteLine("\n {0}", l);
                }
                count--;
            }
            //log.getSavedLogs(0);
        }
Esempio n. 3
0
        static void main(string[] args)
        {
            Xmltest parser  = new Xmltest();
            String  xmlPath = @"../../../XMLTestRequest";

            Console.WriteLine("\n\n Accepting XMLs from path : \"{0}\"", xmlPath);
            DirectoryInfo          dirInfo       = new DirectoryInfo(xmlPath);
            BlockingQueue <string> xmlqueue      = new BlockingQueue <string>();
            DirectoryInfo          directoryInfo = new DirectoryInfo(xmlPath);

            if (Directory.Exists(xmlPath))
            {
                string[] fileEntries = Directory.GetFiles(xmlPath);
                Console.WriteLine("\n Accepting Test Requests from Path: {0}  \n", xmlPath);
                foreach (string filename in fileEntries)
                {
                    Console.WriteLine("{0}", Path.GetFileName(filename));
                    xmlqueue.enQ(File.ReadAllText(filename));
                }
                Console.WriteLine("\n Enqueueing all Test Requests");
                Console.WriteLine("\n Size of Blockingqueue: {0}", xmlqueue.size());
            }
            else
            {
                Console.WriteLine("No XML was found at the path specified: {0} \n", xmlPath);
            }


            int count = xmlqueue.size();

            while (count != 0)
            {
                List <Test> test = parser.parse((String)xmlqueue.deQ());

                foreach (Test t in test)
                {
                    t.show();
                }

                count--;
            }
        }
Esempio n. 4
0
        ////Test stub for messaging class   //
        static void Main(string[] args)
        {
            String path = @"..\..\..\..\Xmlfiles";

            Console.WriteLine("\n Accepting xmls from path :{0}", path);
            DirectoryInfo          directoryInfo    = new DirectoryInfo(path);
            FileManager            fm               = new FileManager();
            BlockingQueue <string> testRequestQueue = new BlockingQueue <string>();

            if (Directory.Exists(path))
            {
                string[] fileEntries = Directory.GetFiles(path);
                Console.WriteLine(" Accepting Test Requests from Path: {0}  \n", path);
                foreach (string filename in fileEntries)
                {
                    Console.WriteLine("{0}", filename);
                    testRequestQueue.enQ(File.ReadAllText(filename));
                }
                Console.WriteLine("\n Enqueueing all Test Requests \n");
                Console.WriteLine("\n Size of Blockingqueue: {0}", testRequestQueue.size());
            }
            else
            {
                Console.WriteLine("No XML was found at the path specified: {0} \n", path);
            }
            while (testRequestQueue.size() != 0)
            {
                Xmltest xt  = new Xmltest();
                string  xml = testRequestQueue.deQ();
                xt.parse(xml);                                       // Enqueing the queue with the xml string
                string[]      files             = Directory.GetFiles(path, "*.dll");
                List <string> l                 = new List <string>();
                Dictionary <String, String> log = new Dictionary <string, string>();
                // couldnt create a teststub for this because of
                // circular dependency
                fm.saveLogsInNewFolder("Kunal Paliwal", log);
            }
        }