public Dictionary <string, string> processTestRequest(string path, buildServer bs)
        {
            Console.WriteLine("processing test request");
            Console.WriteLine("-------------------------------------");

            string      xmlstring   = File.ReadAllText(path);
            TestRequest testRequest = xmlstring.FromXml <TestRequest>();

            buildServer = bs;

            foreach (TestElement item in testRequest.tests)
            {
                string s1 = "";

                List <string> l1 = new List <string>();

                foreach (TestName b1 in item.testDriver)
                {
                    l1.Add(b1.testName);
                    Console.WriteLine("requesting" + b1.testName);
                    buildServer.processdtestrequest(b1.testName);
                }

                foreach (TestName c in item.testCodes)
                {
                    s1 = s1 + c.testName + "  ";
                    Console.WriteLine("requesting" + c.testName);
                    buildServer.processdtestrequest(c.testName);
                }

                foreach (string str in l1)
                {
                    dictionary.Add(str, s1);
                }
            }

            return(dictionary);
        }
コード例 #2
0
        static void Main(string[] args)
        {
            TestExecutive testExecutive = new TestExecutive();

            Client.Client             client       = new Client.Client();
            buildRequest.buildRequest buildRequest = new buildRequest.buildRequest();

            RepoMock      repoMock    = new RepoMock();
            buildServer   buildServer = new buildServer();
            List <string> list;
            TestRequest   TestRequest = new TestRequest();
            TestHarness   TestHarness = new TestHarness();
            Dictionary <string, string> dictionary;


            Console.WriteLine("\n\n-------------------------Project 2: Demosntrating a Build Server------------------------------------- \n\n");
            Console.WriteLine("***********************************************************************************************************\n\n");

            //-------------------------------------------<Requirment 1>---------------------------------------------------------------------------------
            Console.WriteLine("\n\tRequirment 1: \n\n");
            Console.WriteLine("=========================================================================\n");
            Console.WriteLine("\t\tProject Prepared using C# .Net Framework and Visual Studio 2017" + Environment.Version.ToString() + "\n\n");
            Console.WriteLine("-----------------------------------------------------------------------------------\n\n");

            //----------------------------------------------<Requirment 2>------------------------------------------------------------------------------
            Console.WriteLine("\n\t Requirment 2: \n\n");
            Console.WriteLine("=========================================================================\n");
            Console.WriteLine("\t\tInclude a package for\n" + nameof(buildRequest) + "\n\n" + nameof(client) + "\n\n" + nameof(repoMock) + "\n\n" + nameof(buildServer) + "\n\n" + nameof(TestRequest) + "\n\n" + nameof(TestHarness) + "\n\n" + nameof(testExecutive) + "\n\n");
            Console.WriteLine("------------------------------------------------------------------------------------------------------------------------\n\n\n");

            //------------------------------------------------<Requirment 3>----------------------------------------------------------------------------------
            Console.WriteLine("\n\n\t Requirment 3: \n");
            Console.WriteLine("=========================================================================\n");
            Console.WriteLine("\t\tConstructed a fixed sequence of operations of the mock repository, mock test harness, and core builder\n\n");

            Console.WriteLine("------------------------------------------------------------------------------------------------------------------------\n\n\n");
            Console.WriteLine("The BuiltRequest Data structure generated by the client is \n");
            buildRequest = client.buildrequest();

            string sendXml = client.Xml;

            repoMock.getFiles("*.*");
            repoMock.parseRequest(buildRequest, repoMock.files);
            Console.WriteLine("\nBuiltRequest Sent to MockRepository");

            string buildrequestLocation = "../../../repoMock/repoStorage/buildRequest/buildRequest.xml";

            repoMock.savecontent(buildrequestLocation, sendXml);
            Console.WriteLine("\n\n Demonstrated the requirment of the builddriver xmlfile being saved in the repository\n\n");

            Console.WriteLine("------------------------------------------------------------------------------------------------------------------------\n\n\n");

            //----------------------------------------------<Requirment 4>------------------------------------------------------------------------------------------

            Console.WriteLine("\n\n\t Requirmrnt 4: \n");
            Console.WriteLine("=========================================================================\n");
            Console.WriteLine("\t\tRepopsitory on demand copies a set of test source files, test drivers and test request with a test for each test driver\n\n");
            Console.WriteLine("Enter command for copying a set of test source files, test drivers and test request( Enter :send)");
            string command = Console.ReadLine();

            repoMock.sendFile(command, buildrequestLocation, "../../../buildServer/builderStorage");
            Console.WriteLine("\n\nThe Demonstrated the requirment of sending the builtRequest on command to the buildserver build storage  \n");
            Console.WriteLine("-----------------------------------------------------------------------------");
            dictionary = buildServer.processBuild("../../../buildServer/builderStorage/buildRequest.xml", repoMock);
            Console.WriteLine("------------------------------------------------------------------------------------------------------------------------\n\n\n");

            //--------------------------------------------<Requirment 5>--------------------------------------------------------------------------------------------
            Console.WriteLine("\n\n\t Requirment 5:\n");
            Console.WriteLine("=========================================================================\n");
            Console.WriteLine("\t\t The build server builds each visual studio project delivered by the mock repository\n\n");
            list = buildServer.getBuilderFiles();
            list = buildServer.processdirectory(list);
            buildServer.buildFile(list, dictionary);
            Console.WriteLine("\n\nDemonstarted the requirment of successfully building the test files which have been sent to the build server repository\n\n");
            Console.WriteLine("-----------------------------------------------------------------------------------------------------------------------------\n\n");
            Console.WriteLine("------------------------------------------------------------------------------------------------------------------------\n\n\n");



            //----------------------------------------------<Requirment 6>-----------------------------------------------------------------------------------------
            Console.WriteLine("\n\n\t Requirment 6: \n");
            Console.WriteLine("=========================================================================\n");

            Console.WriteLine("\t\t The builder reported to the console the success or the failure of the build, and any warning emitted\n\n");
            Console.WriteLine("------------------------------------------------------------------------------------------------------------------------\n\n\n");



            //----------------------------------------------<Requirment 7>------------------------------------------------------------------------------------------
            Console.WriteLine("\n\n\t Requirment 7: \n");
            Console.WriteLine("=========================================================================\n");
            Console.WriteLine("\t\t The Builder on success delivered the built library path known by mock test harness \n\n ");
            TestRequest = buildServer.generateTestRequest();

            string xml = buildServer.xml;

            repoMock.getFiles("*.*");
            //     buildServer.parseTestRequest(TestRequest,buildServer.files);
            //buildServer.parseTestRequest(TestRequest, buildServer.files);
            string testRequestLocation = "../../../BuildServer/BuilderStorage/TestRequest.xml";

            repoMock.sendFile("send", testRequestLocation, "../../../DllLoaderDemo/testHarnessStorage");

            Console.WriteLine("Demonstarted the requirment of saving the testRequest in the build server");

            Console.WriteLine("------------------------------------------------------------------------------------------------------------------------\n\n\n");

            //-----------------------------------------------<Requirment 8>-------------------------------------------------------------------------------------------
            Console.WriteLine("\n\n\t Requirment 8: \n");
            Console.WriteLine("=========================================================================\n");
            Console.WriteLine("\t\t The test harness attempt to load and execute each test library \n\n");
            repoMock.savecontent(testRequestLocation, xml);
            // repoMock.sendFile("sendFile", testRequestLocation, "../../../DllLoaderDemo/testHarnessStorage");
            Console.WriteLine("Demonstrated the requirment of sending the testDriver to the testHarness");
            TestHarness.processTestRequest("../../../DllLoaderDemo/testHarnessStorage/TestRequest.xml", buildServer);
            Console.WriteLine("------------------------------------------------------------------------------------------------------------------------\n\n\n");
            Console.Write("\n\n The test driver and the test file dll have been successfully sent to the test harness\n\n");
            Console.WriteLine("-----------------------------------------------------------------------------------------\n");
            //string loadandexecute = TestHarness.loadAndExerciseTesters();

            //------------------------<For loading and executing the test libraries absolute path is required>------------------------------

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

            // run load and tests

            string result = TestHarness.loadAndExerciseTesters();

            Console.Write("\n\n  {0}", result);
            Console.Write("\n\n");
            Console.WriteLine("\n\nDemonstrated the requirment of Simulated testing\n\n ");
            Console.WriteLine("--------------------------------------------------------------------------------------------------------\n\n");
            Console.WriteLine("\n\n=======================================================================================================================\n\n");
        }