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 @@ ...@@ -53,9 +53,7 @@
53 </Reference> 53 </Reference>
54 <Reference Include="Microsoft.VisualStudio.QualityTools.LoadTestFramework" /> 54 <Reference Include="Microsoft.VisualStudio.QualityTools.LoadTestFramework" />
55 <Reference Include="Microsoft.VisualStudio.QualityTools.LoadTestPackage"> 55 <Reference Include="Microsoft.VisualStudio.QualityTools.LoadTestPackage">
56 <HintPath>C:\Program Files\Microsoft Visual Studio 11.0\Common7\IDE\PrivateAssemblies\Microsoft.VisualStudio.QualityTools.LoadTestPackage.dll</HintPath> 56 <HintPath>..\..\..\..\..\..\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PrivateAssemblies\Microsoft.VisualStudio.QualityTools.LoadTestPackage.dll</HintPath>
57 <HintPath>C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\PrivateAssemblies\Microsoft.VisualStudio.QualityTools.LoadTestPackage.dll</HintPath>
58 <Private>False</Private>
59 </Reference> 57 </Reference>
60 <Reference Include="Microsoft.VisualStudio.QualityTools.WebTestFramework" /> 58 <Reference Include="Microsoft.VisualStudio.QualityTools.WebTestFramework" />
61 <Reference Include="System" /> 59 <Reference Include="System" />
......
...@@ -87,6 +87,8 @@ namespace WebTest.WebService.Plugin.ResultTab ...@@ -87,6 +87,8 @@ namespace WebTest.WebService.Plugin.ResultTab
87 try 87 try
88 { 88 {
89 this.dom = dom; 89 this.dom = dom;
90 if (dom.DocumentElement != null)
91 {
90 XmlNode xNode = dom.DocumentElement; 92 XmlNode xNode = dom.DocumentElement;
91 93
92 // Load the XML into the TreeView. 94 // Load the XML into the TreeView.
...@@ -106,6 +108,7 @@ namespace WebTest.WebService.Plugin.ResultTab ...@@ -106,6 +108,7 @@ namespace WebTest.WebService.Plugin.ResultTab
106 treeView.Nodes.Add(treeNode); 108 treeView.Nodes.Add(treeNode);
107 treeNode.Collapse(); 109 treeNode.Collapse();
108 } 110 }
111 }
109 catch (Exception ex) 112 catch (Exception ex)
110 { 113 {
111 MessageBox.Show(ex.Message, "Error"); 114 MessageBox.Show(ex.Message, "Error");
......
...@@ -52,6 +52,11 @@ namespace WebTest.WebService.Plugin.Runtime ...@@ -52,6 +52,11 @@ namespace WebTest.WebService.Plugin.Runtime
52 set { randomMatch = value; } 52 set { randomMatch = value; }
53 } 53 }
54 54
55 [DisplayName("Pass if not found")]
56 [Description("If set to true, this rule will pass the request even if no match is found.")]
57 [DefaultValue(false)]
58 public bool passIfNotFound { get; set; }
59
55 /// <summary> 60 /// <summary>
56 /// The Extract method. The parameter e contains the Web test context. 61 /// The Extract method. The parameter e contains the Web test context.
57 /// </summary> 62 /// </summary>
...@@ -62,11 +67,7 @@ namespace WebTest.WebService.Plugin.Runtime ...@@ -62,11 +67,7 @@ namespace WebTest.WebService.Plugin.Runtime
62 try 67 try
63 { 68 {
64 ContentHandler contentHandler = ContentHandlerFactory.GetHandler(e.Response.ContentType); 69 ContentHandler contentHandler = ContentHandlerFactory.GetHandler(e.Response.ContentType);
65 if (contentHandler == null) 70 if (contentHandler != null) {
66 {
67 return;
68 }
69
70 if (contentHandler.IsBinary) 71 if (contentHandler.IsBinary)
71 { 72 {
72 contentHandler.MessageBytes = e.Response.BodyBytes; 73 contentHandler.MessageBytes = e.Response.BodyBytes;
...@@ -114,12 +115,14 @@ namespace WebTest.WebService.Plugin.Runtime ...@@ -114,12 +115,14 @@ namespace WebTest.WebService.Plugin.Runtime
114 return; 115 return;
115 } 116 }
116 } 117 }
118 }
117 catch (Exception ex) 119 catch (Exception ex)
118 { 120 {
119 e.Message = ex.Message; 121 e.Message = ex.Message;
120 } 122 }
121 123
122 e.Success = false; 124 e.Success = passIfNotFound;
125 e.Message += " (XPath not found)";
123 return; 126 return;
124 } 127 }
125 } 128 }
......
1 <?xml version="1.0" encoding="UTF-8"?> 1 <?xml version="1.0" encoding="UTF-8"?>
2 <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> 2 <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
3 3
4 <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}"> 4 <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}">
5 <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" /> 5 <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
6 <Media Id="1" Cabinet="WebServicePlugins1.cab" EmbedCab="yes" /> 6 <Media Id="1" Cabinet="WebServicePlugins1.cab" EmbedCab="yes" />
7 7
8 <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." /> 8 <MajorUpgrade AllowSameVersionUpgrades="yes" DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
9 9
10 <Feature Id="ProductFeature" Title="Web Test Plugin for Web Service Messages" Level="1"> 10 <Feature Id="ProductFeature" Title="Web Test Plugin for Web Service Messages" Level="1">
11 <ComponentRef Id="WebTestMessageEditor" /> 11 <ComponentRef Id="WebTestMessageEditor" />
...@@ -13,19 +13,19 @@ ...@@ -13,19 +13,19 @@
13 <ComponentRef Id="WebTestRuntime" /> 13 <ComponentRef Id="WebTestRuntime" />
14 </Feature> 14 </Feature>
15 15
16 <Property Id="VS2012INSTALLFOLDER" Secure="yes"> 16 <Property Id="VS2013INSTALLFOLDER" Secure="yes">
17 <RegistrySearch Id="VS2012InstallationFolderRegistrySearchId" Type="raw" 17 <RegistrySearch Id="VS2013InstallationFolderRegistrySearchId" Type="raw"
18 Root="HKLM" Key="SOFTWARE\Microsoft\VisualStudio\11.0" Name="InstallDir"></RegistrySearch> 18 Root="HKLM" Key="SOFTWARE\Microsoft\VisualStudio\12.0" Name="InstallDir"></RegistrySearch>
19 </Property> 19 </Property>
20 20
21 <Condition Message="Visual Studio 2012 not found."> 21 <Condition Message="Visual Studio 2013 not found.">
22 Installed OR VS2012INSTALLFOLDER 22 Installed OR VS2013INSTALLFOLDER
23 </Condition> 23 </Condition>
24 </Product> 24 </Product>
25 25
26 <Fragment> 26 <Fragment>
27 <Directory Id="TARGETDIR" Name="SourceDir"> 27 <Directory Id="TARGETDIR" Name="SourceDir">
28 <Directory Id="VS2012INSTALLFOLDER"> 28 <Directory Id="VS2013INSTALLFOLDER">
29 <Directory Id="PrivateAssemblies" Name="PrivateAssemblies"> 29 <Directory Id="PrivateAssemblies" Name="PrivateAssemblies">
30 <Directory Id="WebTestPlugins" Name="WebTestPlugins"> 30 <Directory Id="WebTestPlugins" Name="WebTestPlugins">
31 <Component Id="WebTestMessageEditor" Guid="{17E95CD2-6B83-46C9-AEE5-019853FF62EC}"> 31 <Component Id="WebTestMessageEditor" Guid="{17E95CD2-6B83-46C9-AEE5-019853FF62EC}">
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
43 <Directory Id="AppDataFolder"> 43 <Directory Id="AppDataFolder">
44 <Directory Id="MSAppDataDir" Name="Microsoft"> 44 <Directory Id="MSAppDataDir" Name="Microsoft">
45 <Directory Id="VSAppDataDir" Name="VisualStudio"> 45 <Directory Id="VSAppDataDir" Name="VisualStudio">
46 <Directory Id="VSAppDataVersionDir" Name="11.0"> 46 <Directory Id="VSAppDataVersionDir" Name="12.0">
47 <Directory Id="VSAddins" Name="Addins"> 47 <Directory Id="VSAddins" Name="Addins">
48 <Component Id="WebTestResultTab" Guid="{27569640-6946-4E4F-8E55-109E99A79DB9}"> 48 <Component Id="WebTestResultTab" Guid="{27569640-6946-4E4F-8E55-109E99A79DB9}">
49 <RegistryValue KeyPath="yes" Root="HKCU" Key="SOFTWARE\Microsoft\WebServicePlugin" Name="Installed" Type="integer" Value="1" Action="write" /> 49 <RegistryValue KeyPath="yes" Root="HKCU" Key="SOFTWARE\Microsoft\WebServicePlugin" Name="Installed" Type="integer" Value="1" Action="write" />
......