Performance measures

Jakub Raczek edited this page Mar 23, 2018 · 8 revisions

Our framework allows you to measure time any of test step and displays average and 90 Percentile action time. These action time can be displayed as additional tests. That functionality together with JMeter and Teamcity can be used for measuring performance of a web application on the client and server side. More details can be found here.

Example of performance test:

namespace Objectivity.Test.Automation.Tests.NUnit.Tests
{
    using Automation.Tests.PageObjects.PageObjects.TheInternet;
    using global::NUnit.Framework;

    /// <summary>
    /// Tests to test framework
    /// </summary>
    [TestFixture]
    [Parallelizable(ParallelScope.Fixtures)]
    public class PerformanceTestsNUnit : ProjectTestBase
    {
        [Test]
        [Repeat(3)]
        public void HerokuappPerfTests()
        {
            this.DriverContext.PerformanceMeasures.StartMeasure();
            InternetPage internet = new InternetPage(this.DriverContext);
            internet.OpenHomePage();
            this.DriverContext.PerformanceMeasures.StopMeasure(TestContext.CurrentContext.Test.Name + "LoadingMainPage");
            this.DriverContext.PerformanceMeasures.StartMeasure();
            internet.GoToCheckboxesPage();
            this.DriverContext.PerformanceMeasures.StopMeasure(TestContext.CurrentContext.Test.Name + "LoadingCheckboxesPage");
        }
    }
}

Results of performance measures must be printed in ProjectTestBase class, more details here. Our framework supports only displaying performance results in TeamCity and AppVeyor. Below example of how use it for NUnit.

        /// <summary>
        /// After the class.
        /// </summary>
        [OneTimeTearDown]
        public void AfterClass()
        {
            PrintPerformanceResultsHelper.PrintAverageDurationMillisecondsInAppVeyor(this.DriverContext.PerformanceMeasures);
            PrintPerformanceResultsHelper.PrintPercentiles90DurationMillisecondsInAppVeyor(this.DriverContext.PerformanceMeasures);
            PrintPerformanceResultsHelper.PrintAverageDurationMillisecondsInTeamcity(this.DriverContext.PerformanceMeasures);
            PrintPerformanceResultsHelper.PrintPercentiles90DurationMillisecondsinTeamcity(this.DriverContext.PerformanceMeasures);
            this.DriverContext.Stop();
        }

Performance printing class API can be found here.

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.