From 651ffa6bd1aa0f0bd604475e6fc6ca4f78ebaf4b Mon Sep 17 00:00:00 2001 From: Arkadiusz Kuczynski Date: Thu, 18 Apr 2024 12:27:17 +0200 Subject: [PATCH] Getting important test informations --- .github/workflows/Regression_Tests.yaml | 213 +------------------- Tests/Regression/Manager/GUI_Common.robot | 8 + Tests/Regression/Manager/GUI_Features.robot | 1 + 3 files changed, 11 insertions(+), 211 deletions(-) diff --git a/.github/workflows/Regression_Tests.yaml b/.github/workflows/Regression_Tests.yaml index 7d4d28922..80a48cf01 100644 --- a/.github/workflows/Regression_Tests.yaml +++ b/.github/workflows/Regression_Tests.yaml @@ -4,80 +4,11 @@ name: Regression Tests on: workflow_call jobs: - Agent: - strategy: - matrix: - platform: [ubuntu-latest, macos-latest, windows-latest] - python: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12'] - fail-fast: false - runs-on: ${{ matrix.platform }} - steps: - - name: Checkout - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python }} - - - name: Download packages to dist - uses: actions/download-artifact@v4 - with: - name: dist - path: dist - - name: Show Dist UM - if: ${{ matrix.platform != 'windows-latest' }} - run: | - ls -la dist - - name: Show Dist W - if: ${{ matrix.platform == 'windows-latest' }} - run: | - dir dist - - name: Install Agent from dist UM - if: ${{ matrix.platform != 'windows-latest' }} - run: pip install rfswarm_agent-*.whl - working-directory: ./dist - - name: Install Agent from dist W - if: ${{ matrix.platform == 'windows-latest' }} - shell: cmd - run: for %%f in (rfswarm_agent-*.whl) do pip install %%f - working-directory: ./dist - - name: Install Manager from dist (for testing Issues) UM - if: ${{ matrix.platform != 'windows-latest' }} - run: pip install rfswarm_manager-*.whl - working-directory: ./dist - - name: Install Manager from dist (for testing Issues) W - if: ${{ matrix.platform == 'windows-latest' }} - shell: cmd - run: for %%f in (rfswarm_manager-*.whl) do pip install %%f - working-directory: ./dist - - run: pip install -r Tests/Regression/Agent/pip_requirements.txt - - - name: Robot Framework - run: > - robot --include ${{ matrix.platform }} - --outputdir Tests/Regression/Agent/Logs/${{ matrix.platform }}_${{ matrix.python }} - Tests/Regression/Agent - - - name: Archive Agent Logs - if: ${{ success() }} - uses: actions/upload-artifact@v4 - with: - name: Agent-${{ matrix.platform }}-${{ matrix.python }} - path: Tests/Regression/Agent/Logs/${{ matrix.platform }}_${{ matrix.python }} - retention-days: 15 - - - name: Archive Agent Logs (longer retention if failed) - if: ${{ failure() }} - uses: actions/upload-artifact@v4 - with: - name: Agent-${{ matrix.platform }}-${{ matrix.python }} - path: Tests/Regression/Agent/Logs/${{ matrix.platform }}_${{ matrix.python }} - retention-days: 90 - Manager: strategy: matrix: - platform: [ubuntu-latest, macos-latest, windows-latest] - python: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12'] + platform: [macos-latest] + python: ['3.12'] fail-fast: false runs-on: ${{ matrix.platform }} steps: @@ -200,143 +131,3 @@ jobs: name: Manager-${{ matrix.platform }}-${{ matrix.python }} path: Tests/Regression/Manager/Logs/${{ matrix.platform }}_${{ matrix.python }} retention-days: 90 - - Reporter: - strategy: - matrix: - platform: [ubuntu-latest, macos-latest, windows-latest] - python: ['3.9', '3.10', '3.11', '3.12'] - fail-fast: false - runs-on: ${{ matrix.platform }} - steps: - - name: "Echo Vars" - run: | - echo matrix.platform: ${{ matrix.platform }} - echo matrix.python: ${{ matrix.python }} - - name: (MacOS, <3.11) Fix Python's tkinter Issue-649 (https://github.com/actions/setup-python/issues/649) - shell: bash - if: ${{ startswith(matrix.platform, 'macos-') && contains('3.7;3.8;3.9;3.10', matrix.python) }} - run: | - brew install tcl-tk pyenv openssl readline sqlite3 xz zlib - env \ - PATH="$(brew --prefix tcl-tk)/bin:$PATH" \ - LDFLAGS="-L$(brew --prefix tcl-tk)/lib" \ - CPPFLAGS="-I$(brew --prefix tcl-tk)/include" \ - PKG_CONFIG_PATH="$(brew --prefix tcl-tk)/lib/pkgconfig" \ - CFLAGS="-I$(brew --prefix tcl-tk)/include" \ - PYTHON_CONFIGURE_OPTS="--with-tcltk-includes='-I$(brew --prefix tcl-tk)/include' --with-tcltk-libs='-L$(brew --prefix tcl-tk)/lib -ltcl8.6 -ltk8.6'" \ - pyenv install ${{matrix.python}} - pyenv global ${{matrix.python}} - - name: setup-python - if: ${{ !startswith(matrix.platform, 'macos-') || contains('3.11;3.12;', matrix.python) }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python }} - - name: Checkout - uses: actions/checkout@v4 - - name: "Apt Update" - if: ${{ matrix.platform == 'ubuntu-latest' }} - run: | - sudo apt update -y - - name: "Ubuntu Installs" - if: ${{ matrix.platform == 'ubuntu-latest' }} - run: | - sudo apt -y install python3-tk python3-dev python3-xlib scrot fluxbox tesseract-ocr - sudo apt list --installed - - name: "Ubuntu Xvfb" - if: ${{ matrix.platform == 'ubuntu-latest' }} - run: | - export DISPLAY=:13.0 - Xvfb :13 -screen 0 1920x1080x24 > /dev/null 2>&1 & - # xauth with complain unless ~/.Xauthority exists - touch ~/.Xauthority - # To view a listing of the .Xauthority file, enter the following - xauth list - sleep 1 - # fluxbox - fluxbox & - - name: "MacOS Install tesseract" - if: ${{ matrix.platform == 'macos-latest' }} - run: | - brew install tesseract - - name: "Windows Download Tesseract" - if: ${{ matrix.platform == 'windows-latest' }} - shell: pwsh - run: > - Invoke-WebRequest - -Uri "https://digi.bib.uni-mannheim.de/tesseract/tesseract-ocr-w64-setup-5.3.1.20230401.exe" - -OutFile "$($ENV:Temp)\tesseract-ocr-w64-setup-5.3.1.20230401.exe" - - name: "Windows Install Tesseract" - if: ${{ matrix.platform == 'windows-latest' }} - shell: cmd - run: | - "%Temp%\tesseract-ocr-w64-setup-5.3.1.20230401.exe" /S - - name: "Windows Add Tesseract to Path" - if: ${{ matrix.platform == 'windows-latest' }} - shell: pwsh - run: | - echo "$($ENV:ProgramFiles)\Tesseract-OCR" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - - name: "Verify tesseract" - run: tesseract -v - - - name: Download packages to dist - uses: actions/download-artifact@v4 - with: - name: dist - path: dist - - name: Show Dist UM - if: ${{ matrix.platform != 'windows-latest' }} - run: | - ls -la dist - - name: Show Dist W - if: ${{ matrix.platform == 'windows-latest' }} - run: | - dir dist - - name: Install Reporter from dist UM - if: ${{ matrix.platform != 'windows-latest' }} - run: pip install rfswarm_reporter-*.whl - working-directory: ./dist - - name: Install Reporter from dist W - if: ${{ matrix.platform == 'windows-latest' }} - shell: cmd - run: for %%f in (rfswarm_reporter-*.whl) do pip install %%f - working-directory: ./dist - - run: pip install -r Tests/Regression/Reporter/pip_requirements.txt - - - name: Robot Framework - id: robottest - run: > - robot --include ${{ matrix.platform }} - --outputdir Tests/Regression/Reporter/Logs/${{ matrix.platform }}_${{ matrix.python }} - Tests/Regression/Reporter - env: - DISPLAY: :13.0 - - - name: Try and fix images with relative path - if: ${{ !cancelled() && matrix.platform != 'macos-latest' }} - run: | - cd Tests/Regression/Reporter/Logs/${{ matrix.platform }}_${{ matrix.python }} - sed --in-place=.bak 's/img src=".*${{ matrix.platform }}_${{ matrix.python }}/img src="./g' ./output.xml - rebot ./output.xml - - name: Try and fix images with relative path (macos) - if: ${{ !cancelled() && matrix.platform == 'macos-latest' }} - run: | - cd Tests/Regression/Reporter/Logs/${{ matrix.platform }}_${{ matrix.python }} - sed -i.bak 's/img src=".*${{ matrix.platform }}_${{ matrix.python }}/img src="./g' ./output.xml - rebot ./output.xml - - - name: Archive Reporter Logs - if: ${{ success() }} - uses: actions/upload-artifact@v4 - with: - name: Reporter-${{ matrix.platform }}-${{ matrix.python }} - path: Tests/Regression/Reporter/Logs/${{ matrix.platform }}_${{ matrix.python }} - retention-days: 15 - - - name: Archive Reporter Logs (longer retention if failed) - if: ${{ failure() }} - uses: actions/upload-artifact@v4 - with: - name: Reporter-${{ matrix.platform }}-${{ matrix.python }} - path: Tests/Regression/Reporter/Logs/${{ matrix.platform }}_${{ matrix.python }} - retention-days: 90 diff --git a/Tests/Regression/Manager/GUI_Common.robot b/Tests/Regression/Manager/GUI_Common.robot index d45b8513b..a53f1c3c3 100644 --- a/Tests/Regression/Manager/GUI_Common.robot +++ b/Tests/Regression/Manager/GUI_Common.robot @@ -145,6 +145,14 @@ Stop Test Scenario Run Quickly ... Wait For manager_${platform}_button_finished_run.png timeout=${robot_test_time + 300} Run Keyword If not ${status} Fail msg=Test didn't finish as fast as expected. Check screenshots for more informations. +Utilisation Stats + ${cpupct}= Evaluate psutil.cpu_percent(interval=1, percpu=True) modules=psutil + Log ${cpupct} + ${mem}= Evaluate psutil.virtual_memory() modules=psutil + Log ${mem} + ${proc}= Evaluate list(psutil.process_iter(['pid', 'name', 'username'])) modules=psutil + Log ${proc} + Check If The Agent Has Connected To The Manager Sleep 1 Click Tab Agents diff --git a/Tests/Regression/Manager/GUI_Features.robot b/Tests/Regression/Manager/GUI_Features.robot index 9cdd1d018..ecca6eb52 100644 --- a/Tests/Regression/Manager/GUI_Features.robot +++ b/Tests/Regression/Manager/GUI_Features.robot @@ -342,6 +342,7 @@ Check If Test Scenario Run Will Stop Gradually ... Set Global Filename And Default Save Path example.robot AND ... Create Robot File file_content=***Test Case***\nExample Test Case\n\tTest\n***Keywords***\nTest\n\t[Documentation]\t60s\n\tSleep\t60\n + Utilisation Stats Press Key.tab 4 Times Type 15 Press Key.tab 1 Times