static void Main(string[] args)
        {
            Console.Write("\n  Demonstrating Robust Test Loader");
            Console.Write("\n ==================================\n");

            DllLoaderExec loader = new DllLoaderExec();

            string testersLocation;

            if (args.Length > 0)
            {
                testersLocation = args[0];
            }
            else
            {
                testersLocation = loader.GuessTestersParentDir() + "/Testers";
            }

            // convert testers relative path to absolute path

            string absPath;

            absPath = Path.GetFullPath(testersLocation);
            Console.Write("\n  Loading Test Modules from:\n    {0}\n", absPath);

            // run load and tests

            string result = loader.loadAndExerciseTesters(absPath);

            Console.Write("\n\n  {0}", result);
            Console.Write("\n\n");
        }
        //----< run demonstration >--------------------------------------------
        /////////////////////////////////////////////////////////////////////Initiates the test
        public static void InitiateTest()
        {
            System.IO.Directory.CreateDirectory("../../../ThFileStore");
            using (log = new System.IO.StreamWriter(System.IO.Path.Combine(LogFilePath, logFileN + ".txt")))
            {
                log.Write("Test Started at: " + DateTime.Now.ToString() + Environment.NewLine);
                foreach (System.Collections.DictionaryEntry env in Environment.GetEnvironmentVariables())
                {
                    log.WriteLine((string)env.Key + "=" + (string)env.Value);
                }
                log.WriteLine(Environment.NewLine + "loading" + Environment.NewLine);
            }
            Console.Write("\n  Demonstrating Robust Test Loader");
            DllLoaderExec loader = new DllLoaderExec();

            DllLoaderExec.testersLocation = Path.GetFullPath(DllLoaderExec.testersLocation);
            Console.Write("\n  Loading Test Modules from:\n    {0}\n", DllLoaderExec.testersLocation);
            string result = loader.loadAndExerciseTesters();


            Console.WriteLine(result);
            using (log = new System.IO.StreamWriter(System.IO.Path.Combine(LogFilePath, logFileN + ".txt"), true))
            {
                log.WriteLine(DateTime.Now.ToString());
            }
            using (log = new System.IO.StreamWriter(System.IO.Path.Combine(LogFilePath, logFileN + ".txt"), true))
            {
                log.WriteLine(result);
                Console.Write(result);
            }
            Console.WriteLine("\nTest logs generated at {0} ", System.IO.Path.GetFullPath(System.IO.Path.Combine("../../../ThFileStore")));
        }
        static void Main(string[] args)
        {
            DllLoaderExec testharness = new DllLoaderExec();

            //fetch the alreay built dll files to the testers
            testharness.getFiles("*.dll");
            foreach (string file in testharness.files)
            {
                Console.Write("\n  \"{0}\"", file);
            }
            foreach (string file in testharness.files)
            {
                string fileName = Path.GetFileName(file);
                Console.Write("\n  sending \"{0}\" to \"{1}\"", fileName, testharness.TestreceivePath);
                testharness.sendFile(file);
            }
            Console.Write("\n\n");

            Console.Write("\n  Demonstrating Robust Test Loader");
            Console.Write("\n ==================================\n");

            DllLoaderExec.testersLocation = Path.GetFullPath(DllLoaderExec.testersLocation);
            Console.Write("\n  Loading Test Modules from:\n    {0}\n", DllLoaderExec.testersLocation);

            // run load and tests

            string result = testharness.loadAndExerciseTesters();

            Console.Write("\n\n  {0}", result);
            Console.Write("\n\n");
        }
Exemplo n.º 4
0
        //funcion to initiate tests
        public static void InitiateTest()
        {
            System.IO.Directory.CreateDirectory("../../../TestHarnessStore/TestLogs");
            using (log = new System.IO.StreamWriter(System.IO.Path.Combine(LogFilePath, "TestLogs_" + LogFile + ".txt"), true))
            {
                log.Write("Testing started at: " + DateTime.Now.ToString());
                foreach (System.Collections.DictionaryEntry env in Environment.GetEnvironmentVariables())
                {
                    log.WriteLine((string)env.Key + "=" + (string)env.Value);
                }
                log.WriteLine(Environment.NewLine + "Loading:" + Environment.NewLine);
            }
            Console.Write("\n  Demonstrating Robust Test Loader");
            DllLoaderExec loader = new DllLoaderExec();

            DllLoaderExec.testersLocation = Path.GetFullPath(DllLoaderExec.testersLocation);
            Console.Write("\n  Loading Test Modules from:\n    {0}\n", DllLoaderExec.testersLocation);
            string result = loader.loadAndExerciseTesters();

            Console.Write("\n===============================================================\n");
            Console.Write(result);
            using (log = new System.IO.StreamWriter(System.IO.Path.Combine(LogFilePath, "TestLogs_" + LogFile + ".txt"), true))
            {
                log.WriteLine(Environment.NewLine + result);
            }
            try
            {
                System.IO.File.Copy(System.IO.Path.Combine(LogFilePath, "TestLogs_" + LogFile + ".txt"), System.IO.Path.Combine("../../../TestHarnessStore/TestHarnessSendStore", "TestLogs_" + LogFile + ".txt"), true);
            }
            catch (Exception ex)
            { ex.ToString(); }
            try
            {
                System.IO.File.Delete(System.IO.Path.Combine(LogFilePath, "TestLogs_" + LogFile + ".txt"));
            }
            catch (Exception ex)
            {
                ex.ToString();
            }
            Console.WriteLine("\nTest logs generated at {0} ", System.IO.Path.GetFullPath(System.IO.Path.Combine("../../../TestHarnessStore/TestLogs")));
            CleanPath();
        }