怎么从命令行启动C#的WebTestRequest测试程序?
我写了一个WebTest程序,代码如下:
namespace YingYongTianXiaTest
{
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.VisualStudio.TestTools.WebTesting;
using Microsoft.VisualStudio.TestTools.WebTesting.Rules;
using AppFactory.Test.Helper;
using AppFactory.Test.Helper.YingYongTianXia;
public class AppInfoTest : WebTest
{
public AppInfoTest()
{
this.PreAuthenticate = true;
}
public override IEnumerator<WebTestRequest> GetRequestEnumerator()
{
// Initialize validation rules that apply to all requests in the WebTest
if ((this.Context.ValidationLevel >= Microsoft.VisualStudio.TestTools.WebTesting.ValidationLevel.Low))
{
ValidateResponseUrl validationRule1 = new ValidateResponseUrl();
this.ValidateResponse += new EventHandler<ValidationEventArgs>(validationRule1.Validate);
}
if ((this.Context.ValidationLevel >= Microsoft.VisualStudio.TestTools.WebTesting.ValidationLevel.Low))
{
ValidationRuleResponseTimeGoal validationRule2 = new ValidationRuleResponseTimeGoal();
validationRule2.Tolerance = 0D;
this.ValidateResponseOnPageComplete += new EventHandler<ValidationEventArgs>(validationRule2.Validate);
}
//随机生成详情页面请求
YingYongTXUrlParameters param = YingYongTXUrlParameters.NextRandomParameters(true, false);
string url = YingYongTXHelper.NextAppInfoServiceUrl(param);
WebTestRequest request1 = new WebTestRequest(url);
request1.ExpectedHttpStatusCode = 200;
yield return request1;
request1 = null;
}
}
}
在VS2010中,直接按run按钮,就可以运行了,但是怎么从命令行启动这个程序呢?
csc XX.cs?我试过了,说没有main函数,不能启动,各位帮帮忙啊。
------解决方案--------------------
命令行中直接输入exe文件的目录