Commit ec037e69 ec037e69fd337a23fda746cd4cff5208f9f23418 by Christian Gerdes

- Fixed null ref errors on empty json/xml body

- Added PassIfNotFound option to XPathExtractionRule
1 parent 34618ddb
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30424</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{48B3509E-1FD8-4875-8FC6-137647EB83AA}</ProjectGuid>
<OutputType>Library</OutputType>
<StartupObject>
</StartupObject>
<NoStandardLibraries>false</NoStandardLibraries>
<AssemblyName>WebTest.WebService.Plugin.ResultTab</AssemblyName>
<DeploymentDirectory>.\bin\</DeploymentDirectory>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<Optimize>false</Optimize>
<OutputPath>.\bin\Debug\</OutputPath>
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<WarningLevel>4</WarningLevel>
<IncrementalBuild>false</IncrementalBuild>
<DocumentationFile>WebTest.WebService.Plugin.ResultTab.xml</DocumentationFile>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>false</DebugSymbols>
<Optimize>true</Optimize>
<OutputPath>.\bin\Release\</OutputPath>
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
<DefineConstants>TRACE</DefineConstants>
<WarningLevel>4</WarningLevel>
<IncrementalBuild>false</IncrementalBuild>
<DocumentationFile>WebTest.WebService.Plugin.ResultTab.xml</DocumentationFile>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<RootNamespace>WebTest.WebService.Plugin.ResultTab</RootNamespace>
</PropertyGroup>
<ItemGroup>
<Reference Include="Extensibility, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<EmbedInteropTypes>False</EmbedInteropTypes>
</Reference>
<Reference Include="Microsoft.mshtml, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="Microsoft.VisualStudio.QualityTools.LoadTestFramework" />
<Reference Include="Microsoft.VisualStudio.QualityTools.LoadTestPackage">
<HintPath>C:\Program Files\Microsoft Visual Studio 11.0\Common7\IDE\PrivateAssemblies\Microsoft.VisualStudio.QualityTools.LoadTestPackage.dll</HintPath>
<HintPath>C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\PrivateAssemblies\Microsoft.VisualStudio.QualityTools.LoadTestPackage.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.QualityTools.WebTestFramework" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.VisualStudio.Shell.11.0" />
<Reference Include="Microsoft.VisualStudio.Shell.Immutable.11.0" />
<Reference Include="Microsoft.VisualStudio.OLE.Interop" />
<Reference Include="Microsoft.VisualStudio.Shell.Interop" />
<Reference Include="Microsoft.VisualStudio.Shell.Interop.8.0" />
<Reference Include="Microsoft.VisualStudio.Shell.Interop.9.0" />
<Reference Include="Microsoft.VisualStudio.Shell.Interop.10.0" />
<Reference Include="VSLangProj, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="VSLangProj2, Version=7.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="VSLangProj80, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Connect.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="WebServiceResult.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="WebServiceResult.Designer.cs">
<DependentUpon>WebServiceResult.cs</DependentUpon>
</Compile>
<Compile Include="WebTestDetail.cs" />
<Compile Include="XmlTreeView.cs" />
</ItemGroup>
<ItemGroup>
<COMReference Include="EnvDTE">
<Guid>{80CC9F66-E7D8-4DDD-85B6-D9E6CD0E93E2}</Guid>
<VersionMajor>8</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>primary</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>False</EmbedInteropTypes>
</COMReference>
<COMReference Include="EnvDTE100">
<Guid>{26AD1324-4B7C-44BC-84F8-B86AED45729F}</Guid>
<VersionMajor>10</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>primary</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>False</EmbedInteropTypes>
</COMReference>
<COMReference Include="EnvDTE80">
<Guid>{1A31287A-4D7D-413E-8E32-3B374931BD89}</Guid>
<VersionMajor>8</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>primary</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>False</EmbedInteropTypes>
</COMReference>
<COMReference Include="EnvDTE90">
<Guid>{2CE2370E-D744-4936-A090-3FFFE667B0E1}</Guid>
<VersionMajor>9</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>primary</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>False</EmbedInteropTypes>
</COMReference>
<COMReference Include="Microsoft.VisualStudio.CommandBars">
<Guid>{1CBA492E-7263-47BB-87FE-639000619B15}</Guid>
<VersionMajor>8</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>primary</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>False</EmbedInteropTypes>
</COMReference>
<COMReference Include="stdole">
<Guid>{00020430-0000-0000-C000-000000000046}</Guid>
<VersionMajor>2</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>primary</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>False</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<ItemGroup>
<Content Include="WebServicePluginForWebTestResultTab.AddIn">
<SubType>Designer</SubType>
</Content>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="WebServiceResult.resx">
<DependentUpon>WebServiceResult.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\WebTestWebServiceRuntime\WebServicePluginForWebTestRuntime.csproj">
<Project>{F9E36CFA-A657-4DD4-BD17-BA3D91EB469F}</Project>
<Name>WebServicePluginForWebTestRuntime</Name>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
<ProjectExtensions />
<Target Name="AfterBuild">
<PropertyGroup>
<DllName>$(AssemblyName).dll</DllName>
<PdbName>$(AssemblyName).pdb</PdbName>
<DocFileName>$(AssemblyName).xml</DocFileName>
</PropertyGroup>
<Delete Condition="Exists('$(DeploymentDirectory)$(DllName)')" Files="$(DeploymentDirectory)$(DllName)">
</Delete>
<Delete Condition="Exists('$(DeploymentDirectory)$(PdbName)')" Files="$(DeploymentDirectory)$(PdbName)">
</Delete>
<Delete Condition="Exists('$(DeploymentDirectory)$(DocFileName)')" Files="$(DeploymentDirectory)$(DocFileName)">
</Delete>
<Copy Condition="Exists('$(OutputPath)$(DllName)')" SourceFiles="$(OutputPath)$(DllName)" DestinationFolder="$(DeploymentDirectory)">
<Output TaskParameter="DestinationFiles" ItemName="FileWrites" />
</Copy>
<Copy Condition="Exists('$(OutputPath)$(PdbName)')" SourceFiles="$(OutputPath)$(PdbName)" DestinationFolder="$(DeploymentDirectory)">
<Output TaskParameter="DestinationFiles" ItemName="FileWrites" />
</Copy>
<Copy Condition="Exists('$(OutputPath)$(DocFileName)')" SourceFiles="$(OutputPath)$(DocFileName)" DestinationFolder="$(DeploymentDirectory)">
<Output TaskParameter="DestinationFiles" ItemName="FileWrites" />
</Copy>
</Target>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30424</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{48B3509E-1FD8-4875-8FC6-137647EB83AA}</ProjectGuid>
<OutputType>Library</OutputType>
<StartupObject>
</StartupObject>
<NoStandardLibraries>false</NoStandardLibraries>
<AssemblyName>WebTest.WebService.Plugin.ResultTab</AssemblyName>
<DeploymentDirectory>.\bin\</DeploymentDirectory>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<Optimize>false</Optimize>
<OutputPath>.\bin\Debug\</OutputPath>
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<WarningLevel>4</WarningLevel>
<IncrementalBuild>false</IncrementalBuild>
<DocumentationFile>WebTest.WebService.Plugin.ResultTab.xml</DocumentationFile>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>false</DebugSymbols>
<Optimize>true</Optimize>
<OutputPath>.\bin\Release\</OutputPath>
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
<DefineConstants>TRACE</DefineConstants>
<WarningLevel>4</WarningLevel>
<IncrementalBuild>false</IncrementalBuild>
<DocumentationFile>WebTest.WebService.Plugin.ResultTab.xml</DocumentationFile>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<RootNamespace>WebTest.WebService.Plugin.ResultTab</RootNamespace>
</PropertyGroup>
<ItemGroup>
<Reference Include="Extensibility, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<EmbedInteropTypes>False</EmbedInteropTypes>
</Reference>
<Reference Include="Microsoft.mshtml, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="Microsoft.VisualStudio.QualityTools.LoadTestFramework" />
<Reference Include="Microsoft.VisualStudio.QualityTools.LoadTestPackage">
<HintPath>..\..\..\..\..\..\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PrivateAssemblies\Microsoft.VisualStudio.QualityTools.LoadTestPackage.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualStudio.QualityTools.WebTestFramework" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.VisualStudio.Shell.11.0" />
<Reference Include="Microsoft.VisualStudio.Shell.Immutable.11.0" />
<Reference Include="Microsoft.VisualStudio.OLE.Interop" />
<Reference Include="Microsoft.VisualStudio.Shell.Interop" />
<Reference Include="Microsoft.VisualStudio.Shell.Interop.8.0" />
<Reference Include="Microsoft.VisualStudio.Shell.Interop.9.0" />
<Reference Include="Microsoft.VisualStudio.Shell.Interop.10.0" />
<Reference Include="VSLangProj, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="VSLangProj2, Version=7.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="VSLangProj80, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Connect.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="WebServiceResult.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="WebServiceResult.Designer.cs">
<DependentUpon>WebServiceResult.cs</DependentUpon>
</Compile>
<Compile Include="WebTestDetail.cs" />
<Compile Include="XmlTreeView.cs" />
</ItemGroup>
<ItemGroup>
<COMReference Include="EnvDTE">
<Guid>{80CC9F66-E7D8-4DDD-85B6-D9E6CD0E93E2}</Guid>
<VersionMajor>8</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>primary</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>False</EmbedInteropTypes>
</COMReference>
<COMReference Include="EnvDTE100">
<Guid>{26AD1324-4B7C-44BC-84F8-B86AED45729F}</Guid>
<VersionMajor>10</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>primary</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>False</EmbedInteropTypes>
</COMReference>
<COMReference Include="EnvDTE80">
<Guid>{1A31287A-4D7D-413E-8E32-3B374931BD89}</Guid>
<VersionMajor>8</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>primary</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>False</EmbedInteropTypes>
</COMReference>
<COMReference Include="EnvDTE90">
<Guid>{2CE2370E-D744-4936-A090-3FFFE667B0E1}</Guid>
<VersionMajor>9</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>primary</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>False</EmbedInteropTypes>
</COMReference>
<COMReference Include="Microsoft.VisualStudio.CommandBars">
<Guid>{1CBA492E-7263-47BB-87FE-639000619B15}</Guid>
<VersionMajor>8</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>primary</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>False</EmbedInteropTypes>
</COMReference>
<COMReference Include="stdole">
<Guid>{00020430-0000-0000-C000-000000000046}</Guid>
<VersionMajor>2</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>primary</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>False</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<ItemGroup>
<Content Include="WebServicePluginForWebTestResultTab.AddIn">
<SubType>Designer</SubType>
</Content>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="WebServiceResult.resx">
<DependentUpon>WebServiceResult.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\WebTestWebServiceRuntime\WebServicePluginForWebTestRuntime.csproj">
<Project>{F9E36CFA-A657-4DD4-BD17-BA3D91EB469F}</Project>
<Name>WebServicePluginForWebTestRuntime</Name>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
<ProjectExtensions />
<Target Name="AfterBuild">
<PropertyGroup>
<DllName>$(AssemblyName).dll</DllName>
<PdbName>$(AssemblyName).pdb</PdbName>
<DocFileName>$(AssemblyName).xml</DocFileName>
</PropertyGroup>
<Delete Condition="Exists('$(DeploymentDirectory)$(DllName)')" Files="$(DeploymentDirectory)$(DllName)">
</Delete>
<Delete Condition="Exists('$(DeploymentDirectory)$(PdbName)')" Files="$(DeploymentDirectory)$(PdbName)">
</Delete>
<Delete Condition="Exists('$(DeploymentDirectory)$(DocFileName)')" Files="$(DeploymentDirectory)$(DocFileName)">
</Delete>
<Copy Condition="Exists('$(OutputPath)$(DllName)')" SourceFiles="$(OutputPath)$(DllName)" DestinationFolder="$(DeploymentDirectory)">
<Output TaskParameter="DestinationFiles" ItemName="FileWrites" />
</Copy>
<Copy Condition="Exists('$(OutputPath)$(PdbName)')" SourceFiles="$(OutputPath)$(PdbName)" DestinationFolder="$(DeploymentDirectory)">
<Output TaskParameter="DestinationFiles" ItemName="FileWrites" />
</Copy>
<Copy Condition="Exists('$(OutputPath)$(DocFileName)')" SourceFiles="$(OutputPath)$(DocFileName)" DestinationFolder="$(DeploymentDirectory)">
<Output TaskParameter="DestinationFiles" ItemName="FileWrites" />
</Copy>
</Target>
</Project>
\ No newline at end of file
......
......@@ -86,25 +86,28 @@ namespace WebTest.WebService.Plugin.ResultTab
{
try
{
this.dom = dom;
XmlNode xNode = dom.DocumentElement;
// Load the XML into the TreeView.
treeView.Nodes.Clear();
TreeNode treeNode = new TreeNode(xNode.Name);
treeNode.Tag = xNode;
if (xNode.HasChildNodes)
{
treeNode.Nodes.Add(new TreeNode("dummy"));
this.dom = dom;
if (dom.DocumentElement != null)
{
XmlNode xNode = dom.DocumentElement;
// Load the XML into the TreeView.
treeView.Nodes.Clear();
TreeNode treeNode = new TreeNode(xNode.Name);
treeNode.Tag = xNode;
if (xNode.HasChildNodes)
{
treeNode.Nodes.Add(new TreeNode("dummy"));
}
else
{
treeNode.Text = xNode.InnerXml.Trim();
}
treeView.Nodes.Add(treeNode);
treeNode.Collapse();
}
else
{
treeNode.Text = xNode.InnerXml.Trim();
}
treeView.Nodes.Add(treeNode);
treeNode.Collapse();
}
catch (Exception ex)
{
......
......@@ -50,7 +50,12 @@ namespace WebTest.WebService.Plugin.Runtime
{
get { return randomMatch; }
set { randomMatch = value; }
}
}
[DisplayName("Pass if not found")]
[Description("If set to true, this rule will pass the request even if no match is found.")]
[DefaultValue(false)]
public bool passIfNotFound { get; set; }
/// <summary>
/// The Extract method. The parameter e contains the Web test context.
......@@ -62,64 +67,62 @@ namespace WebTest.WebService.Plugin.Runtime
try
{
ContentHandler contentHandler = ContentHandlerFactory.GetHandler(e.Response.ContentType);
if (contentHandler == null)
{
return;
}
if (contentHandler != null) {
if (contentHandler.IsBinary)
{
contentHandler.MessageBytes = e.Response.BodyBytes;
}
else
{
contentHandler.MessageString = e.Response.BodyString;
}
if (contentHandler.IsBinary)
{
contentHandler.MessageBytes = e.Response.BodyBytes;
}
else
{
contentHandler.MessageString = e.Response.BodyString;
}
XPathNodeIterator iterator = contentHandler.EvaluateXPath(XPathToSearch);
XPathNodeIterator iterator = contentHandler.EvaluateXPath(XPathToSearch);
List<string> values = new List<string>();
List<string> values = new List<string>();
int i = 0;
while (iterator.MoveNext())
{
XPathNavigator nav2 = iterator.Current.Clone();
int i = 0;
while (iterator.MoveNext())
{
XPathNavigator nav2 = iterator.Current.Clone();
string value;
if (nav2.NodeType.Equals(XPathNodeType.Element))
{
value = nav2.InnerXml;
}
else
{
value = nav2.Value;
}
string value;
if (nav2.NodeType.Equals(XPathNodeType.Element))
{
value = nav2.InnerXml;
}
else
{
value = nav2.Value;
values.Add(value);
if (!ExtractRandomMatch && (i == Index))
{
// add the extracted value to the Web test context
e.WebTest.Context.Add(this.ContextParameterName, value);
e.Success = true;
return;
}
i++;
}
values.Add(value);
if (!ExtractRandomMatch && (i == Index))
if (ExtractRandomMatch && (values.Count > 0))
{
// add the extracted value to the Web test context
e.WebTest.Context.Add(this.ContextParameterName, value);
Random random = new Random();
e.WebTest.Context.Add(this.ContextParameterName, values[random.Next(values.Count)]);
e.Success = true;
return;
}
i++;
}
if (ExtractRandomMatch && (values.Count > 0))
{
Random random = new Random();
e.WebTest.Context.Add(this.ContextParameterName, values[random.Next(values.Count)]);
e.Success = true;
return;
}
}
catch (Exception ex)
{
e.Message = ex.Message;
}
e.Success = false;
}
e.Success = passIfNotFound;
e.Message += " (XPath not found)";
return;
}
}
......
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="{289E27D1-0F89-4F1A-A2C7-9584091B9950}" Name="Web Test Plugin for Web Service Messages - VS 2012" Language="1033" Version="3.0.0.0" Manufacturer="Microsoft IT" UpgradeCode="{BF388820-5266-41AF-BFFE-DC183C37D624}">
<Product Id="{382AA10B-843C-474A-B662-C051AD2B160B}" Name="Web Test Plugin for Web Service Messages - VS 2013" Language="1033" Version="3.3.0.0" Manufacturer="LIGHTS IN LINE AB" UpgradeCode="{BF388820-5266-41AF-BFFE-DC183C37D624}">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<Media Id="1" Cabinet="WebServicePlugins1.cab" EmbedCab="yes" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MajorUpgrade AllowSameVersionUpgrades="yes" DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<Feature Id="ProductFeature" Title="Web Test Plugin for Web Service Messages" Level="1">
<ComponentRef Id="WebTestMessageEditor" />
......@@ -13,19 +13,19 @@
<ComponentRef Id="WebTestRuntime" />
</Feature>
<Property Id="VS2012INSTALLFOLDER" Secure="yes">
<RegistrySearch Id="VS2012InstallationFolderRegistrySearchId" Type="raw"
Root="HKLM" Key="SOFTWARE\Microsoft\VisualStudio\11.0" Name="InstallDir"></RegistrySearch>
<Property Id="VS2013INSTALLFOLDER" Secure="yes">
<RegistrySearch Id="VS2013InstallationFolderRegistrySearchId" Type="raw"
Root="HKLM" Key="SOFTWARE\Microsoft\VisualStudio\12.0" Name="InstallDir"></RegistrySearch>
</Property>
<Condition Message="Visual Studio 2012 not found.">
Installed OR VS2012INSTALLFOLDER
<Condition Message="Visual Studio 2013 not found.">
Installed OR VS2013INSTALLFOLDER
</Condition>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="VS2012INSTALLFOLDER">
<Directory Id="VS2013INSTALLFOLDER">
<Directory Id="PrivateAssemblies" Name="PrivateAssemblies">
<Directory Id="WebTestPlugins" Name="WebTestPlugins">
<Component Id="WebTestMessageEditor" Guid="{17E95CD2-6B83-46C9-AEE5-019853FF62EC}">
......@@ -43,7 +43,7 @@
<Directory Id="AppDataFolder">
<Directory Id="MSAppDataDir" Name="Microsoft">
<Directory Id="VSAppDataDir" Name="VisualStudio">
<Directory Id="VSAppDataVersionDir" Name="11.0">
<Directory Id="VSAppDataVersionDir" Name="12.0">
<Directory Id="VSAddins" Name="Addins">
<Component Id="WebTestResultTab" Guid="{27569640-6946-4E4F-8E55-109E99A79DB9}">
<RegistryValue KeyPath="yes" Root="HKCU" Key="SOFTWARE\Microsoft\WebServicePlugin" Name="Installed" Type="integer" Value="1" Action="write" />
......