public void CheckEventLogEntry()
        {
            TestStepBuilder tsb = new TestStepBuilder("BizUnit.EventLogCheckStep", null);
            object[] args = new object[1];
            args[0] = "Application";
            tsb.SetProperty("EventLog", args);

            args = new object[1];
            args[0] = "VAA FFP";
            tsb.SetProperty("Source", args);

            args = new object[1];
            args[0] = "Error";
            tsb.SetProperty("EventType", args);

            args = new object[1];
            args[0] = 2028;
            tsb.SetProperty("EventId", args);

            args = new object[1];
            args[0] = "FieldValue: '3'";
            tsb.SetProperty("ValidationRegexs", args);

            BizUnitTestCase testCase = new BizUnitTestCase("FileCreateStepTest");
            testCase.AddTestStep(tsb, TestStage.Execution);
             
            BizUnit bizUnit = new BizUnit(testCase);
            bizUnit.RunTest();
        }
        public void FileCreateStepTest_Negative()
        {
            string testDirectory = @"..\..\..\Test\BizUnit.Tests\Out";

            FileHelper.EmptyDirectory(testDirectory, "*.xml");

            Assert.AreEqual(FileHelper.NumberOfFilesInDirectory(testDirectory, "*.xml"), 0);

            BizUnitTestCase testCase = new BizUnitTestCase("FileCreateStepTest_Negative");

            FileCreateStep fcs = new FileCreateStep();

            fcs.SourcePath   = @"C:\GarbageDirectory__NoOneWouldHaveADirCalledThisSurely\LoadGenScript001.xml";
            fcs.CreationPath = testDirectory + @"\Data_%Guid%.xml";
            testCase.AddTestStep(fcs, TestStage.Execution);

            BizUnit bizUnit = new BizUnit(testCase);

            bool exceptionCaught = false;

            try
            {
                bizUnit.RunTest();
            }
            catch (DirectoryNotFoundException)
            {
                exceptionCaught = true;
            }

            Assert.IsTrue(exceptionCaught);
            Assert.AreEqual(FileHelper.NumberOfFilesInDirectory(testDirectory, "*.xml"), 0);
        }
        public void FileCreateStep_FileDeleteMultipleStepTest()
        {
            string testDirectory = @"..\..\..\Test\BizUnit.Tests\Out";

            FileHelper.EmptyDirectory(testDirectory, "*.xml");

            Assert.AreEqual(FileHelper.NumberOfFilesInDirectory(testDirectory, "*.xml"), 0);

            BizUnitTestCase testCase = new BizUnitTestCase("FileCreateStep_FileDeleteMultipleStepTest");

            FileCreateStep fcs = new FileCreateStep();

            fcs.SourcePath   = @"..\..\..\Test\BizUnit.Tests\Data\LoadGenScript001.xml";
            fcs.CreationPath = testDirectory + @"\Data_%Guid%.xml";
            testCase.AddTestStep(fcs, TestStage.Execution);

            FileDeleteMultipleStep fds = new FileDeleteMultipleStep();

            fds.Directory     = testDirectory;
            fds.SearchPattern = "*.xml";
            testCase.AddTestStep(fds, TestStage.Execution);

            BizUnit bizUnit = new BizUnit(testCase);

            bizUnit.RunTest();

            Assert.AreEqual(FileHelper.NumberOfFilesInDirectory(testDirectory, "*.xml"), 0);
        }
        public void ObjectModelMixedWithConfigTest()
        {
            string config        = ResourceLoaderHelper.GetResourceData("Data", "FileMoveConfig.xml");
            string testDirectory = @"..\..\..\Test\BizUnit.Tests\Out";

            FileHelper.EmptyDirectory(testDirectory, "*.xml");

            Assert.AreEqual(FileHelper.NumberOfFilesInDirectory(testDirectory, "*.xml"), 0);

            BizUnitTestCase testCase = new BizUnitTestCase("ObjectModelMixedWithConfigTest");

            // Add an object model defined BizUnit step...
            FileCreateStep fcs = new FileCreateStep();

            fcs.SourcePath   = @"..\..\..\Test\BizUnit.Tests\Data\LoadGenScript001.xml";
            fcs.CreationPath = testDirectory + @"\InDoc1.xml";
            testCase.AddTestStep(fcs, TestStage.Execution);

            // Add a config defined BizUnit step...
            FileMoveStep fms = new FileMoveStep();

            testCase.AddTestStep(fms, config, TestStage.Execution);

            BizUnit bizUnit = new BizUnit(testCase);

            bizUnit.RunTest();

            Assert.AreEqual(FileHelper.NumberOfFilesInDirectory(testDirectory, "*.xml"), 1);
        }
Exemple #5
0
        public void CreateLocation()
        {
            TestCase btc = new TestCase();

            string address = Path.GetTempPath();

            ReceiveLocationCreateStep createStep = new ReceiveLocationCreateStep
            {
                PortName     = "BizUnitTestPort",
                LocationName = "BizUnitTestLocation",
                Address      = address,
                Pipeline     = ReceiveLocationCreateStep.PipelineType.Xml
            };

            btc.ExecutionSteps.Add(createStep);

            DelayStep delayStep = new DelayStep
            {
                DelayMilliSeconds = 60000
            };

            btc.ExecutionSteps.Add(delayStep);

            ReceiveLocationEnabledStep validateStep = new ReceiveLocationEnabledStep
            {
                ReceiveLocationName = "BizUnitTestLocation",
                IsDisabled          = true
            };

            btc.ExecutionSteps.Add(validateStep);

            ReceivePortConductorStep enableStep = new ReceivePortConductorStep
            {
                ReceivePortName     = "BizUnitTestPort",
                ReceiveLocationName = "BizUnitTestLocation",
                Action = ReceivePortConductorStep.ReceivePortAction.Enable
            };

            btc.ExecutionSteps.Add(enableStep);

            ReceivePortConductorStep disableStep = new ReceivePortConductorStep
            {
                ReceivePortName     = "BizUnitTestPort",
                ReceiveLocationName = "BizUnitTestLocation",
                Action = ReceivePortConductorStep.ReceivePortAction.Disable
            };

            btc.CleanupSteps.Add(disableStep);

            ReceiveLocationDeleteStep deleteStep = new ReceiveLocationDeleteStep
            {
                LocationName = "BizUnitTestLocation"
            };

            btc.CleanupSteps.Add(deleteStep);

            BizUnit bu = new BizUnit(btc);

            bu.RunTest();
        }
        public void Create_FileCreateStep_AndSetSimpleTypes()
        {
            TestStepBuilder tsb = new TestStepBuilder("BizUnit.FileCreateStep", null);
            object[] args = new object[1];
            args[0] = @"..\..\..\Test\BizUnit.Tests\Data\LoadGenScript001.xml";
            tsb.SetProperty("SourcePath", args);

            args = new object[1];
            args[0] = @"..\..\..\Test\BizUnit.Tests\Out\Data_%Guid%.xml";
            tsb.SetProperty("CreationPath", args);

            string testDirectory = @"..\..\..\Test\BizUnit.Tests\Out";
            FileHelper.EmptyDirectory(testDirectory, "*.xml");

            Assert.AreEqual(FileHelper.NumberOfFilesInDirectory(testDirectory, "*.xml"), 0);

            BizUnitTestCase testCase = new BizUnitTestCase("Create_FileCreateStep_AndSetSimpleTypes");

            // Add the test step builder to the test case...
            testCase.AddTestStep(tsb, TestStage.Execution);

            BizUnit bizUnit = new BizUnit(testCase);
            bizUnit.RunTest();

            Assert.AreEqual(FileHelper.NumberOfFilesInDirectory(testDirectory, "*.xml"), 1);
        }
        public void Upgrade_NotElligable_NoResponseValidation_Test()
        {
            var testCase = new TestCase();

            testCase.Name            = "Upgrade_NotElligable_NoResponseValidation_Test";
            testCase.Purpose         = "Test failed upgrade";
            testCase.Description     = "Test upgrade denied for passenger/flight not elligable for upgrade";
            testCase.Category        = "BizUnit SDK: BVT";
            testCase.Reference       = "Use case: 10.3.5";
            testCase.ExpectedResults = "Upgrade failed";
            testCase.Preconditions   = "Solution should be deployed, bound and started";

            var wsStep = new WebServiceStep();

            wsStep.Action      = "Upgrade";
            wsStep.ServiceUrl  = "http://localhost/BizUnit.Sdk.FlightUpgrade/BizUnit_Sdk_FlightUpgrade_ProcessRequest_UpgradePort.svc";
            wsStep.RequestBody = new FileDataLoader {
                FilePath = @"..\..\..\Tests\FlightUpgrade.Tests\Data\Request_NotElligible.xml"
            };
            wsStep.RunConcurrently = true;

            testCase.ExecutionSteps.Add(wsStep);

            var bizUnit = new BizUnit(testCase);

            bizUnit.RunTest();
            TestCase.SaveToFile(testCase, "Upgrade_NotElligable_NoResponseValidation_Test.xml");
        }
        public void SetValuesOnDefaulAndConcurrentCtxObjs()
        {
            Logger  logger  = new Logger();
            BizUnit bizUnit =
                new BizUnit(@"..\..\..\Test\BizUnit.Tests\Data\ConcurrentCtxTest001.xml");
            Context ctx = new Context(bizUnit, logger);

            ctx.Add("Ctx1-Val1", 1);

            Logger  concurrentLogger = new Logger();
            Context ctxConcurrent    = ctx.CloneForConcurrentUse(concurrentLogger);

            ctxConcurrent.Add("Ctx2-Val1", 24);
            ctx.Add("Ctx1-Val2", 2);
            ctxConcurrent.Add("Ctx2-Val2", 25);

            Assert.AreEqual((int)ctx.GetObject("Ctx1-Val1"), 1);
            Assert.AreEqual((int)ctx.GetObject("Ctx1-Val2"), 2);
            Assert.AreEqual((int)ctx.GetObject("Ctx2-Val1"), 24);
            Assert.AreEqual((int)ctx.GetObject("Ctx2-Val2"), 25);

            Assert.AreEqual((int)ctxConcurrent.GetObject("Ctx1-Val1"), 1);
            Assert.AreEqual((int)ctxConcurrent.GetObject("Ctx1-Val2"), 2);
            Assert.AreEqual((int)ctxConcurrent.GetObject("Ctx2-Val1"), 24);
            Assert.AreEqual((int)ctxConcurrent.GetObject("Ctx2-Val2"), 25);
        }
