BizUnit自定义管道测试用例

时间:2012-10-16 19:42:38

标签: biztalk biztalk-2010 biztalk-2009 bizunit

我有自定义管道组件..

我正在使用以下代码使用BizUnit

using System;
using BizUnit.TestSteps.BizTalk.Pipeline;
using BizUnit.Xaml;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Reflection;


namespace BizUnit4_TestProject
{
[TestClass]
public class PipelineTest
{
    [TestMethod]
    public void TestReceivePipeline()
    {
        try
        {
            // Create the test case
            var testCase = new TestCase { };

            // Create test steps...
            var docSpecDefinition = new DocSpecDefinition();
            docSpecDefinition.AssemblyPath = Assembly.GetAssembly(typeof(BizUnit4_BizProject.Schemas.TestSchema)).CodeBase;
            //@"C:\Projects\Edan\BizUnit4_TestProject\BizUnit4_BizProject\bin\Debug\BizUnit4_BizProject.dll";




            docSpecDefinition.TypeName =  typeof(BizUnit4_BizProject.Schemas.TestSchema).FullName;




           // docSpecDefinition.TypeName =  =  typeof(BizUnit4_BizProject.Schemas.TestSchema).FullName;

            var executeReceivePipelineStep = new ExecuteReceivePipelineStep();
            executeReceivePipelineStep.DestinationFileFormat=
            executeReceivePipelineStep.Source = @"C:\Users\Administrator\Downloads\BizUnit4_TestProject\BizUnit4_TestProject\BizUnit4_BizProject\Messages\testFile.xml";
            executeReceivePipelineStep.DestinationDir = @"c:\Temp";
            executeReceivePipelineStep.DestinationFileFormat = "*.xml";
            executeReceivePipelineStep.PipelineAssemblyPath = Assembly.GetAssembly(typeof(BizUnit4_BizProject.Pipelines.Test_ReceivePipeline)).CodeBase;
            executeReceivePipelineStep.PipelineTypeName = typeof(BizUnit4_BizProject.Pipelines.Test_ReceivePipeline).FullName;
            executeReceivePipelineStep.DocSpecs.Add(docSpecDefinition);


            //executeReceivePipelineStep.PipelineAssemblyPath = @"C:\Users\Administrator\Downloads\BizUnit4_TestProject\BizUnit4_BizProject\bin\Debug\BizUnit4_BizProject.dll";
            //executeReceivePipelineStep.PipelineTypeName = "BizUnit4_BizProject.Pipelines.Test_ReceivePipeline";
            //executeReceivePipelineStep.DocSpecs.Add(docSpecDefinition);



            // executeReceivePipelineStep.PipelineAssemblyPath = Assembly.GetAssembly(typeof(BizUnit4_BizProject.Pipelines.Test_ReceivePipeline)).CodeBase;
            // executeReceivePipelineStep.PipelineTypeName = typeof(BizUnit4_BizProject.Pipelines.Test_ReceivePipeline).FullName;




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

            // Create a new instance of BizUnit and run the test
            var bizUnit = new BizUnit.BizUnit(testCase);
            bizUnit.RunTest();
        }
        catch (Exception exception)
        {
            var message = exception.InnerException;
            throw;
        }

    }
}

}

但是当我运行该文件时,我遇到了错误。

