Angularjs Web测试失败,返回“0”;“404未找到”;运行时出错
我们正在为使用Visual Studio 2013 ultimate在Angular Java中开发的Web应用程序进行性能和负载测试 我们的做法:Angularjs Web测试失败,返回“0”;“404未找到”;运行时出错,angularjs,visual-studio-2013,performance-testing,load-testing,Angularjs,Visual Studio 2013,Performance Testing,Load Testing,我们正在为使用Visual Studio 2013 ultimate在Angular Java中开发的Web应用程序进行性能和负载测试 我们的做法: 记录Web测试 回放web测试 进行关联和参数化等 我们现在面临的问题是 当我们记录登录场景(如在web测试中输入用户名和密码)时,我们无法找到表单参数 在运行webtest时,我们得到一些文件的HTTP状态404错误,它们是: glyph-halflings-regular.eot 字体/字形图标-halflings-regular.woff
- glyph-halflings-regular.eot
- 字体/字形图标-halflings-regular.woff
- glyph-halflings-regular.ttf
因此,任何人都可以在运行webtest时帮助我们解决此错误。使用以下内容将其添加到您的web.xml文件中:
<mime-mapping>
<extension>woff</extension>
<mime-type>application/x-font-woff</mime-type>
</mime-mapping>
<mime-mapping>
<extension>eof</extension>
<mime-type>application/vnd.ms-fontobject</mime-type>
</mime-mapping>
<mime-mapping>
<extension>ttf</extension>
<mime-type>application/x-font-ttf</mime-type>
</mime-mapping>
沃夫
应用程序/x-font-woff
eof
应用程序/vnd.ms-fontobject
ttf
应用程序/x-font-ttf
使用以下内容将其添加到web.xml文件中:
<mime-mapping>
<extension>woff</extension>
<mime-type>application/x-font-woff</mime-type>
</mime-mapping>
<mime-mapping>
<extension>eof</extension>
<mime-type>application/vnd.ms-fontobject</mime-type>
</mime-mapping>
<mime-mapping>
<extension>ttf</extension>
<mime-type>application/x-font-ttf</mime-type>
</mime-mapping>
沃夫
应用程序/x-font-woff
eof
应用程序/vnd.ms-fontobject
ttf
应用程序/x-font-ttf
使用以下内容将其添加到web.xml文件中:
<mime-mapping>
<extension>woff</extension>
<mime-type>application/x-font-woff</mime-type>
</mime-mapping>
<mime-mapping>
<extension>eof</extension>
<mime-type>application/vnd.ms-fontobject</mime-type>
</mime-mapping>
<mime-mapping>
<extension>ttf</extension>
<mime-type>application/x-font-ttf</mime-type>
</mime-mapping>
沃夫
应用程序/x-font-woff
eof
应用程序/vnd.ms-fontobject
ttf
应用程序/x-font-ttf
使用以下内容将其添加到web.xml文件中:
<mime-mapping>
<extension>woff</extension>
<mime-type>application/x-font-woff</mime-type>
</mime-mapping>
<mime-mapping>
<extension>eof</extension>
<mime-type>application/vnd.ms-fontobject</mime-type>
</mime-mapping>
<mime-mapping>
<extension>ttf</extension>
<mime-type>application/x-font-ttf</mime-type>
</mime-mapping>
沃夫
应用程序/x-font-woff
eof
应用程序/vnd.ms-fontobject
ttf
应用程序/x-font-ttf
一个选项是在发出从属请求之前放弃它们。您可以创建插件来删除这些从属请求。下面是一个查找和删除请求的基本插件。这可以很容易地扩展到进行其他比较,例如r.Url.Contains(…)
等
public class WebTestDependentFilter : WebTestPlugin
{
public string EndsWithString { get; set; }
public override void PostRequest(object sender, PostRequestEventArgs e)
{
WebTestRequestCollection depsToRemove = new WebTestRequestCollection();
// Note, you can't modify the collection inside a foreach,
// hence the above collects requests to remove.
foreach (WebTestRequest r in e.Request.DependentRequests)
{
if ( r.Url.EndsWith(EndsWithString))
{
depsToRemove.Add(r);
e.WebTest.AddCommentToResult(string.Format(
"Dependant request ending with \"{0}\" removed : {1}",
EndsWithString, r.Url));
}
}
foreach (WebTestRequest r in depsToRemove)
{
e.Request.DependentRequests.Remove(r);
}
}
}
此插件基于第189页中描述的代码
另一种可能是向这些文件的web测试中添加显式依赖请求,并将预期HTTP状态代码属性设置为404
插件方法相对快速和简单。它的缺点是,由于不发送请求,因此减少了服务器和网络上的负载。第二种方法保留请求,因此可能被认为是更现实的性能测试
无论您采取哪种方式,您都可以向客户报告问题文件,因为这些文件似乎表明网站存在故障。一个选项是在发出相关请求之前放弃相关请求。您可以创建插件来删除这些从属请求。下面是一个查找和删除请求的基本插件。这可以很容易地扩展到进行其他比较,例如
r.Url.Contains(…)
等
public class WebTestDependentFilter : WebTestPlugin
{
public string EndsWithString { get; set; }
public override void PostRequest(object sender, PostRequestEventArgs e)
{
WebTestRequestCollection depsToRemove = new WebTestRequestCollection();
// Note, you can't modify the collection inside a foreach,
// hence the above collects requests to remove.
foreach (WebTestRequest r in e.Request.DependentRequests)
{
if ( r.Url.EndsWith(EndsWithString))
{
depsToRemove.Add(r);
e.WebTest.AddCommentToResult(string.Format(
"Dependant request ending with \"{0}\" removed : {1}",
EndsWithString, r.Url));
}
}
foreach (WebTestRequest r in depsToRemove)
{
e.Request.DependentRequests.Remove(r);
}
}
}
此插件基于第189页中描述的代码
另一种可能是向这些文件的web测试中添加显式依赖请求,并将预期HTTP状态代码属性设置为404
插件方法相对快速和简单。它的缺点是,由于不发送请求,因此减少了服务器和网络上的负载。第二种方法保留请求,因此可能被认为是更现实的性能测试
无论您采取哪种方式,您都可以向客户报告问题文件,因为这些文件似乎表明网站存在故障。一个选项是在发出相关请求之前放弃相关请求。您可以创建插件来删除这些从属请求。下面是一个查找和删除请求的基本插件。这可以很容易地扩展到进行其他比较,例如
r.Url.Contains(…)
等
public class WebTestDependentFilter : WebTestPlugin
{
public string EndsWithString { get; set; }
public override void PostRequest(object sender, PostRequestEventArgs e)
{
WebTestRequestCollection depsToRemove = new WebTestRequestCollection();
// Note, you can't modify the collection inside a foreach,
// hence the above collects requests to remove.
foreach (WebTestRequest r in e.Request.DependentRequests)
{
if ( r.Url.EndsWith(EndsWithString))
{
depsToRemove.Add(r);
e.WebTest.AddCommentToResult(string.Format(
"Dependant request ending with \"{0}\" removed : {1}",
EndsWithString, r.Url));
}
}
foreach (WebTestRequest r in depsToRemove)
{
e.Request.DependentRequests.Remove(r);
}
}
}
此插件基于第189页中描述的代码
另一种可能是向这些文件的web测试中添加显式依赖请求,并将预期HTTP状态代码属性设置为404
插件方法相对快速和简单。它的缺点是,由于不发送请求,因此减少了服务器和网络上的负载。第二种方法保留请求,因此可能被认为是更现实的性能测试
无论您采取哪种方式,您都可以向客户报告问题文件,因为这些文件似乎表明网站存在故障。一个选项是在发出相关请求之前放弃相关请求。您可以创建插件来删除这些从属请求。下面是一个查找和删除请求的基本插件。这可以很容易地扩展到进行其他比较,例如
r.Url.Contains(…)
等
public class WebTestDependentFilter : WebTestPlugin
{
public string EndsWithString { get; set; }
public override void PostRequest(object sender, PostRequestEventArgs e)
{
WebTestRequestCollection depsToRemove = new WebTestRequestCollection();
// Note, you can't modify the collection inside a foreach,
// hence the above collects requests to remove.
foreach (WebTestRequest r in e.Request.DependentRequests)
{
if ( r.Url.EndsWith(EndsWithString))
{
depsToRemove.Add(r);
e.WebTest.AddCommentToResult(string.Format(
"Dependant request ending with \"{0}\" removed : {1}",
EndsWithString, r.Url));
}
}
foreach (WebTestRequest r in depsToRemove)
{
e.Request.DependentRequests.Remove(r);
}
}
}
此插件基于第189页中描述的代码
另一种可能是向这些文件的web测试中添加显式依赖请求,并将预期HTTP状态代码属性设置为404
插件方法相对快速和简单。它的缺点是,由于不发送请求,因此减少了服务器和网络上的负载。第二种方法保留请求,因此可能被认为是更现实的性能测试
无论您采取哪种方式,您都可以向客户报告问题文件,因为这些文件似乎表明网站中存在故障。,谢谢。肯定会添加并将添加try@WayneWe我们正在使用Tomcat7服务器,我们从web.xml文件中删除了上述代码,并尝试了still sa