Пример #1
0
        public void Test_11_RestHttpRequestResponseStepEx_DEL()
        {
            //setup the required steps
            RestHttpRequestResponseStepEx soapStep = new RestHttpRequestResponseStepEx();

            soapStep.Url         = "http://localhost//resttestwebservice/api/books/1";
            soapStep.Method      = "DELETE";
            soapStep.ContentType = "application/xml";
            soapStep.InputFile   = @".\..\..\TestData\GetBooks.json";
            soapStep.OutputFile  = @".\..\..\TestData\out\DelBooksResponse.xml";

            //Now instantiate the test case container
            TestCase tc = new TestCase();

            tc.Name = "Test_11_RestHttpRequestResponseStepEx_DEL";

            //Add the test steps into the container at the required stages
            tc.ExecutionSteps.Add(soapStep);
            //Initialise BizUnit runner with the test case container
            BizUnit bizUnit = new BizUnit(tc);

            //run the test
            bizUnit.RunTest();

            Assert.IsTrue(File.Exists(@".\..\..\TestData\out\DelBooksResponse.xml"), "DELETE failed! See Output log.");
            File.Delete(@".\..\..\TestData\out\DelBooksResponse.xml");
        }
Пример #2
0
        public void Test_11_RestHttpRequestResponseStepEx_PUT()
        {
            //setup the required steps
            RestHttpRequestResponseStepEx soapStep = new RestHttpRequestResponseStepEx();

            soapStep.Url         = "http://localhost//resttestwebservice/api/books/1";
            soapStep.Method      = "PUT";
            soapStep.ContentType = "application/xml";
            soapStep.InputFile   = @".\..\..\TestData\PutBooks.xml";
            soapStep.OutputFile  = @".\..\..\TestData\out\PutBooksResponse.xml";

            //Now instantiate the test case container
            TestCase tc = new TestCase();

            tc.Name = "Test_11_RestHttpRequestResponseStepEx_PUT";

            //Add the test steps into the container at the required stages
            tc.ExecutionSteps.Add(soapStep);
            //Initialise BizUnit runner with the test case container
            BizUnit bizUnit = new BizUnit(tc);

            //run the test
            bizUnit.RunTest();

            Assert.IsTrue(File.Exists(@".\..\..\TestData\out\PutBooksResponse.xml"), "PUT failed! See Output log.");
            XmlDocument xDoc = new XmlDocument();

            xDoc.Load(@".\..\..\TestData\out\PutBooksResponse.xml");
            XmlNode testNode = xDoc.SelectSingleNode("/*[local-name()='BookDTO' ]/*[local-name()='Title' ]");

            Assert.IsNotNull(testNode, "Xml Title node not found");
            //Do an assertion on the XpAth value
            string actualValue = testNode.InnerText;

            Assert.AreEqual("Updated title", actualValue);
            File.Delete(@".\..\..\TestData\out\PutBooksResponse.xml");
        }