Exemple #9
0
        public void PostToSharepoint()
        {
            TestCase btc = new TestCase()
            {
                Name           = "Post a document to sharepoint",
                Description    = "Check/Validate the Sharepoint steps",
                BizUnitVersion = "4.0.0.1"
            };

            var docToSharepoint = new PostDocumentToSharepointStep()
            {
                DocumentToUploadPath = "../../../../BizUnit4.0_Src/Test/BizUnit.TestSteps.i8c.Tests/TestData/Personeel_small.xlsx",
                DocumentName         = "Personeel small",
                SharePointSite       = @"http://SHP-2010001:99/sites/BizTalk",
                DocumentLibraryName  = "BizTalk Document Library",
                ColumnParameters     = new Dictionary <string, string> {
                    { "Processing_x0020_State", "1" }, { "Validation_x0020_State", "1" }
                }
            };

            btc.ExecutionSteps.Add(docToSharepoint);

            BizUnit bu = new BizUnit(btc);

            TestCase.SaveToFile(btc, "DocumentToSharepoint.xaml");
            bu.RunTest();
        }
        private static void ExecuteImportedTestCase(ImportTestCaseStep testStep, Context context)
        {
            var testCase = testStep.GetTestCase();
            var bu       = new BizUnit(testCase, context);

            bu.RunTest();
        }
        public void SetValuesOnDefaulAndConcurrentCtxObjs()
        {
            Logger logger = new Logger();
            BizUnit bizUnit =
                new BizUnit(@"..\..\..\Test\BizUnit.Tests\Data\ConcurrentCtxTest001.xml");
            Context ctx = new Context(bizUnit, logger);

            ctx.Add("Ctx1-Val1", 1);

            Logger concurrentLogger = new Logger();
            Context ctxConcurrent = ctx.CloneForConcurrentUse(concurrentLogger);

            ctxConcurrent.Add("Ctx2-Val1", 24);
            ctx.Add("Ctx1-Val2", 2);
            ctxConcurrent.Add("Ctx2-Val2", 25);

            Assert.AreEqual((int)ctx.GetObject("Ctx1-Val1"), 1);
            Assert.AreEqual((int)ctx.GetObject("Ctx1-Val2"), 2);
            Assert.AreEqual((int)ctx.GetObject("Ctx2-Val1"), 24);
            Assert.AreEqual((int)ctx.GetObject("Ctx2-Val2"), 25);

            Assert.AreEqual((int)ctxConcurrent.GetObject("Ctx1-Val1"), 1);
            Assert.AreEqual((int)ctxConcurrent.GetObject("Ctx1-Val2"), 2);
            Assert.AreEqual((int)ctxConcurrent.GetObject("Ctx2-Val1"), 24);
            Assert.AreEqual((int)ctxConcurrent.GetObject("Ctx2-Val2"), 25);
        }
Exemple #12
0
        public void TestStopRemoteHost()
        {
            // Create the test case
            var testCase = new TestCase();

            testCase.Name            = "Stop a host instance in a remote group";
            testCase.ExpectedResults = "Test succeeds";

            var remote = new RemoteServerHostStep
            {
                RemoteServer = "99-001-097-v058"
            };

            testCase.ExecutionSteps.Add(remote);

            var sendPort = new TestSteps.BizTalk.Remote.Host.HostConductorStep
            {
                Action           = "stop",
                HostInstanceName = "OnlineHost_YYY",
                Servers          = "99-001-097-V058"
            };

            testCase.ExecutionSteps.Add(sendPort);

            TestCase.SaveToFile(testCase, "TestStartRemoteHost.xml");

            // Execute the test
            var bizUnit = new BizUnit(testCase);

            bizUnit.RunTest();
        }
Exemple #13
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");
        }
Exemple #14
0
        public void Test_07_StringFormatterMultipleStep()
        {
            //set up the required steps
            StringFormatterMultipleStep sfStep = new StringFormatterMultipleStep();

            sfStep.BaseString = "exec NotifyNewCRM '{0}','1'";
            string[] tokens = new string[1];
            tokens[0]     = "101000215026";
            sfStep.Tokens = tokens;
            sfStep.ContextKeyWithResult = "OutputString";

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

            tc.Name = "Test_07_StringFormatterMultipleStep";

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

            //run the test
            bizUnit.RunTest();

            Assert.AreEqual("exec NotifyNewCRM '101000215026','1'",
                            bizUnit.Ctx.GetValue("OutputString"));
        }
Exemple #15
0
        public void Test_10_SoapHttpRequestResponseStepEx()
        {
            //setup the required steps
            SoapHttpRequestResponseStepEx soapStep = new SoapHttpRequestResponseStepEx();

            soapStep.Url        = "http://localhost/POWebService/SubmitPOService.asmx";
            soapStep.SoapAction = "http://Microsoft.Samples.BizTalk.ConsumeWebService/webservices/submitPO";
            soapStep.InputFile  = @".\..\..\TestData\PORequest.xml";
            soapStep.OutputFile = @".\..\..\TestData\out\POResponse.xml";

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

            tc.Name = "Test_10_SoapHttpRequestResponseStepEx";

            //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();

            XmlDocument xDoc = new XmlDocument();

            xDoc.Load(@".\..\..\TestData\out\POResponse.xml");
            XmlNode testNode    = xDoc.SelectSingleNode("/*[local-name()='submitPOResponse']/*[local-name()='submitPOResult' ]/*[local-name()='InvoiceNumber' ]");
            string  actualValue = testNode.InnerText;

            //Do an assertion on the XpAth value
            Assert.AreEqual("string", actualValue);
            //now delete the file
            File.Delete(@".\..\..\TestData\out\POResponse.xml");
        }
