Exemple #1
0
        /// <summary>
        /// Generate new threshold colorcode values for all intermediate rows
        /// </summary>
        /// <param name="greenColorcode"></param>
        /// <param name="yellowColorcode"></param>
        /// <param name="redColorcode"></param>
        public void GenerateThresholdValues(string greenColorcode, string yellowColorcode, string redColorcode, bool storeMetrics = false)
        {
            Log.WriteLine("generate threshold values...");
            // load threshold config from database
            Thresholds thresholds = new Thresholds(project);

            // generate color values
            Intermediate thValues = thresholds.GenerateThresholdValuesForTransactions(intermediate, greenColorcode, yellowColorcode, redColorcode);

            // merge threshold colortransactions with dataset
            Log.WriteLine(string.Format("adding {0} threshold entries...", thValues.Count));
            intermediate.Add(thValues);

            // count threshold violations (add in separate series) by transactionname patter + red color
            Log.WriteLine("aggregate threshold violations...");
            Intermediate thresholdViolations = thValues.AggregateCount(THRESHOLDVIOLATIONSKEY, @"\d\d_.*_c$", redColorcode); // only evaluate script transactions!

            // store these newly generated metrics back to the database
            if (storeMetrics)
            {
                thresholdViolations.SaveToDatabase(this.project, this.testrun, Category.Transaction, Entity.None);
            }

            Log.WriteLine("adding threshold violations: " + thresholdViolations.GetValue(THRESHOLDVIOLATIONSKEY));
            this.intermediate.Add(thresholdViolations);
        }
Exemple #2
0
        /// <summary>
        /// Perform baselining and generate extra baseline tags
        /// ${Appbeheer_01_Inloggen_br // reference (baseline value)
        /// ${Appbeheer_01_Inloggen_be // evaluated value (difference from baseline in %)
        /// ${Appbeheer_01_Inloggen_be_c // colorcode, mark when current value exceeds threshold th1, green when diff > -15%, red when diff > +15%
        /// </summary>
        /// <param name="currentTestrun"></param>
        /// <param name="baselineTestrun"></param>
        /// <param name="colorcodeBetter"></param>
        /// <param name="colorcodeWorse"></param>
        public void GenerateBaselineValues(string currentTestrun, string baselineTestrun, string colorcodeBetter, string colorcodeWorse, bool storeMetrics = false)
        {
            Thresholds thresholds = new Thresholds(this.project);

            // First, collect current and baseline run info and threshold violations:

            // lees baseline data, kies alternatief als baseline run niet gezet
            Log.WriteLine("read baseline values...");
            Intermediate baselineValues = ReadBaselineData(currentTestrun, baselineTestrun);

            Log.WriteLine("generate threshold evaluation on baseline run...");
            Intermediate baselineThresholdValues = thresholds.GenerateThresholdValuesForTransactions(baselineValues, Baselining.belowLowThreshold, "y", "r");

            // baseline: merge values with threshold colorcodes
            baselineThresholdValues.Add(baselineValues);

            Log.WriteLine("generate threshold evaluation on current run...");
            Intermediate currentThresholdValues = thresholds.GenerateThresholdValuesForTransactions(this.intermediate, Baselining.belowLowThreshold, "y", "r");

            // current testrun: merge values (this.intermediate) with threshold colorcodes
            currentThresholdValues.Add(this.intermediate);

            // Second, compare current run with baseline run:

            Log.WriteLine("generate baseline evaluation values...");
            Baselining   baselining         = new Baselining();
            Intermediate baselineEvaluation = baselining.GenerateBaselineEvaluationValues(currentThresholdValues, baselineThresholdValues, baselineValues, colorcodeBetter, colorcodeWorse);

            this.intermediate.Add(baselineEvaluation);
            Log.WriteLine("entries: " + baselineEvaluation.Count);

            // Third: generate aggregated metrics

            // Count baseline violations (add in separate series)
            Log.WriteLine("aggregate baseline warnings...");
            Intermediate baselineWarnings = baselineEvaluation.AggregateCount(BASELINEWARNINGSKEY, @"\d\d_.*_be_c", colorcodeWorse); // only evaluate script transactions!

            Log.WriteLine("adding baseline warnings: " + baselineWarnings.GetValue(BASELINEWARNINGSKEY));
            this.intermediate.Add(baselineWarnings);

            // store generated high-level stats
            if (storeMetrics)
            {
                // store baseline warning variables
                baselineWarnings.SaveToDatabase(this.project, this.testrun, Category.Transaction, Entity.None);

                // store calculated baseline reference chosen
                this.intermediate.SaveOneToDatabase(this.project, this.testrun, Category.Variable, Entity.Generic, BASELINEREFVARNAME);
            }
        }