FIFO additional features for auto wash (beta)
Showing
1 changed file
with
129 additions
and
2 deletions
... | @@ -263,6 +263,15 @@ namespace LIL_VSTT_Plugins | ... | @@ -263,6 +263,15 @@ namespace LIL_VSTT_Plugins |
263 | private bool myIgnoreBlanks = true; | 263 | private bool myIgnoreBlanks = true; |
264 | private bool myDebug = false; | 264 | private bool myDebug = false; |
265 | 265 | ||
266 | private bool myFifoTrackFailed = false; | ||
267 | private Dictionary<string, int> failTable = new Dictionary<string, int>(); | ||
268 | private string myFifoLogFileString = ""; | ||
269 | private string myFifoDumpFileString = ""; | ||
270 | private bool myFifoLogToFile = false; | ||
271 | private int myFifoFailedLimit = 5; | ||
272 | private bool myFifoDoNotResetOnPassed = false; | ||
273 | private bool myFifoDumpWorkingTestDataOnFinish = false; | ||
274 | |||
266 | private bool stop = false; | 275 | private bool stop = false; |
267 | private int timeWait = 0; | 276 | private int timeWait = 0; |
268 | 277 | ||
... | @@ -493,6 +502,76 @@ namespace LIL_VSTT_Plugins | ... | @@ -493,6 +502,76 @@ namespace LIL_VSTT_Plugins |
493 | set { myAgentNames = value; } | 502 | set { myAgentNames = value; } |
494 | } | 503 | } |
495 | 504 | ||
505 | [Category("FIFO")] | ||
506 | [DisplayName("Auto Wash")] | ||
507 | [Description("Sluta använda rader av testdata som leder till att tester slutar i status Failed.")] | ||
508 | [DefaultValue(false)] | ||
509 | public bool FifoAutoExclude | ||
510 | { | ||
511 | get { return myFifoTrackFailed; } | ||
512 | set { myFifoTrackFailed = value; } | ||
513 | } | ||
514 | |||
515 | [Category("FIFO")] | ||
516 | [DisplayName("Nollställ ej efter lyckat test")] | ||
517 | [Description("Nollställ inte räknaren för antal felaktiga tester (Failed) i rad när ett test går bra (Passsed)")] | ||
518 | [DefaultValue(false)] | ||
519 | public bool FifoDoNotResetOnPassed | ||
520 | { | ||
521 | get { return myFifoDoNotResetOnPassed; } | ||
522 | set { myFifoDoNotResetOnPassed = value; } | ||
523 | } | ||
524 | |||
525 | [Category("FIFO")] | ||
526 | [DisplayName("Dumpa fungerande testdata efter avslutat loadtest")] | ||
527 | [Description("Dumpa fungerande testdatarader efter att loadtestet avslutats")] | ||
528 | [DefaultValue(false)] | ||
529 | public bool FifoDumpWorkingTestDataOnFinish | ||
530 | { | ||
531 | get { return myFifoDumpWorkingTestDataOnFinish; } | ||
532 | set { myFifoDumpWorkingTestDataOnFinish = value; } | ||
533 | } | ||
534 | |||
535 | [Category("FIFO")] | ||
536 | [DisplayName("Tröskelvärde")] | ||
537 | [Description("Sluta använda rader efter detta antal fel i rad.")] | ||
538 | [DefaultValue(5)] | ||
539 | public int FifoFailLimit | ||
540 | { | ||
541 | get { return myFifoFailedLimit; } | ||
542 | set { myFifoFailedLimit = value; } | ||
543 | } | ||
544 | |||
545 | [Category("FIFO")] | ||
546 | [DisplayName("Logga statistik")] | ||
547 | [Description("Loggar statistik efter loadtestets slut med antalet gånger som en testdatarad har slutat ett test i status Failed")] | ||
548 | [DefaultValue(false)] | ||
549 | public bool FifoLogToFile | ||
550 | { | ||
551 | get { return myFifoLogToFile; } | ||
552 | set { myFifoLogToFile = value; } | ||
553 | } | ||
554 | |||
555 | [Category("FIFO")] | ||
556 | [DisplayName("Loggfilens namn")] | ||
557 | [Description("Ange den fullständiga sökvägen till logg filen. Om filen finns kommer den inte skrivas över utan läggas till i slutet.")] | ||
558 | [DefaultValue("C:\\Temp\\Fifo.log")] | ||
559 | public string FifoLogFilePathString | ||
560 | { | ||
561 | get { return myFifoLogFileString; } | ||
562 | set { myFifoLogFileString = value; } | ||
563 | } | ||
564 | |||
565 | [Category("FIFO")] | ||
566 | [DisplayName("Dumpfilens namn")] | ||
567 | [Description("Ange den fullständiga sökvägen till logg filen. Om filen finns kommer den inte skrivas över utan läggas till i slutet.")] | ||
568 | [DefaultValue("C:\\Temp\\FifoDump.log")] | ||
569 | public string FifoDumpFilePathString | ||
570 | { | ||
571 | get { return myFifoDumpFileString; } | ||
572 | set { myFifoDumpFileString = value; } | ||
573 | } | ||
574 | |||
496 | #endregion | 575 | #endregion |
497 | 576 | ||
498 | public void Initialize(LoadTest loadTest) | 577 | public void Initialize(LoadTest loadTest) |
... | @@ -522,6 +601,10 @@ namespace LIL_VSTT_Plugins | ... | @@ -522,6 +601,10 @@ namespace LIL_VSTT_Plugins |
522 | else | 601 | else |
523 | m_loadTest.TestStarting += new EventHandler<TestStartingEventArgs>(loadTestStartingSeq); | 602 | m_loadTest.TestStarting += new EventHandler<TestStartingEventArgs>(loadTestStartingSeq); |
524 | } | 603 | } |
604 | if(myFifoTrackFailed) | ||
605 | { | ||
606 | m_loadTest.LoadTestFinished += new EventHandler(loadTestFinished); | ||
607 | } | ||
525 | if (myLogToFile) | 608 | if (myLogToFile) |
526 | { | 609 | { |
527 | m_loadTest.TestFinished += new EventHandler<TestFinishedEventArgs>(loadTestEndLogger); | 610 | m_loadTest.TestFinished += new EventHandler<TestFinishedEventArgs>(loadTestEndLogger); |
... | @@ -529,6 +612,24 @@ namespace LIL_VSTT_Plugins | ... | @@ -529,6 +612,24 @@ namespace LIL_VSTT_Plugins |
529 | m_loadTest.Heartbeat += new EventHandler<HeartbeatEventArgs>(loadTestHeartBeat); | 612 | m_loadTest.Heartbeat += new EventHandler<HeartbeatEventArgs>(loadTestHeartBeat); |
530 | } | 613 | } |
531 | 614 | ||
615 | void loadTestFinished(object sender, EventArgs e) | ||
616 | { | ||
617 | if(myFifoLogToFile) | ||
618 | { | ||
619 | foreach (KeyValuePair<string,int> kv in failTable) | ||
620 | { | ||
621 | File.AppendAllText(myFifoLogFileString, kv.Key + ":" + kv.Value + "\r\n"); | ||
622 | } | ||
623 | } | ||
624 | if(myFifoDumpWorkingTestDataOnFinish) | ||
625 | { | ||
626 | foreach (string row in myUnUsedQueue) | ||
627 | { | ||
628 | File.AppendAllText(myFifoDumpFileString, row + "\r\n"); | ||
629 | } | ||
630 | } | ||
631 | } | ||
632 | |||
532 | void loadTestHeartBeat(object sender, HeartbeatEventArgs e) | 633 | void loadTestHeartBeat(object sender, HeartbeatEventArgs e) |
533 | { | 634 | { |
534 | if (stop) | 635 | if (stop) |
... | @@ -604,9 +705,35 @@ namespace LIL_VSTT_Plugins | ... | @@ -604,9 +705,35 @@ namespace LIL_VSTT_Plugins |
604 | { | 705 | { |
605 | String queueVal = (String)e.UserContext["QueueVal"]; | 706 | String queueVal = (String)e.UserContext["QueueVal"]; |
606 | if (queueVal != null) | 707 | if (queueVal != null) |
607 | lock (myUnUsedQueue) | 708 | if (myFifoTrackFailed) |
608 | { | 709 | { |
609 | myUnUsedQueue.Enqueue(queueVal); | 710 | if(e.Result.Passed) |
711 | { | ||
712 | lock (myUnUsedQueue) | ||
713 | { | ||
714 | if(myFifoDoNotResetOnPassed == false) failTable[queueVal] = 0; | ||
715 | myUnUsedQueue.Enqueue(queueVal); | ||
716 | } | ||
717 | |||
718 | } else | ||
719 | { | ||
720 | lock (myUnUsedQueue) | ||
721 | { | ||
722 | if(failTable.ContainsKey(queueVal)) | ||
723 | failTable[queueVal] += 1; | ||
724 | else | ||
725 | failTable[queueVal] = 1; | ||
726 | if(failTable[queueVal] < myFifoFailedLimit) | ||
727 | myUnUsedQueue.Enqueue(queueVal); | ||
728 | } | ||
729 | } | ||
730 | } | ||
731 | else | ||
732 | { | ||
733 | lock (myUnUsedQueue) | ||
734 | { | ||
735 | myUnUsedQueue.Enqueue(queueVal); | ||
736 | } | ||
610 | } | 737 | } |
611 | if (myDebug) lock (myDebugLogFile) { File.AppendAllText(myDebugLogFile, DateTime.Now.ToLocalTime() + " File: " + myConnectionString + " Test: " + e.TestName + " VU: " + e.UserContext.UserId + " Value: \"" + queueVal + "\" PUSH\r\n"); } | 738 | if (myDebug) lock (myDebugLogFile) { File.AppendAllText(myDebugLogFile, DateTime.Now.ToLocalTime() + " File: " + myConnectionString + " Test: " + e.TestName + " VU: " + e.UserContext.UserId + " Value: \"" + queueVal + "\" PUSH\r\n"); } |
612 | } | 739 | } | ... | ... |
-
Please register or sign in to post a comment