Exemple #16
0
        public void Test_06_StringFormatterStep()
        {
            //Setup the required step
            StringFormatterStep sfStep = new StringFormatterStep();

            sfStep.BaseString           = "Update table set fld = '{0}' where fld1 = '{1}'";
            sfStep.Delimiter            = "|";
            sfStep.NumParams            = 2;
            sfStep.ParamString          = "Smith|10192929239";
            sfStep.ContextKeyWithResult = "OutputString";

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

            tc.Name = "Test_06_StringFormatterStep";

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

            //run the test
            bizUnit.RunTest();

            Assert.AreEqual("Update table set fld = 'Smith' where fld1 = '10192929239'",
                            bizUnit.Ctx.GetValue("OutputString"));
        }
Exemple #17
0
        public void Test_05_WaitOnFileEx()
        {
            //setup the required steps
            WaitOnFileExStep wStep = new WaitOnFileExStep();

            wStep.Path            = @".\..\..\TestData\out\";
            wStep.FileFilter      = "*.xml";
            wStep.TimeOut         = 5000;
            wStep.IncludeOldFiles = "Y";

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

            tc.Name = "Test_05_WaitOnFileEx";

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

            //run the test
            bizUnit.RunTest();

            Assert.AreEqual("file.xml", bizUnit.Ctx.GetValue("DetectedFileName"));
        }
Exemple #18
0
        public void Test_04_FileDeleteEx()
        {
            // First we create two sample files to be deleted
            string     path  = @".\..\..\TestData\BizUnitTestFile.txt";
            string     path2 = @".\..\..\TestData\BizUnitTestFile2.txt";
            TextWriter ts    = File.CreateText(path);

            ts.WriteLine("This file is used to test the BizUnit fileDeleteExStep.");
            ts.Close();
            ts = File.CreateText(path2);
            ts.WriteLine("This file is also used to test the BiUnit FileDeleteExStep.");
            ts.Close();

            //Now we setup the BizUnit steps
            FileDeleteExStep fdStep = new FileDeleteExStep();
            //put the files to delete into a list and pass it to the step
            List <string> files = new List <string>();

            files.Add(path);
            files.Add(path2);
            fdStep.FilesToDelete = files;
            //Now instantiate the test case container
            TestCase tc = new TestCase();

            tc.Name = "Test_04_FileDeleteEx";

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

            //run the test
            bizUnit.RunTest();
        }
Exemple #19
0
        public void TestMultipleBackwardsCompatible()
        {
            OleDbQuerySequenceStep step = new OleDbQuerySequenceStep
            {
                ConnectionString = "Provider=OraOLEDB.Oracle;Data Source=10.0.0.233;User Id=vanhos2;Password=vanhos2;Initial Catalog=db11g",
                SQLQuerySequence = new OleDbQuery[]
                {
                    new OleDbQuery
                    {
                        RawSqlQuery = "SELECT * FROM TESTING"
                    },
                    new OleDbQuery
                    {
                        RawSqlQuery = "SELECT COUNT(*) AS cnt FROM TESTING"
                    }
                },
                NumberOfRowsExpected = 1
            };

            TestCase btc = new TestCase();

            btc.ExecutionSteps.Add(step);
            BizUnit bu = new BizUnit(btc);

            bu.RunTest();
        }
Exemple #20
0
        public void WebServiceInvoke_LoadFromXaml()
        {
            var     tc = TestCase.LoadFromFile(@"..\..\..\BizUnit.TestSteps.i8c.Tests\TestCases\WebServiceInvokeTest.xml");
            BizUnit bu = new BizUnit(tc);

            bu.RunTest();
        }
Exemple #21
0
//        [ClassInitialize]
        static public void SetUp(TestContext context)
        {
            Console.WriteLine(Environment.CurrentDirectory);
            BizUnit bizUnit = new BizUnit(@"..\..\..\Test\BizUnit.Tests\TestCases\Test_Setup.xml", TestGroupPhase.TestGroupSetup);

            bizUnit.RunTest();
        }
Exemple #22
0
        public void Create_FileCreateStep_AndSetSimpleTypes()
        {
            TestStepBuilder tsb = new TestStepBuilder("BizUnit.FileCreateStep", null);

            object[] args = new object[1];
            args[0] = @"..\..\..\Test\BizUnit.Tests\Data\LoadGenScript001.xml";
            tsb.SetProperty("SourcePath", args);

            args    = new object[1];
            args[0] = @"..\..\..\Test\BizUnit.Tests\Out\Data_%Guid%.xml";
            tsb.SetProperty("CreationPath", args);

            string testDirectory = @"..\..\..\Test\BizUnit.Tests\Out";

            FileHelper.EmptyDirectory(testDirectory, "*.xml");

            Assert.AreEqual(FileHelper.NumberOfFilesInDirectory(testDirectory, "*.xml"), 0);

            BizUnitTestCase testCase = new BizUnitTestCase("Create_FileCreateStep_AndSetSimpleTypes");

            // Add the test step builder to the test case...
            testCase.AddTestStep(tsb, TestStage.Execution);

            BizUnit bizUnit = new BizUnit(testCase);

            bizUnit.RunTest();

            Assert.AreEqual(FileHelper.NumberOfFilesInDirectory(testDirectory, "*.xml"), 1);
        }
Exemple #23
0
        public void MqSeriesInvoke_LoadFromXaml()
        {
            var     tc = TestCase.LoadFromFile(@"..\..\..\BizUnit.TestSteps.i8c.Tests\TestCases\MQSeriesInvoke.xml");
            BizUnit bu = new BizUnit(tc);

            bu.RunTest();
        }
        private void GetBizUnitInfo(int?bizUnitId, List <KeyValuePair <string, string> > orgList)
        {
            BizUnit biz = db.BizUnits.Single(p => p.BizUnitId == bizUnitId);

            orgList.Insert(0, new KeyValuePair <string, string>("KUP", biz.BizUnitName));
            orgList.Insert(0, new KeyValuePair <string, string>("Cabang", biz.Branch.BranchName));
        }
Exemple #25
0
        public void TestFileEquals()
        {
            TestCase btc  = new TestCase();
            var      read = new FileFormattedReadMultipleStep()
            {
                DirectoryPath          = TESTDIRECTORY,
                FormattedSearchPattern = FILENAME,
                ExpectedNumberOfFiles  = 1,
                NumberOfCharsToLog     = -1,
                Timeout = 100
            };

            var validate = new FileSizeValidationStep()
            {
                Value       = FILESIZE,
                SizeMode    = FileSizeValidationStep.SizeModes.B,
                CompareMode = NumericPropertyValidationStep.CompareModes.Equals
            };

            read.SubSteps.Add(validate);
            btc.ExecutionSteps.Add(read);

            BizUnit bu = new BizUnit(btc);

            bu.RunTest();
        }
        public void CheckEventLogEntry()
        {
            TestStepBuilder tsb = new TestStepBuilder("BizUnit.EventLogCheckStep", null);

            object[] args = new object[1];
            args[0] = "Application";
            tsb.SetProperty("EventLog", args);

            args    = new object[1];
            args[0] = "VAA FFP";
            tsb.SetProperty("Source", args);

            args    = new object[1];
            args[0] = "Error";
            tsb.SetProperty("EventType", args);

            args    = new object[1];
            args[0] = 2028;
            tsb.SetProperty("EventId", args);

            args    = new object[1];
            args[0] = "FieldValue: '3'";
            tsb.SetProperty("ValidationRegexs", args);

            BizUnitTestCase testCase = new BizUnitTestCase("FileCreateStepTest");

            testCase.AddTestStep(tsb, TestStage.Execution);

            BizUnit bizUnit = new BizUnit(testCase);

            bizUnit.RunTest();
        }
