Package org.auraframework.test.perf.metrics

Examples of org.auraframework.test.perf.metrics.PerfRunsCollector


        }

        // runs to collect Dev Tools performance metrics
        if (numPerfTimelineRuns > 0) {
            perfRunMode = PerfRunMode.TIMELINE;
            PerfRunsCollector runsCollector = new PerfRunsCollector();
            for (int i = 0; i < numPerfTimelineRuns; i++) {
                try {
                    perBrowserSetUp();

                    PerfMetricsCollector metricsCollector = new PerfMetricsCollector(this, perfRunMode);
                    metricsCollector.startCollecting();

                    superRunTest();

                    PerfMetrics metrics = metricsCollector.stopCollecting();
                    runsCollector.addRun(metrics);

                    if (logger.isLoggable(Level.INFO)) {
                        runFiles.add(PerfResultsUtil.writeDevToolsLog(metrics.getDevToolsLog(), getGoldFileName() + '_'
                                + (i + 1),
                                auraUITestingUtil.getUserAgent()));
                        runFiles.add(PerfResultsUtil
                                .writeGoldFile(metrics, getGoldFileName() + '_' + runNumber++, true));
                    }
                } finally {
                    perBrowserTearDown();
                }
            }
            // use the median run for timeline metrics so individual metrics and dev tools logs match
            timelineMetrics = runsCollector.getMedianRun();
        }

        // runs to collect JavaScript profiling metrics, run separately because affect overall metrics
        if (numPerfProfileRuns > 0) {
            perfRunMode = PerfRunMode.PROFILE;
            PerfRunsCollector runsCollector = new PerfRunsCollector();
            for (int i = 0; i < numPerfProfileRuns; i++) {
                try {
                    perBrowserSetUp();

                    PerfMetricsCollector metricsCollector = new PerfMetricsCollector(this, perfRunMode);
                    metricsCollector.startCollecting();

                    superRunTest();

                    PerfMetrics metrics = metricsCollector.stopCollecting();
                    runsCollector.addRun(metrics);

                    if (logger.isLoggable(Level.INFO)) {
                        Map<String, ?> jsProfilerData = metrics.getJSProfilerData();
                        if (jsProfilerData != null) {
                            runFiles.add(PerfResultsUtil.writeJSProfilerData(jsProfilerData, getGoldFileName() + '_'
                                    + (i + 1)));
                        }
                        Map<String, ?> heapSnapshot = metrics.getHeapSnapshot();
                        if (heapSnapshot != null) {
                            runFiles.add(PerfResultsUtil.writeHeapSnapshot(heapSnapshot, getGoldFileName() + '_'
                                    + (i + 1)));
                        }
                        runFiles.add(PerfResultsUtil
                                .writeGoldFile(metrics, getGoldFileName() + '_' + runNumber++, true));
                    }
                } finally {
                    perBrowserTearDown();
                }
            }
            // use the median run for profile metrics so individual metrics and .cpuprofile match
            profileMetrics = runsCollector.getMedianRun();
        }

        // runs to collect Aura stats metrics
        if (numPerfAuraRuns > 0) {
            perfRunMode = PerfRunMode.AURASTATS;
            // collecting them in separate runs as they need STATS mode
            PerfRunsCollector runsCollector = new PerfRunsCollector();
            for (int i = 0; i < numPerfAuraRuns; i++) {
                try {
                    // TODO: set stats mode for framework tests
                    perBrowserSetUp();

                    PerfMetricsCollector metricsCollector = new PerfMetricsCollector(this, perfRunMode);
                    metricsCollector.startCollecting();

                    superRunTest();

                    PerfMetrics metrics = metricsCollector.stopCollecting();
                    runsCollector.addRun(metrics);
                } finally {
                    perBrowserTearDown();
                }
            }
            auraMetrics = runsCollector.getMedianMetrics();
        }

        perfRunMode = null;

        // combine all metrics, log/write results, perform tests
View Full Code Here


        }
        runs.show(System.out);
    }

    public void testMultipleRunsNewWebDriver() throws Exception {
        PerfRunsCollector runs = new PerfRunsCollector();
        for (int i = 0; i < 2; i++) {
            getDriver();
            PerfMetricsCollector perfData = new PerfMetricsCollector(this, PerfRunMode.TIMELINE);
            perfData.startCollecting();
            open("/ui/label.cmp?label=foo");
            PerfMetrics metrics = perfData.stopCollecting();
            runs.addRun(metrics);
            quitDriver();
        }
        runs.show(System.out);
    }
View Full Code Here

        // PerfWebDriverUtil.showResourceTimingData(data);
    }

    public void testMultipleRunsReuseWebDriver() throws Exception {
        PerfRunsCollector runs = new PerfRunsCollector();
        for (int i = 0; i < 2; i++) {
            PerfMetricsCollector perfData = new PerfMetricsCollector(this, PerfRunMode.TIMELINE);
            perfData.startCollecting();
            open("/ui/label.cmp?label=foo");
            PerfMetrics metrics = perfData.stopCollecting();
            runs.addRun(metrics);
        }
        runs.show(System.out);
    }
View Full Code Here

TOP

Related Classes of org.auraframework.test.perf.metrics.PerfRunsCollector

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.