Error Message:Test method 

 BizUnit4_TestProject.PipelineTest.TestReceivePipeline threw exception:     
 BizUnit.TestStepExecutionException: BizUnit encountered an error executing a test step ---> 
 System.ArgumentException: URI formats are not supported.

  Error Stack Trace

  System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength)  
  System.IO.Path.GetFullPathInternal
  (String path)System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite)
   System.IO.File.Copy(String sourceFileName, String destFileName, Boolean overwrite)
   BizUnit.TestSteps.BizTalk.AssemblyHelper.LoadAssembly(String path) in c:\Affinus\Depot\BizUnit\BizUnit4.0\Main\Dev\Src\BizUnit.TestSteps.BizTalk\AssemblyHelper.cs: line 28

   BizUnit.TestSteps.BizTalk.Pipeline.ExecuteReceivePipelineStep.Execute(Context context) in c:\Affinus\Depot\BizUnit\BizUnit4.0\Main\Dev\Src\BizUnit.TestSteps.BizTalk\Pipeline\ExecuteReceivePipelineStep.cs: line 189

   BizUnit.BizUnit.ExecuteXamlTestStep(TestStepBase testStep, TestStage stage) in c:\Affinus\Depot\BizUnit\BizUnit4.0\Main\Dev\Src\BizUnit\BizUnit.cs: line 1122

   BizUnit.BizUnit.RunTestInternal(TestCase xamlTestCase) in c:\Affinus\Depot\BizUnit\BizUnit4.0\Main\Dev\Src\BizUnit\BizUnit.cs: line 1054BizUnit.BizUnit.RunTest() in c:\Affinus\Depot\BizUnit\BizUnit4.0\Main\Dev\Src\BizUnit\BizUnit.cs: line 1000

   BizUnit4_TestProject.PipelineTest.TestReceivePipeline() in C:\Users\Administrator\Downloads\BizUnit4_TestProject\BizUnit4_TestProject\BizUnit4_TestProject\PipelineTest.cs: line 68

   Standard Console OutputTest step validation for stage: Execution, step: BizUnit.TestSteps.BizTalk.Pipeline.ExecuteReceivePipelineStep was successful. -------------------------------------------------------------------------------                                   S T A R T Test:  started @ 15:36:26.715 16/10/2012 by USCMPDEPC28\Administrator-------------------------------------------------------------------------------Info: Adding context property: BizUnitTestCaseStartTime, value: 10/16/2012 3:36:26 PM Setup Stage: started @ 15:36:26.716 16/10/2012 Setup Stage: ended @ 15:36:26.716 16/10/2012 Execute Stage: started @ 15:36:26.716 16/10/2012Step: BizUnit.TestSteps.BizTalk.Pipeline.ExecuteReceivePipelineStep started  @ 15:36:26.716 16/10/2012, failOnError = TrueStep: BizUnit.TestSteps.BizTalk.Pipeline.ExecuteReceivePipelineStep ended @ 15:36:26.721 16/10/2012 with ERRORS, exception: System.ArgumentException*******************************************************************************Error: Exception caught!BizUnit.TestStepExecutionException: BizUnit encountered an error executing a test step ---> System.ArgumentException: URI formats are not supported.   at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength)   at System.IO.Path.GetFullPathInternal(String path)   at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite)   at System.IO.File.Copy(String sourceFileName, String destFileName, Boolean overwrite)   at BizUnit.TestSteps.BizTalk.AssemblyHelper.LoadAssembly(String path) in c:\Affinus\Depot\BizUnit\BizUnit4.0\Main\Dev\Src\BizUnit.TestSteps.BizTalk\AssemblyHelper.cs:line 28   at BizUnit.TestSteps.BizTalk.Pipeline.ExecuteReceivePipelineStep.Execute(Context context) in c:\Affinus\Depot\BizUnit\BizUnit4.0\Main\Dev\Src\BizUnit.TestSteps.BizTalk\Pipeline\ExecuteReceivePipelineStep.cs:line 189   at BizUnit.BizUnit.ExecuteXamlTestStep(TestStepBase testStep, TestStage stage) in c:\Affinus\Depot\BizUnit\BizUnit4.0\Main\Dev\Src\BizUnit\BizUnit.cs:line 1122   --- End of inner exception stack trace ---   at BizUnit.BizUnit.ExecuteXamlTestStep(TestStepBase testStep, TestStage stage) in c:\Affinus\Depot\BizUnit\BizUnit4.0\Main\Dev\Src\BizUnit\BizUnit.cs:line 1138   at BizUnit.BizUnit.ExecuteSteps(IEnumerable`1 testSteps, TestStage stage) in c:\Affinus\Depot\BizUnit\BizUnit4.0\Main\Dev\Src\BizUnit\BizUnit.cs:line 1087******************************************************************************* Execution Stage: ended @ 15:36:26.721 16/10/2012 with ERROR's Cleanup Stage: started @ 15:36:26.725 16/10/2012*******************************************************************************Error: Exception caught!BizUnit.TestStepExecutionException: BizUnit encountered an error executing a test step ---> System.ArgumentException: URI formats are not supported.   at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength)   at System.IO.Path.GetFullPathInternal(String path)   at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite)   at System.IO.File.Copy(String sourceFileName, String destFileName, Boolean overwrite)   at BizUnit.TestSteps.BizTalk.AssemblyHelper.LoadAssembly(String path) in c:\Affinus\Depot\BizUnit\BizUnit4.0\Main\Dev\Src\BizUnit.TestSteps.BizTalk\AssemblyHelper.cs:line 28   at BizUnit.TestSteps.BizTalk.Pipeline.ExecuteReceivePipelineStep.Execute(Context context) in c:\Affinus\Depot\BizUnit\BizUnit4.0\Main\Dev\Src\BizUnit.TestSteps.BizTalk\Pipeline\ExecuteReceivePipelineStep.cs:line 189   at BizUnit.BizUnit.ExecuteXamlTestStep(TestStepBase testStep, TestStage stage) in c:\Affinus\Depot\BizUnit\BizUnit4.0\Main\Dev\Src\BizUnit\BizUnit.cs:line 1122   --- End of inner exception stack trace ---   at BizUnit.BizUnit.ExecuteXamlTestStep(TestStepBase testStep, TestStage stage) in c:\Affinus\Depot\BizUnit\BizUnit4.0\Main\Dev\Src\BizUnit\BizUnit.cs:line 1138   at BizUnit.BizUnit.ExecuteSteps(IEnumerable`1 testSteps, TestStage stage) in c:\Affinus\Depot\BizUnit\BizUnit4.0\Main\Dev\Src\BizUnit\BizUnit.cs:line 1087******************************************************************************* Cleanup Stage: ended @ 15:36:26.725 16/10/2012 with ERROR's

1 个答案:

答案 0 :(得分:0)

只需改变

这个

executeReceivePipelineStep.DestinationFileFormat = "*.xml";

executeReceivePipelineStep.DestinationFileFormat = "*.xml";