Exemple #27
0
        public void WebServiceInvoke()
        {
            TestCase btc = new TestCase();

            btc.Name           = "Send SOAP message to BizTalk";
            btc.Description    = "Send a SOAP message to BizTalk as would have done Horizon";
            btc.BizUnitVersion = "4.0.0.1";

            var ws = new WebServiceStep();

            ws.Action = "http://bts.online.bizilante.intranet/ACVCSC.BizTalk.WebServiceInterface/SubmitRequest";
            FileDataLoader dataLoader;

            dataLoader               = new FileDataLoader();
            dataLoader.FilePath      = @"..\..\..\BizUnit.TestSteps.i8c.Tests\TestData\SubmitRequest.xml";
            ws.RequestBody           = dataLoader;
            ws.ServiceUrl            = "http://localhost:8888/ACVCSC.BizTalk.Common.WebServiceInterface/Common.asmx";
            ws.UseDefaultCredentials = true;
            ws.HasResponse           = false;

            // Validation....

            // Add steps
            btc.ExecutionSteps.Add(ws);

            // Save and Execute test
            BizUnit bu = new BizUnit(btc);

            TestCase.SaveToFile(btc, "WebServiceInvoke.xaml");
            bu.RunTest();
        }
Exemple #28
0
        public void DelayTestCaseTest()
        {
            DeleteFiles();
            int stepDelayDuration = 500;
            var step = new DelayStep();
            step.DelayMilliSeconds = stepDelayDuration;

            var sw = new Stopwatch();
            sw.Start();

            step.Execute(new Context());

            var actualDuration = sw.ElapsedMilliseconds;
            Console.WriteLine("Observed delay: {0}", actualDuration);
            Assert.AreEqual(stepDelayDuration, actualDuration, 20);

            stepDelayDuration = 5;
            step.DelayMilliSeconds = stepDelayDuration;

            var tc = new TestCase();
            tc.ExecutionSteps.Add(step);

            TestCase.SaveToFile(tc, "DelayTestCaseTest.xaml");
            var bu = new BizUnit(TestCase.LoadFromFile("DelayTestCaseTest.xaml"));

            sw = new Stopwatch();
            sw.Start();

            bu.RunTest();

            actualDuration = sw.ElapsedMilliseconds;
            Console.WriteLine("Observed delay: {0}", actualDuration);
            Assert.AreEqual(actualDuration, stepDelayDuration, 20);
        }
Exemple #29
0
        public void MqSeriesPurge()
        {
            // Create the test case
            var btc = new TestCase();

            btc.Name           = "Purge operations on a MQSeries queue";
            btc.Description    = "Check/Validate the MQSeries related steps";
            btc.BizUnitVersion = "4.0.0.1";

            var purgeStep = new MQSeriesClearQueueStep();

            purgeStep.QueueManager = "QM_ACV_LOC";
            purgeStep.Queues       = new Collection <object>
            {
                "QX_LOC_ACV"                        // Transmission queue for QR_LOC_ACV_XML_OUT
            };

            btc.ExecutionSteps.Add(purgeStep);

            // Execute the test
            TestCase.SaveToFile(btc, "MQSeriesPurge.xaml");
            var bizUnit = new BizUnit(btc);

            bizUnit.RunTest();
        }
Exemple #30
0
        public void RecycleInvokeLoadFromXaml()
        {
            var tc = TestCase.LoadFromFile(@"..\..\..\BizUnit.TestSteps.i8c.Tests\TestCases\IISRecycleInvoke.xml");
            var bu = new BizUnit(tc);

            bu.RunTest();
        }
        public void Create_FileCreateStep_TakeFromCtx()
        {
            Context ctx = new Context();
            ctx.Add("PathToWriteFileTo", @"..\..\..\Test\BizUnit.Tests\Out\Data_%Guid%.xml");

            TestStepBuilder tsb = new TestStepBuilder("BizUnit.FileCreateStep", null);
            object[] args = new object[1];
            args[0] = @"..\..\..\Test\BizUnit.Tests\Data\LoadGenScript001.xml";
            tsb.SetProperty("SourcePath", args);

            args = new object[1];
            args[0] = "takeFromCtx:PathToWriteFileTo";
            tsb.SetProperty("CreationPath", args);

            string testDirectory = @"..\..\..\Test\BizUnit.Tests\Out";
            FileHelper.EmptyDirectory(testDirectory, "*.xml");

            Assert.AreEqual(FileHelper.NumberOfFilesInDirectory(testDirectory, "*.xml"), 0);

            BizUnitTestCase testCase = new BizUnitTestCase("Create_FileCreateStep_TakeFromCtx");

            // Add the test step builder to the test case...
            testCase.AddTestStep(tsb, TestStage.Execution);

            BizUnit bizUnit = new BizUnit(testCase, ctx);
            bizUnit.RunTest();

            Assert.AreEqual(FileHelper.NumberOfFilesInDirectory(testDirectory, "*.xml"), 1);
        }
Exemple #32
0
        public void TestStartRemoteSendPort()
        {
            // Create the test case
            var testCase = new TestCase();

            testCase.Name            = "Start a send port in a remote group";
            testCase.ExpectedResults = "Test succeeds";

            var remote = new RemoteServerHostStep
            {
                RemoteServer = "99-001-097-v058"
            };

            testCase.ExecutionSteps.Add(remote);

            var sendPort = new TestSteps.BizTalk.Remote.Port.SendPortConductorStep
            {
                Action             = SendPortAction.Start,
                SendPortName       = "HS_FileVerif_FILE",
                DelayForCompletion = 5
            };

            testCase.ExecutionSteps.Add(sendPort);

            TestCase.SaveToFile(testCase, "TestStartRemoteSendPort.xml");

            // Execute the test
            var bizUnit = new BizUnit(testCase);

            bizUnit.RunTest();
        }
Exemple #33
0
        public void Create_FileCreateStep_TakeFromCtx()
        {
            Context ctx = new Context();

            ctx.Add("PathToWriteFileTo", @"..\..\..\Test\BizUnit.Tests\Out\Data_%Guid%.xml");

            TestStepBuilder tsb = new TestStepBuilder("BizUnit.FileCreateStep", null);

            object[] args = new object[1];
            args[0] = @"..\..\..\Test\BizUnit.Tests\Data\LoadGenScript001.xml";
            tsb.SetProperty("SourcePath", args);

            args    = new object[1];
            args[0] = "takeFromCtx:PathToWriteFileTo";
            tsb.SetProperty("CreationPath", args);

            string testDirectory = @"..\..\..\Test\BizUnit.Tests\Out";

            FileHelper.EmptyDirectory(testDirectory, "*.xml");

            Assert.AreEqual(FileHelper.NumberOfFilesInDirectory(testDirectory, "*.xml"), 0);

            BizUnitTestCase testCase = new BizUnitTestCase("Create_FileCreateStep_TakeFromCtx");

            // Add the test step builder to the test case...
            testCase.AddTestStep(tsb, TestStage.Execution);

            BizUnit bizUnit = new BizUnit(testCase, ctx);

            bizUnit.RunTest();

            Assert.AreEqual(FileHelper.NumberOfFilesInDirectory(testDirectory, "*.xml"), 1);
        }
        public void FileCreateStepTest_Negative()
        {
            string testDirectory = @"..\..\..\Test\BizUnit.Tests\Out";
            FileHelper.EmptyDirectory(testDirectory, "*.xml");

            Assert.AreEqual(FileHelper.NumberOfFilesInDirectory(testDirectory, "*.xml"), 0);

            BizUnitTestCase testCase = new BizUnitTestCase("FileCreateStepTest_Negative");

            FileCreateStep fcs = new FileCreateStep();
            fcs.SourcePath = @"C:\GarbageDirectory__NoOneWouldHaveADirCalledThisSurely\LoadGenScript001.xml";
            fcs.CreationPath = testDirectory + @"\Data_%Guid%.xml";
            testCase.AddTestStep(fcs, TestStage.Execution);

            BizUnit bizUnit = new BizUnit(testCase);

            bool exceptionCaught = false;

            try
            {
                bizUnit.RunTest();
            }
            catch(DirectoryNotFoundException)
            {
                exceptionCaught = true;
            }

            Assert.IsTrue(exceptionCaught);
            Assert.AreEqual(FileHelper.NumberOfFilesInDirectory(testDirectory, "*.xml"), 0);
        }
        public ActionResult KantorUnitDeleteConfirmed(int id)
        {
            BizUnit kntrUnit = db.BizUnits.Single(p => p.BizUnitId == id);

            db.BizUnits.Remove(kntrUnit);
            db.SaveChanges();
            return(RedirectToAction("KantorUnit"));
        }
 private static void ExecuteStartOrStop(string testScript)
 {
     ITestStep hcs = new HostConductorStep();
     BizUnit bu = new BizUnit(@"..\..\..\Test\BizUnit.Tests\Data\DummyConfig.xml");
     Context ctx = bu.Ctx;
     XmlNode config = BizUnitTestUtils.LoadTestStepConfig("Data", testScript);
     hcs.Execute(config, ctx);
 }
 public void Invoke_DoStuff()
 {
     ITestStep dnoi = new DotNetObjectInvokerStep();
     BizUnit bu = new BizUnit(@"..\..\..\Test\BizUnit.Tests\Data\DummyConfig.xml");
     Context ctx = bu.Ctx;
     XmlNode config = BizUnitTestUtils.LoadTestStepConfig("Data", "DotNetObjectInvokerStep-Test003.xml");
     dnoi.Execute(config, ctx);
 }
 public void GetStockQuoteTest()
 {
     ITestStep dnoi = new SOAPHTTPRequestResponseStep();
     BizUnit bu = new BizUnit(@"..\..\..\Test\BizUnit.Tests\Data\DummyConfig.xml");
     Context ctx = bu.Ctx;
     XmlNode config = BizUnitTestUtils.LoadTestStepConfig("Data", "SOAPHTTPRequestResponseStep-Test002.xml");
     dnoi.Execute(config, ctx);
 }
