New option to SetTestParameter plugin: Use_UniqueFiles
Showing
2 changed files
with
40 additions
and
3 deletions
... | @@ -177,6 +177,7 @@ namespace LIL_VSTT_Plugins | ... | @@ -177,6 +177,7 @@ namespace LIL_VSTT_Plugins |
177 | private string myColNames = ""; | 177 | private string myColNames = ""; |
178 | private bool myUseRandom = true; | 178 | private bool myUseRandom = true; |
179 | private bool myUseUnique = false; | 179 | private bool myUseUnique = false; |
180 | private bool myUseUniqueFiles = false; | ||
180 | private bool myUseUniqueIteration = false; | 181 | private bool myUseUniqueIteration = false; |
181 | private bool myUseUniqueTestIteration = false; | 182 | private bool myUseUniqueTestIteration = false; |
182 | private bool myLogToFile = false; | 183 | private bool myLogToFile = false; |
... | @@ -189,10 +190,12 @@ namespace LIL_VSTT_Plugins | ... | @@ -189,10 +190,12 @@ namespace LIL_VSTT_Plugins |
189 | 190 | ||
190 | private bool stop = false; | 191 | private bool stop = false; |
191 | private int timeWait = 0; | 192 | private int timeWait = 0; |
193 | private int nextAvailableRow = 0; | ||
192 | 194 | ||
193 | private StringCollection myParams = new StringCollection(); | 195 | private StringCollection myParams = new StringCollection(); |
194 | private Random random = new Random(); | 196 | private Random random = new Random(); |
195 | private Dictionary<string, int> testIterations = new Dictionary<string, int>(); | 197 | private Dictionary<string, int> testIterations = new Dictionary<string, int>(); |
198 | private Dictionary<int, int> userRow = new Dictionary<int, int>(); | ||
196 | private LoadTest m_loadTest; | 199 | private LoadTest m_loadTest; |
197 | 200 | ||
198 | #region guiparams | 201 | #region guiparams |
... | @@ -287,6 +290,15 @@ namespace LIL_VSTT_Plugins | ... | @@ -287,6 +290,15 @@ namespace LIL_VSTT_Plugins |
287 | set { myUseUnique = value; } | 290 | set { myUseUnique = value; } |
288 | } | 291 | } |
289 | 292 | ||
293 | [DisplayName("Välj unikt per VU per Testdatafil?")] | ||
294 | [Description("Ange True om du vill att varje testdatafil (CSV) hanteras separat för varje unik VU. Pluginet kommer då komma ihåg vilka rader som delats ut separat för varje fil.")] | ||
295 | [DefaultValue(false)] | ||
296 | public bool Use_UniqueFiles | ||
297 | { | ||
298 | get { return myUseUniqueFiles; } | ||
299 | set { myUseUniqueFiles = value; } | ||
300 | } | ||
301 | |||
290 | [DisplayName("Välj unikt per Iteration?")] | 302 | [DisplayName("Välj unikt per Iteration?")] |
291 | [Description("Ange True om du vill att varje LoadTest VU ska ha sitt eget unika värde för varje iteration av alla tester, dvs aldrig återanvändas av någon VU i något test. Gäller före unikt per test iteration.")] | 303 | [Description("Ange True om du vill att varje LoadTest VU ska ha sitt eget unika värde för varje iteration av alla tester, dvs aldrig återanvändas av någon VU i något test. Gäller före unikt per test iteration.")] |
292 | [DefaultValue(false)] | 304 | [DefaultValue(false)] |
... | @@ -371,10 +383,12 @@ namespace LIL_VSTT_Plugins | ... | @@ -371,10 +383,12 @@ namespace LIL_VSTT_Plugins |
371 | 383 | ||
372 | if (myParams.Count > 0) | 384 | if (myParams.Count > 0) |
373 | { | 385 | { |
374 | if (myUseUniqueIteration) | 386 | if (myUseUniqueTestIteration) |
375 | m_loadTest.TestStarting += new EventHandler<TestStartingEventArgs>(loadTestStartingUniqueIteration); | ||
376 | else if(myUseUniqueTestIteration) | ||
377 | m_loadTest.TestStarting += new EventHandler<TestStartingEventArgs>(loadTestStartingUniqueTestIteration); | 387 | m_loadTest.TestStarting += new EventHandler<TestStartingEventArgs>(loadTestStartingUniqueTestIteration); |
388 | else if (myUseUniqueIteration) | ||
389 | m_loadTest.TestStarting += new EventHandler<TestStartingEventArgs>(loadTestStartingUniqueIteration); | ||
390 | else if (myUseUniqueFiles) | ||
391 | m_loadTest.TestStarting += new EventHandler<TestStartingEventArgs>(loadTestStartingUniqueFiles); | ||
378 | else if (myUseUnique) | 392 | else if (myUseUnique) |
379 | m_loadTest.TestStarting += new EventHandler<TestStartingEventArgs>(loadTestStartingUnique); | 393 | m_loadTest.TestStarting += new EventHandler<TestStartingEventArgs>(loadTestStartingUnique); |
380 | else if (myUseRandom) | 394 | else if (myUseRandom) |
... | @@ -434,6 +448,28 @@ namespace LIL_VSTT_Plugins | ... | @@ -434,6 +448,28 @@ namespace LIL_VSTT_Plugins |
434 | setParameters(this.getSeqUser(e.UserContext.CompletedTestCount), e); | 448 | setParameters(this.getSeqUser(e.UserContext.CompletedTestCount), e); |
435 | } | 449 | } |
436 | 450 | ||
451 | void loadTestStartingUniqueFiles(object sender, TestStartingEventArgs e) | ||
452 | { | ||
453 | if (shouldRun(e)) | ||
454 | { | ||
455 | int row = 0; | ||
456 | // Go single threaded | ||
457 | lock (userRow) | ||
458 | { | ||
459 | // Check if the user already has a row in our file, otherwise get the next one | ||
460 | if (userRow.ContainsKey(e.UserContext.UserId)) row = userRow[e.UserContext.UserId]; | ||
461 | else | ||
462 | { | ||
463 | // New user, get the next row and increase the counter | ||
464 | row = nextAvailableRow++; | ||
465 | // Save the row for this user | ||
466 | userRow[e.UserContext.UserId] = row; | ||
467 | } | ||
468 | } | ||
469 | setParameters(this.getSeqUser(row), e); | ||
470 | } | ||
471 | } | ||
472 | |||
437 | void loadTestStartingUnique(object sender, TestStartingEventArgs e) | 473 | void loadTestStartingUnique(object sender, TestStartingEventArgs e) |
438 | { | 474 | { |
439 | setParameters(this.getSeqUser(e.UserContext.UserId), e); | 475 | setParameters(this.getSeqUser(e.UserContext.UserId), e); | ... | ... |
-
Please register or sign in to post a comment