1
我有一些相對簡單的交易,比如「開始用戶交易」,這通常需要幾秒鐘的時間才能通過SilkPerformer運行VS項目。當我嘗試使用VS 2015性能測試工具執行相同的事務(本地控制器上)時,響應時間反覆增加大約12秒。VS 2015交易響應時間遠高於SilkPerformer
我有一個事務記錄器捕獲每個事務的響應時間,所以我可以在VS中執行期間單獨看到它們,並且我想知道如果我在某處丟失了一個設置或者我可以做出配置更改到項目,因爲它幾乎看起來好像項目正在着手執行交易。無論是直接運行在代理程序還是控制器上,我都會得到相同的行爲,因此它看起來沒有網絡相關性。
這是代碼的樣本對正在執行:
public interface ITestTransactionTimer : IDisposable { }
public class TestTransactionTimer : ITestTransactionTimer
{
public TestContext TestContext { get; private set; }
public string TransactionName { get; private set; }
public TestTransactionTimer(TestContext testContext, string transactionName)
{
this.TestContext = testContext;
this.TransactionName = transactionName;
this.TestContext.BeginTimer(this.TransactionName);
}
public void Dispose()
{
this.TestContext.EndTimer(this.TransactionName);
}
}
public class NoOpTestTransactionTimer : ITestTransactionTimer
{
public void Dispose() { }
}
protected ITestTransactionTimer LogTransaction(string transactionName)
{
if ((null == this.TestContext) || !this.TestContext.Properties.Contains("$LoadTestUserContext"))
{
return new NoOpTestTransactionTimer();
}
return new TestTransactionTimer(this.TestContext, transactionName);
}
private TestContext testContextInstance;
public TestContext TestContext
{
get { return testContextInstance; }
set { testContextInstance = value; }
}
//starting User Session
[DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV", "C:\\Path\\Data.csv", "Data#csv", DataAccessMethod.Sequential), DeploymentItem("C:\\Path\\Data.csv"), TestMethod]
public void smokeTest()
{
sUserName = "domain\\"+TestContext.DataRow["user"].ToString();
sPassword = TestContext.DataRow["password"].ToString();
prospectClientId = TestContext.DataRow["prospectClientId"].ToString();
accountNumber = TestContext.DataRow["accountNumber"].ToString();
correlationId = "startUserSession - " + obj.ToString();
// Start User Session
using (this.LogTransaction("t1_startUserSession"))
{
ChannelFactory<IAppShellService> cfsus = null;
try
{
using (ChannelBuilder.mPContext(ref appShellServiceClient, "IAppShellService", sUserName, sPassword, 0, null, correlationId, false, effectiveDate, ref cfsus))
{
var userSessionResult = appShellServiceClient.StartUserSession();
}
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
finally
{
cfsus.Close();
}
}
}
你解決了這個問題嗎?如果沒有,那麼在閱讀[mcve]後請[編輯]問題。如果你已經解決了這個問題,那麼請閱讀http://stackoverflow.com/help/accepted-answer。 – AdrianHHH