Exemple #39
0
 public void TestCaseValidationTest()
 {
     var step = new CreateStep();
     var tc = new TestCase();
     tc.ExecutionSteps.Add(step);
     var bu = new BizUnit(tc);
     bu.RunTest();
 }
 public void LoadGenStepTest()
 {
     ITestStep dnoi = new LoadGenExecuteStep();
     BizUnit bu = new BizUnit(@"..\..\..\Test\BizUnit.Tests\Data\DummyConfig.xml");
     Context ctx = bu.Ctx;
     XmlNode config = BizUnitTestUtils.LoadTestStepConfig("Data", "LoadGenExecuteStep-Test001.xml");
     dnoi.Execute(config, ctx);
 }
Exemple #41
0
        public void ExecuteSendPipelineConfiguredDocSpecXmlAsmWithSimpleSchema()
        {
            // Create test case...
            var tc = new TestCase();

            tc.Name = "ExecuteSendPipelineConfiguredDocSpecXmlAsmWithSimpleSchema";

            var pipeStep = new ExecuteSendPipelineStep();

            pipeStep.PipelineAssemblyPath = @"..\..\..\Test\BizUnit.BizTalkTestArtifacts\bin\Debug\BizUnit.BizTalkTestArtifacts.dll";
            pipeStep.PipelineTypeName     = "BizUnit.BizTalkTestArtifacts.SendPipeline2";
            var ds = new DocSpecDefinition
            {
                AssemblyPath =
                    @"..\..\..\Test\BizUnit.BizTalkTestArtifacts\bin\Debug\BizUnit.BizTalkTestArtifacts.dll",
                TypeName = "BizUnit.BizTalkTestArtifacts.Schema2"
            };

            pipeStep.DocSpecs.Add(ds);
            pipeStep.SourceDir     = @"..\..\..\Test\BizUnit.BizTalkTestArtifacts\Instances\";
            pipeStep.SearchPattern = "Schema2.xml";
            pipeStep.Destination   = "Output.022.xml";
            // Add ExecuteReceivePipelineStep to test case
            tc.ExecutionSteps.Add(pipeStep);

            var exists = new ExistsStep();

            exists.DirectoryPath     = ".";
            exists.Timeout           = 2000;
            exists.SearchPattern     = "Output.022*.xml";
            exists.ExpectedNoOfFiles = 1;
            // Add ExistsStep to test case
            tc.ExecutionSteps.Add(exists);

            var fv = new FileReadMultipleStep();

            fv.DirectoryPath = ".";
            fv.SearchPattern = "Output.022.xml";
            fv.DeleteFiles   = false;

            var validation = new XmlValidationStep();
            var sd         = new SchemaDefinition();

            sd.XmlSchemaPath      = @"..\..\..\Test\BizUnit.BizTalkTestArtifacts\Schema2.xsd";
            sd.XmlSchemaNameSpace = "http://BizUnit.BizTalkTestArtifacts.Schema2";
            validation.XmlSchemas.Add(sd);
            // Add validation to FileReadMultipleStep
            fv.SubSteps.Add(validation);
            // Add FileReadMultipleStep to test case
            tc.ExecutionSteps.Add(exists);

            TestCase.SaveToFile(tc, "ExecuteSendPipelineConfiguredDocSpecXmlAsmWithSimpleSchema.xaml");

            // Execute test csse using serialised test case to test round tripping of serialisation...
            var bu = new BizUnit(TestCase.LoadFromFile("ExecuteSendPipelineConfiguredDocSpecXmlAsmWithSimpleSchema.xaml"));

            bu.RunTest();
        }
 public void Invoke_FormatStringParamFromCtx()
 {
     ITestStep dnoi = new DotNetObjectInvokerStep();
     BizUnit bu = new BizUnit(@"..\..\..\Test\BizUnit.Tests\Data\DummyConfig.xml");
     Context ctx = bu.Ctx;
     ctx.Add("NumberToPrint", "<int>2</int>");
     XmlNode config = BizUnitTestUtils.LoadTestStepConfig("Data", "DotNetObjectInvokerStep-Test004.xml");
     dnoi.Execute(config, ctx);
 }
        public void ImportSingleTestCaseTest()
        {
            TestHelper.DeleteFile("ImportSingleTestCaseTest.xml");

            // Create the first test case i a helper method...
            var testCase1 = BuildFirstTestCase();

            // Create the second test case and import the first test case into it...
            var testCase2 = new TestCase {Name = "Copy First File Test"};

            var createFileStep = new CreateStep {CreationPath = @"File2.xml"};
            var dl = new FileDataLoader
                         {
                             FilePath = @"..\..\TestData\PurchaseOrder001.xml"
                         };
            createFileStep.DataSource = dl;

            testCase2.ExecutionSteps.Add(createFileStep);

            var import = new ImportTestCaseStep {TestCase = testCase1};
            testCase2.ExecutionSteps.Add(import);
           
            // Create a validating read step...
            var validatingFileReadStep = new FileReadMultipleStep
                               {
                                   DirectoryPath = @".",
                                   SearchPattern = "File*.xml",
                                   ExpectedNumberOfFiles = 2
                               };

            var validation = new XmlValidationStep();
            var schemaPurchaseOrder = new SchemaDefinition
            {
                XmlSchemaPath =
                    @"..\..\TestData\PurchaseOrder.xsd",
                XmlSchemaNameSpace =
                    "http://SendMail.PurchaseOrder"
            };
            validation.XmlSchemas.Add(schemaPurchaseOrder);

            var xpathProductId = new XPathDefinition
                                     {
                                         Description = "PONumber",
                                         XPath =
                                             "/*[local-name()='PurchaseOrder' and namespace-uri()='http://SendMail.PurchaseOrder']/*[local-name()='PONumber' and namespace-uri()='']",
                                         Value = "12323"
                                     };
            validation.XPathValidations.Add(xpathProductId);
            validatingFileReadStep.SubSteps.Add(validation);
            testCase2.ExecutionSteps.Add(validatingFileReadStep);

            // Run the second test case...
            var bizUnit = new BizUnit(testCase2);
            bizUnit.RunTest();

            TestCase.SaveToFile(testCase2, "ImportSingleTestCaseTest.xml");
        }
        public void LoadContextFromData()
        {
            Stream data = BizUnitTestUtils.GetResourceDataAsStream("Data", "XmlContextLoader-InputData.xml");
            IContextLoaderStep cl = new XmlContextLoader();
            BizUnit bu = new BizUnit(@"..\..\..\Test\BizUnit.Tests\Data\DummyConfig.xml");
            Context ctx = bu.Ctx;
            XmlNode config = BizUnitTestUtils.LoadContextLoaderStepConfig("Data", "XmlContextLoader-LoadContext.xml");
            cl.ExecuteContextLoader(data, config, ctx);

            Assert.AreEqual(ctx.GetValue("FirstName"), "John");
            Assert.AreEqual(ctx.GetValue("LastName"), "Doe");
        }
