Commit 93e0ce42 93e0ce428d09fc54a38c66d0fa34ad328e90a317 by Christian Gerdes

New debug options in SetTestParameters

1 parent 4ce8d5dd
...@@ -175,6 +175,7 @@ namespace LIL_VSTT_Plugins ...@@ -175,6 +175,7 @@ namespace LIL_VSTT_Plugins
175 private string myScenarioNames = ""; 175 private string myScenarioNames = "";
176 private string myAgentNames = ""; 176 private string myAgentNames = "";
177 private string myColNames = ""; 177 private string myColNames = "";
178 private string myDebugLogFile = "";
178 private bool myUseRandom = true; 179 private bool myUseRandom = true;
179 private bool myUseUnique = false; 180 private bool myUseUnique = false;
180 private bool myUseUniqueFiles = false; 181 private bool myUseUniqueFiles = false;
...@@ -187,6 +188,7 @@ namespace LIL_VSTT_Plugins ...@@ -187,6 +188,7 @@ namespace LIL_VSTT_Plugins
187 private bool myHasColName = false; 188 private bool myHasColName = false;
188 private bool myUseAutoSplit = false; 189 private bool myUseAutoSplit = false;
189 private bool myIgnoreBlanks = true; 190 private bool myIgnoreBlanks = true;
191 private bool myDebug = false;
190 192
191 private bool stop = false; 193 private bool stop = false;
192 private int timeWait = 0; 194 private int timeWait = 0;
...@@ -200,6 +202,24 @@ namespace LIL_VSTT_Plugins ...@@ -200,6 +202,24 @@ namespace LIL_VSTT_Plugins
200 202
201 #region guiparams 203 #region guiparams
202 204
205 [DisplayName("Debug Mode")]
206 [Description("Set True in order to enable Debug Mode. Each agent will log debug messages to the given Debug Log File.")]
207 [DefaultValue(false)]
208 public bool DebugMode
209 {
210 get { return myDebug; }
211 set { myDebug = value; }
212 }
213
214 [DisplayName("Debug Log File")]
215 [Description("Log file path to be used for debug logging, if enabled (True)")]
216 [DefaultValue("C:\\Temp\\SetTestParameterDebug.log")]
217 public string DebugLogFile
218 {
219 get { return myDebugLogFile; }
220 set { myDebugLogFile = value; }
221 }
222
203 [DisplayName("CSV filens sökväg")] 223 [DisplayName("CSV filens sökväg")]
204 [Description("Ange den fullständiga sökvägen till CSV filen. Observera att filen behöver finnas på alla agenterna också om du inte kör lokalt.")] 224 [Description("Ange den fullständiga sökvägen till CSV filen. Observera att filen behöver finnas på alla agenterna också om du inte kör lokalt.")]
205 [DefaultValue("C:\\Userdata.csv")] 225 [DefaultValue("C:\\Userdata.csv")]
...@@ -388,7 +408,10 @@ namespace LIL_VSTT_Plugins ...@@ -388,7 +408,10 @@ namespace LIL_VSTT_Plugins
388 else if (myUseUniqueIteration) 408 else if (myUseUniqueIteration)
389 m_loadTest.TestStarting += new EventHandler<TestStartingEventArgs>(loadTestStartingUniqueIteration); 409 m_loadTest.TestStarting += new EventHandler<TestStartingEventArgs>(loadTestStartingUniqueIteration);
390 else if (myUseUniqueFiles) 410 else if (myUseUniqueFiles)
411 {
391 m_loadTest.TestStarting += new EventHandler<TestStartingEventArgs>(loadTestStartingUniqueFiles); 412 m_loadTest.TestStarting += new EventHandler<TestStartingEventArgs>(loadTestStartingUniqueFiles);
413 m_loadTest.TestFinished += new EventHandler<TestFinishedEventArgs>(loadTestFinishedUniqueFiles);
414 }
392 else if (myUseUnique) 415 else if (myUseUnique)
393 m_loadTest.TestStarting += new EventHandler<TestStartingEventArgs>(loadTestStartingUnique); 416 m_loadTest.TestStarting += new EventHandler<TestStartingEventArgs>(loadTestStartingUnique);
394 else if (myUseRandom) 417 else if (myUseRandom)
...@@ -408,7 +431,7 @@ namespace LIL_VSTT_Plugins ...@@ -408,7 +431,7 @@ namespace LIL_VSTT_Plugins
408 if (stop) 431 if (stop)
409 { 432 {
410 if (timeWait > 60) 433 if (timeWait > 60)
411 m_loadTest.Abort(new Exception("Out of test data")); 434 m_loadTest.Abort(new Exception("Out of test data: " + myConnectionString + " does not have more than " + myParams.Count + " accepted rows with IgnoreBlanks " + myIgnoreBlanks + "), Autosplit " + myUseAutoSplit + " and with " + m_loadTest.Context.AgentCount + " Agent(s)."));
412 else 435 else
413 timeWait++; 436 timeWait++;
414 } 437 }
...@@ -466,7 +489,17 @@ namespace LIL_VSTT_Plugins ...@@ -466,7 +489,17 @@ namespace LIL_VSTT_Plugins
466 userRow[e.UserContext.UserId] = row; 489 userRow[e.UserContext.UserId] = row;
467 } 490 }
468 } 491 }
469 setParameters(this.getSeqUser(row), e); 492 string strParams = this.getSeqUser(row);
493 setParameters(strParams, e);
494 if (myDebug) lock (myDebugLogFile) { File.AppendAllText(myDebugLogFile, DateTime.Now.ToLocalTime() + " File: " + myConnectionString + " Test: " + e.TestName + " VU: " + e.UserContext.UserId + " Row: " + row + " Value: \"" + strParams + "\"\r\n"); }
495 }
496 }
497
498 void loadTestFinishedUniqueFiles(object sender, TestFinishedEventArgs e)
499 {
500 if (shouldRun(e))
501 {
502
470 } 503 }
471 } 504 }
472 505
...@@ -495,7 +528,6 @@ namespace LIL_VSTT_Plugins ...@@ -495,7 +528,6 @@ namespace LIL_VSTT_Plugins
495 { 528 {
496 if (shouldRun(e)) 529 if (shouldRun(e))
497 { 530 {
498
499 // Add context parameters to the starting test 531 // Add context parameters to the starting test
500 int numParams = 1; 532 int numParams = 1;
501 if (myHasColName == true && myColNames.Contains(',')) numParams = countColumns(myColNames); 533 if (myHasColName == true && myColNames.Contains(',')) numParams = countColumns(myColNames);
......