Commit ec037e69 ec037e69fd337a23fda746cd4cff5208f9f23418 by Christian Gerdes

- Fixed null ref errors on empty json/xml body

- Added PassIfNotFound option to XPathExtractionRule
1 parent 34618ddb
......@@ -53,9 +53,7 @@
</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>
<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" />
......
......@@ -87,6 +87,8 @@ namespace WebTest.WebService.Plugin.ResultTab
try
{
this.dom = dom;
if (dom.DocumentElement != null)
{
XmlNode xNode = dom.DocumentElement;
// Load the XML into the TreeView.
......@@ -106,6 +108,7 @@ namespace WebTest.WebService.Plugin.ResultTab
treeView.Nodes.Add(treeNode);
treeNode.Collapse();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error");
......
......@@ -52,6 +52,11 @@ namespace WebTest.WebService.Plugin.Runtime
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.
/// </summary>
......@@ -62,11 +67,7 @@ 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;
......@@ -114,12 +115,14 @@ namespace WebTest.WebService.Plugin.Runtime
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" />
......