Exemple #45
0
        public void EventTest()
        {
            Console.WriteLine(Environment.CurrentDirectory);
            BizUnit bizUnit =
                new BizUnit(@"..\..\..\Test\BizUnit.Tests\Data\BizUnitEventTest001.xml");

            bizUnit.TestStepStartEvent += TestStepStart;
            bizUnit.TestStepStartEvent += TestStepStart;

            bizUnit.TestStepStopEvent += TestStepStop;

            bizUnit.RunTest();
        }
Exemple #46
0
        public void ExecuteTestCase()
        {
            var btc = new TestCase();
            btc.Name = "Serialization Test";
            btc.Description = "Test to blah blah blah, yeah really!";
            btc.BizUnitVersion = "4.0.0.1";

            var fm = new DelayStep {DelayMilliSeconds = 35};
            btc.SetupSteps.Add(fm);

            var bu = new BizUnit(btc);
            bu.RunTest();
        }
        public void CtxManipulationTest1()
        {
            ITestStep dnoi = new ContextManipulatorStep();
            BizUnit bu = new BizUnit(@"..\..\..\Test\BizUnit.Tests\Data\DummyConfig.xml");
            Context ctx = bu.Ctx;

            ctx.Add("HoldEvent", "Stop");
            ctx.Add("ActionId", "33");
            ctx.Add("ActionType", "Terminate");

            XmlNode config = BizUnitTestUtils.LoadTestStepConfig("Data", "ContextManipulatorStep-Test001.xml");
            dnoi.Execute(config, ctx);

            string orderItem = ctx.GetValue("OrderItem");
            Assert.AreEqual(orderItem, "holdEvent=Stop; actionId=33; actionType=Terminate;");
        }
        public void FlowCtxBetweenTests()
        {
            BizUnit bizUnit1 =
                new BizUnit(@"..\..\..\Test\BizUnit.Tests\Data\ConcurrentCtxTest001.xml");

            Context ctx = bizUnit1.Ctx;
            ctx.Add("SomeProperty", 32);
            string testName1 = ctx.GetValue("BizUnitTestCaseName");

            BizUnit bizUnit2 =
                new BizUnit(@"..\..\..\Test\BizUnit.Tests\Data\ConcurrentCtxTest002.xml", ctx);

            Context ctx2 = bizUnit2.Ctx;
            string testName2 = ctx2.GetValue("BizUnitTestCaseName");

            Assert.AreNotEqual(testName1, testName2);
            Assert.AreEqual(32, (Int32)ctx2.GetObject("SomeProperty"));
        }
        public void ReplaceValueOnConcurrentCtxObjs()
        {
            Logger logger = new Logger();
            BizUnit bizUnit =
                new BizUnit(@"..\..\..\Test\BizUnit.Tests\Data\ConcurrentCtxTest001.xml");
            Context ctx = new Context(bizUnit, logger);

            ctx.Add("Ctx1-Val1", 1);

            Logger concurrentLogger = new Logger();
            Context ctxConcurrent = ctx.CloneForConcurrentUse(concurrentLogger);

            ctxConcurrent.Add("Ctx1-Val1", 2, true);
            ctx.Add("Ctx1-Val1", 3, true);
            ctxConcurrent.Add("Ctx1-Val1", 4, true);

            Assert.AreEqual((int)ctx.GetObject("Ctx1-Val1"), 4);
            Assert.AreEqual((int)ctxConcurrent.GetObject("Ctx1-Val1"), 4);
        }
        public void FileCreateStepTest()
        {
            string testDirectory = @"..\..\..\Test\BizUnit.Tests\Out";
            FileHelper.EmptyDirectory(testDirectory, "*.xml");
            
            Assert.AreEqual(FileHelper.NumberOfFilesInDirectory(testDirectory, "*.xml"), 0);

            BizUnitTestCase testCase = new BizUnitTestCase("FileCreateStepTest");

            FileCreateStep fcs = new FileCreateStep();
            fcs.SourcePath = @"..\..\..\Test\BizUnit.Tests\Data\LoadGenScript001.xml";
            fcs.CreationPath = testDirectory + @"\Data_%Guid%.xml";
            testCase.AddTestStep(fcs, TestStage.Execution);

            BizUnit bizUnit = new BizUnit(testCase);
            bizUnit.RunTest();

            Assert.AreEqual(FileHelper.NumberOfFilesInDirectory(testDirectory, "*.xml"), 1);
        }
Exemple #51
0
        public void DelaySampleTest()
        {
            DeleteFiles();

            // Create the test case
            var testCase = new TestCase();

            // Create test steps...
            var delayStep = new DelayStep {DelayMilliSeconds = 500};

            // Add test steps to the required test stage
            testCase.ExecutionSteps.Add(delayStep);

            // Create a new instance of BizUnit and run the test
            var bizUnit = new BizUnit(testCase);
            bizUnit.RunTest();

            // Save Test Case
            TestCase.SaveToFile(testCase, "DelaySampleTest.xaml");
        }
        public void AccessEmptyValue()
        {
            BizUnit bu = new BizUnit(@"..\..\..\Test\BizUnit.Tests\Data\DummyConfig.xml");

            Context ctx = bu.Ctx;
            object obj = ctx.GetValue("NotPresent");
            obj = ctx.GetObject("NotPresent");
        }
// TODO: Test case is missing for some reason...
//        [TestMethod]
        public void FactStuff()
        {
            Object[] factObjArray = null;

            // Initialize facts...

            Context ctx = new Context();
            ctx.Add("Fact1", 32);
            ctx.Add("Fact2", factObjArray);

            BizUnit bizUnit = new BizUnit(@"..\..\..\Test\BizUnit.Tests\Data\FactBasedRuleEngineStepTest.xml", ctx);
            bizUnit.RunTest();
        }
Exemple #54
0
        public void Upgrade_Elligable_Test()
        {
            var testCase = new TestCase();
            testCase.Name = "Upgrade_Elligable_Test";
            testCase.Purpose = "Test successful upgrade";
            testCase.Description = "Test upgrade succeeds for passenger/flight not elligable for upgrade";
            testCase.Category = "BizUnit SDK: BVT";
            testCase.Reference = "Use case: 10.3.4";
            testCase.ExpectedResults = "Upgrade succeeds";
            testCase.Preconditions = "Solution should be deployed, bound and started";

            // First ensure the target directory is empty...
            var delFiles = new DeleteStep();
            delFiles.FilePathsToDelete = new Collection<string> { @"C:\Temp\BizTalk\BizUnitSdkOut\*.xml" };
            testCase.SetupSteps.Add(delFiles);

            // Then execute the main scenario, execute a response-response web set step which is executed concurrently.
            // i.e. whilst this step is waiting for the response the next step, FileReadMultipleStep and then CreateStep
            // will be executed.
            var wsStep = new WebServiceStep();
            wsStep.Action = "Upgrade";
            wsStep.ServiceUrl = "http://localhost/BizUnit.Sdk.FlightUpgrade/BizUnit_Sdk_FlightUpgrade_ProcessRequest_UpgradePort.svc";
            wsStep.RequestBody = new FileDataLoader { FilePath = @"..\..\..\Tests\FlightUpgrade.Tests\Data\Request.xml" };
            wsStep.RunConcurrently = true;

            // Add validation....
            var validation = new XmlValidationStep();
            var schemaResultType = new SchemaDefinition
            {
                XmlSchemaPath = @"..\..\..\Src\FlightUpgrade\ResponseMsg.xsd",
                XmlSchemaNameSpace = "http://bizUnit.sdk.flightUpgrade/upgradeResponse"
            };
            validation.XmlSchemas.Add(schemaResultType);

            var responseXpath = new XPathDefinition();
            responseXpath.Description = "GetProducts_RS/Result/result";
            responseXpath.XPath = "/*[local-name()='UpgradeResponse' and namespace-uri()='http://bizUnit.sdk.flightUpgrade/upgradeResponse']/*[local-name()='UpgradeResult' and namespace-uri()='']/*[local-name()='Result' and namespace-uri()='']";
            responseXpath.Value = "true";
            validation.XPathValidations.Add(responseXpath);

            var fileReadStep = new FileReadMultipleStep();
            fileReadStep.DirectoryPath = @"C:\Temp\BizTalk\BizUnitSdkOut";
            fileReadStep.SearchPattern = "*.xml";
            fileReadStep.ExpectedNumberOfFiles = 1;
            fileReadStep.Timeout = 5000;
            fileReadStep.DeleteFiles = true;

            var createFileStep = new CreateStep();
            createFileStep.CreationPath = @"..\..\..\Data\In\UpgradeResponse.xml";
            createFileStep.DataSource = new FileDataLoader { FilePath = @"..\..\..\Tests\FlightUpgrade.Tests\Data\Response.xml" };

            testCase.ExecutionSteps.Add(wsStep);
            testCase.ExecutionSteps.Add(fileReadStep);
            testCase.ExecutionSteps.Add(createFileStep);

            var bizUnit = new BizUnit(testCase);
            bizUnit.RunTest();
            TestCase.SaveToFile(testCase, "Upgrade_Elligable_Test.xml");
        }
