How to test performance / load of a modern angular application

前端 未结 2 530
被撕碎了的回忆
被撕碎了的回忆 2021-01-11 09:22

I want to load / performance test a web application which uses angular 6+ as the frontend-framework. The application is quite big and uses lots of wizards / modals etc. I w

2条回答
  •  终归单人心
    2021-01-11 09:54

    You can not truly stress test your application using only UI browser testing, ideally, you would like to do both stress test all your application API calls, while also running UI/browser test.

    One option to consider could be endly e2e runner, it can do both of these tasks, load test and run selenium test in parallel

    It may look like the following, where "data" folder contains previously recorded http requests with optional desired validation rules hiting your API

    @test.yaml

    defaults:
      target:
        URL: ssh://127.0.0.1/
        credentials: localhost
    pipeline:
      init:
        action: selenium:start
        version: 3.4.0
        port: 8085
        sdk: jdk
        sdkVersion: 1.8
    
      test:
        multiAction: true
        stressTest:
          action: run
          request: @load_test
          async: true
        testUI:
          action: selenium:run
          browser: firefox
          remoteSelenium:
            URL: http://127.0.0.1:8085
          commands:
            - get(http://play.golang.org/?simple=1)
            - (#code).clear
            - (#code).sendKeys(package main
    
              import "fmt"
    
              func main() {
              fmt.Println("Hello Endly!")
              }
              )
            - (#run).click
            - command: output = (#output).text
              exit: $output.Text:/Endly/
              sleepTimeMs: 1000
              repeat: 10
            - close
          expect:
            output:
              Text: /Hello Endly!/
    

    where @load_test.yaml

    init
      testEndpoint: rest.myapp.com
    pipeline:
      test:
        data:
          []Requests: '@data/*request.json'
        range: '1..1'
        template:
          info:
            action: print
            message: starting load testing
          load:
            action: 'http/runner:load'
            threadCount: 3
            '@repeat': 100000
            requests: $data.Requests
          load-info:
            action: print
            message: 'QPS: $load.QPS: Response: min: $load.MinResponseTimeInMs ms, avg: $load.AvgResponseTimeInMs ms max: $load.MaxResponseTimeInMs ms'
    

提交回复
热议问题