Exemple #55
0
        public void Test_04_NegativeTest_MockLogger()
        {
            MockRepository mocks = new MockRepository();

            ILogger logger = mocks.CreateMock<ILogger>();

            logger.TestStart(null, DateTime.Now, null);            
            LastCall.On(logger).Repeat.Once().IgnoreArguments();

            // S E T U P
            logger.TestStageStart(TestStage.Setup, DateTime.Now);
            LastCall.On(logger).Repeat.Once().IgnoreArguments();

            logger.TestStageEnd(TestStage.Setup, DateTime.Now, null);
            LastCall.On(logger).Repeat.Once().IgnoreArguments();

            // E X E C U T E 
            logger.TestStageStart(TestStage.Execution, DateTime.Now);
            LastCall.On(logger).Repeat.Once().IgnoreArguments();

            logger.TestStepStart(null, DateTime.Now, true, true);
            LastCall.On(logger).Repeat.Once().IgnoreArguments();

            logger.TestStepEnd(null, DateTime.Now, null);
            LastCall.On(logger).Repeat.Once().IgnoreArguments();
            
            logger.TestStepStart(null, DateTime.Now, true, true);
            LastCall.On(logger).Repeat.Once().IgnoreArguments();

            logger.Log(LogLevel.INFO, null);
            LastCall.On(logger).Repeat.Any().IgnoreArguments();

            logger.LogData(null, null);
            LastCall.On(logger).Repeat.Once().IgnoreArguments();

            logger.ValidatorStart(null, DateTime.Now);
            LastCall.On(logger).Repeat.Once().IgnoreArguments();

            logger.Log(LogLevel.INFO, null);
            LastCall.On(logger).Repeat.Any().IgnoreArguments();

            logger.Log(LogLevel.ERROR, null, null);
            LastCall.On(logger).Repeat.Once().IgnoreArguments();

            logger.LogException(null);
            LastCall.On(logger).Repeat.Once().IgnoreArguments();

            logger.ValidatorEnd(null, DateTime.Now, null);
            LastCall.On(logger).Repeat.Once().IgnoreArguments();

            logger.TestStepEnd(null, DateTime.Now, null);
            LastCall.On(logger).Repeat.Once().IgnoreArguments();

            logger.TestStageEnd(TestStage.Execution, DateTime.Now, null);
            LastCall.On(logger).Repeat.Once().IgnoreArguments();

            // C L E A N U P
            logger.TestStageStart(TestStage.Cleanup, DateTime.Now);
            LastCall.On(logger).Repeat.Once().IgnoreArguments();

            logger.TestStepStart(null, DateTime.Now, true, true);
            LastCall.On(logger).Repeat.Once().IgnoreArguments();

            logger.TestStepEnd(null, DateTime.Now, null);
            LastCall.On(logger).Repeat.Once().IgnoreArguments();

            logger.TestStageEnd(TestStage.Cleanup, DateTime.Now, null);
            LastCall.On(logger).Repeat.Once().IgnoreArguments();

            logger.TestEnd(null, DateTime.Now, null);
            LastCall.On(logger).Repeat.Once().IgnoreArguments();

            logger.Flush();
            logger.Close();

            mocks.ReplayAll();

            Context ctx = new Context(logger);
            BizUnit bizUnit = new BizUnit(@"..\..\..\Test\BizUnit.Tests\TestCases\Test_04_NegativeTest.xml", ctx);

            try
            {
                bizUnit.RunTest();
            }
            catch(Exception) {}

            mocks.VerifyAll();
        }
Exemple #56
0
        public void Upgrade_NotElligable_NoResponseValidation_Test()
        {
            var testCase = new TestCase();
            testCase.Name = "Upgrade_NotElligable_NoResponseValidation_Test";
            testCase.Purpose = "Test failed upgrade";
            testCase.Description = "Test upgrade denied for passenger/flight not elligable for upgrade";
            testCase.Category = "BizUnit SDK: BVT";
            testCase.Reference = "Use case: 10.3.5";
            testCase.ExpectedResults = "Upgrade failed";
            testCase.Preconditions = "Solution should be deployed, bound and started";

            var wsStep = new WebServiceStep();
            wsStep.Action = "Upgrade";
            wsStep.ServiceUrl = "http://localhost/BizUnit.Sdk.FlightUpgrade/BizUnit_Sdk_FlightUpgrade_ProcessRequest_UpgradePort.svc";
            wsStep.RequestBody = new FileDataLoader { FilePath = @"..\..\..\Tests\FlightUpgrade.Tests\Data\Request_NotElligible.xml" };
            wsStep.RunConcurrently = true;

            testCase.ExecutionSteps.Add(wsStep);

            var bizUnit = new BizUnit(testCase);
            bizUnit.RunTest();
            TestCase.SaveToFile(testCase, "Upgrade_NotElligable_NoResponseValidation_Test.xml");
        }
Exemple #57
0
        public void Upgrade_NotElligable_Test()
        {
            var testCase = new TestCase();
            testCase.Name = "Upgrade_NotElligable_Test";
            testCase.Purpose = "Test failed upgrade";
            testCase.Description = "Test upgrade denied for passenger/flight not elligable for upgrade";
            testCase.Category = "BizUnit SDK: BVT";
            testCase.Reference = "Use case: 10.3.5";
            testCase.ExpectedResults = "Upgrade failed";
            testCase.Preconditions = "Solution should be deployed, bound and started";

            var wsStep = new WebServiceStep();
            wsStep.Action = "Upgrade";
            wsStep.ServiceUrl = "http://localhost/BizUnit.Sdk.FlightUpgrade/BizUnit_Sdk_FlightUpgrade_ProcessRequest_UpgradePort.svc";
            wsStep.RequestBody = new FileDataLoader { FilePath = @"..\..\..\Tests\FlightUpgrade.Tests\Data\Request_NotElligible.xml" };
            wsStep.RunConcurrently = true;

            // Add validation....
            var validation = new XmlValidationStep();
            var schemaResultType = new SchemaDefinition
            {
                XmlSchemaPath = @"..\..\..\Src\FlightUpgrade\ResponseMsg.xsd",
                XmlSchemaNameSpace = "http://bizUnit.sdk.flightUpgrade/upgradeResponse"
            };
            validation.XmlSchemas.Add(schemaResultType);

            var responseXpath = new XPathDefinition();
            responseXpath.Description = "GetProducts_RS/Result/result";
            responseXpath.XPath = "/*[local-name()='UpgradeResponse' and namespace-uri()='http://bizUnit.sdk.flightUpgrade/upgradeResponse']/*[local-name()='UpgradeResult' and namespace-uri()='']/*[local-name()='Result' and namespace-uri()='']";
            responseXpath.Value = "false";
            validation.XPathValidations.Add(responseXpath);

            wsStep.SubSteps.Add(validation);

            testCase.ExecutionSteps.Add(wsStep);

            var bizUnit = new BizUnit(testCase);
            bizUnit.RunTest();
            TestCase.SaveToFile(testCase, "Upgrade_NotElligable_Test.xml");
        }
Exemple #58
0
        public void Upgrade_Eligible_Test_FILE()
        {
            var testCase = new TestCase();
            testCase.Name = "Upgrade_Eligible_Test_FILE";
            testCase.Purpose = "Test successful upgrade";
            testCase.Description = "Test upgrade succeeds for passenger/flight eligible for upgrade";
            testCase.Category = "BizUnit SDK: BVT";
            testCase.Reference = "Use case: 10.3.4";
            testCase.ExpectedResults = "Upgrade succeeds";
            testCase.Preconditions = "Solution should be deployed, bound and started";

            // First ensure the target directory is empty...
            var delFiles = new DeleteStep();
            delFiles.FilePathsToDelete = new Collection<string> { @"C:\Temp\BizTalk\BizUnitSdkOut\*.xml" };
            testCase.SetupSteps.Add(delFiles);

            // Then execute the main scenario.
            var testStep = new CreateStep();

            // Where are we going to create the file.
            testStep.CreationPath = @"C:\Temp\BizTalk\BizUnitSdkIn\Request.xml";
            var dataLoader = new FileDataLoader();
            // Where are we getting the original file from?
            dataLoader.FilePath = @"..\..\Data\Request.xml";
            testStep.DataSource = dataLoader;

            testCase.ExecutionSteps.Add(testStep);

            // Add validation....
            var validation = new XmlValidationStep();
            var schemaResultType = new SchemaDefinition
            {
                XmlSchemaPath = @"..\..\..\..\Src\FlightUpgrade\ResponseMsg.xsd",
                XmlSchemaNameSpace = "http://bizUnit.sdk.flightUpgrade/upgradeResponse"
            };
            validation.XmlSchemas.Add(schemaResultType);

            var responseXpath = new XPathDefinition();
            responseXpath.Description = "GetProducts_RS/Result/result";
            responseXpath.XPath = "/*[local-name()='UpgradeResponse' and namespace-uri()='http://bizUnit.sdk.flightUpgrade/upgradeResponse']/*[local-name()='UpgradeResult' and namespace-uri()='']/*[local-name()='Result' and namespace-uri()='']";
            responseXpath.Value = "true";
            validation.XPathValidations.Add(responseXpath);

            // Check that an output file has been created.
            var finalFileReadStep = new FileReadMultipleStep();
            finalFileReadStep.DirectoryPath = @"C:\Temp\BizTalk\BizUnitSdkOut";
            finalFileReadStep.SearchPattern = "*.xml";
            finalFileReadStep.ExpectedNumberOfFiles = 1;
            finalFileReadStep.Timeout = 5000;
            finalFileReadStep.DeleteFiles = false;

            finalFileReadStep.SubSteps.Add(validation);
            testCase.ExecutionSteps.Add(finalFileReadStep);

            var bizUnit = new BizUnit(testCase);
            bizUnit.RunTest();
            TestCase.SaveToFile(testCase, System.String.Format("Upgrade_Eligible_Test_File_{0}.xml", System.String.Format("{0:yyyy-MM-dd-hh_mm_ss}",  System.DateTime.Now)));
        }
        public void Create_FileValidateStep_SetPropsAndValidation()
        {
            BizUnitTestCase testCase = new BizUnitTestCase("Create_FileValidateStep_SetPropsAndValidation");

            // create a file...
            TestStepBuilder createFileStep = new TestStepBuilder("BizUnit.FileCreateStep", null);
            object[] args = new object[1];
            args[0] = @"..\..\..\Test\BizUnit.Tests\Data\PurchaseOrder001.xml";
            createFileStep.SetProperty("SourcePath", args);

            args = new object[1];
            args[0] = @"..\..\..\Test\BizUnit.Tests\Out\Data_%Guid%.xml";
            createFileStep.SetProperty("CreationPath", args);

            // Read and validate file...
            TestStepBuilder tsb = new TestStepBuilder("BizUnit.FileValidateStep", null);
            args = new object[1];
            args[0] = "1000";
            tsb.SetProperty("Timeout", args);

            args[0] = @"..\..\..\Test\BizUnit.Tests\Out";
            tsb.SetProperty("Directory", args);

            args[0] = "*.*";
            tsb.SetProperty("SearchPattern", args);

            args[0] = "true";
            tsb.SetProperty("DeleteFile", args);

            ValidationStepBuilder tssb = new ValidationStepBuilder("BizUnit.XmlValidationStepEx", null);
            args = new object[1];
            args[0] = @"..\..\..\Test\BizUnit.Tests\Data\PurchaseOrder.xsd";
            tssb.SetProperty("XmlSchemaPath", args);

            args[0] = @"http://SendMail.PurchaseOrder";
            tssb.SetProperty("XmlSchemaNameSpace", args);

            args = new object[2];
            args[0] = "*[local-name()='PurchaseOrder' and namespace-uri()='http://SendMail.PurchaseOrder']/*[local-name()='PONumber' and namespace-uri()='']";
            args[1] = "PONumber_0";
            tssb.SetProperty("XPathValidations", args);

            // set the validation step
            tsb.ValidationStepBuilder = tssb;

            // Add the steps...
            testCase.AddTestStep(createFileStep, TestStage.Execution);
            testCase.AddTestStep(tsb, TestStage.Execution);

            string testDirectory = @"..\..\..\Test\BizUnit.Tests\Out";
            FileHelper.EmptyDirectory(testDirectory, "*.xml");

            Assert.AreEqual(FileHelper.NumberOfFilesInDirectory(testDirectory, "*.xml"), 0);

            BizUnit bizUnit = new BizUnit(testCase);
            bizUnit.RunTest();

            Assert.AreEqual(FileHelper.NumberOfFilesInDirectory(testDirectory, "*.xml"), 0);
        }
        public void Create_FileDeleteStep_AndSetstringArray()
        {
            BizUnitTestCase testCase = new BizUnitTestCase("Create_FileDeleteStep_AndSetstringArray");

            // Create a file in the output dir...
            TestStepBuilder tsb1 = new TestStepBuilder("BizUnit.FileCreateStep", null);
            object[] args = new object[1];
            args[0] = @"..\..\..\Test\BizUnit.Tests\Data\LoadGenScript001.xml";
            tsb1.SetProperty("SourcePath", args);

            args = new object[1];
            args[0] = @"..\..\..\Test\BizUnit.Tests\Out\Data_File1.xml";
            tsb1.SetProperty("CreationPath", args);

            // Add the test step builder to the test case...
            testCase.AddTestStep(tsb1, TestStage.Execution);

            // Create a file in the output dir...
            TestStepBuilder tsb2 = new TestStepBuilder("BizUnit.FileCreateStep", null);
            args = new object[1];
            args[0] = @"..\..\..\Test\BizUnit.Tests\Data\LoadGenScript001.xml";
            tsb2.SetProperty("SourcePath", args);

            args = new object[1];
            args[0] = @"..\..\..\Test\BizUnit.Tests\Out\Data_File2.xml";
            tsb2.SetProperty("CreationPath", args);

            // Add the test step builder to the test case...
            testCase.AddTestStep(tsb2, TestStage.Execution);

            TestStepBuilder tsb3 = new TestStepBuilder("BizUnit.FileDeleteStep", null);
            args = new object[2];
            args[0] = @"..\..\..\Test\BizUnit.Tests\Out\Data_File1.xml";
            args[1] = @"..\..\..\Test\BizUnit.Tests\Out\Data_File2.xml";
            tsb3.SetProperty("FilesToDeletePath", args);

            string testDirectory = @"..\..\..\Test\BizUnit.Tests\Out";
            // Add the test step builder to the test case...
            testCase.AddTestStep(tsb3, TestStage.Execution);

            FileHelper.EmptyDirectory(testDirectory, "*.xml");

            Assert.AreEqual(FileHelper.NumberOfFilesInDirectory(testDirectory, "*.xml"), 0);

            BizUnit bizUnit = new BizUnit(testCase);
            bizUnit.RunTest();

            Assert.AreEqual(FileHelper.NumberOfFilesInDirectory(testDirectory, "*.xml"), 0);
        }