From 7c31652439f017b60fec3fd421d9b6252aca69d1 Mon Sep 17 00:00:00 2001 From: Max Brenner Date: Wed, 7 Jul 2021 17:03:38 +0200 Subject: [PATCH] add update test count badges workflow --- .github/workflows/update-badges.yml | 48 ++++++++++++++ .../Tools_and_Testing.png | Bin .../automation_overview.png | Bin .img/interop-count.svg | 1 + .img/performance-count.svg | 1 + .img/sanity-count.svg | 1 + .img/total-count.svg | 1 + README.md | 59 +++++++++--------- docker/Dockerfile | 3 +- lanforge/lanforge-scripts | 2 +- requirements.txt | 14 +++++ 11 files changed, 97 insertions(+), 33 deletions(-) create mode 100644 .github/workflows/update-badges.yml rename Tools_and_Testing.png => .img/Tools_and_Testing.png (100%) rename automation_overview.png => .img/automation_overview.png (100%) create mode 100644 .img/interop-count.svg create mode 100644 .img/performance-count.svg create mode 100644 .img/sanity-count.svg create mode 100644 .img/total-count.svg create mode 100644 requirements.txt diff --git a/.github/workflows/update-badges.yml b/.github/workflows/update-badges.yml new file mode 100644 index 000000000..547294f58 --- /dev/null +++ b/.github/workflows/update-badges.yml @@ -0,0 +1,48 @@ +name: Update test number badges + +on: + push: + branches: + - master + paths: + - "tests/**" + +jobs: + update_badges: + runs-on: ubuntu-latest + container: python:3.8 + steps: + - uses: actions/checkout@v2 + + - name: add TIP pypi repo + run: | + mkdir -p ~/.pip + echo "[global]" > ~/.pip/pip.conf + echo "index-url = https://pypi.org/simple" >> ~/.pip/pip.conf + echo "extra-index-url = https://tip-read:tip-read@tip.jfrog.io/artifactory/api/pypi/tip-wlan-python-pypi-local/simple" >> ~/.pip/pip.conf + + - name: install dependencies + run: pip install -r requirements.txt + + - name: download badges + working-directory: tests + run: | + mkdir -p ../.img + wget https://img.shields.io/badge/total_tests-$(pytest --collect-only -q | tail -1 | cut -d ' ' -f 1)-green?style=flat-square -O ../.img/total-count.svg + wget https://img.shields.io/badge/interop_tests-$(pytest --collect-only -m "interop" -q | tail -1 | cut -d '/' -f 1)-green?style=flat-square -O ../.img/interop-count.svg + wget https://img.shields.io/badge/sanity_tests-$(pytest --collect-only -m "sanity and not interop" -q | tail -1 | cut -d '/' -f 1)-green?style=flat-square -O ../.img/sanity-count.svg + wget https://img.shields.io/badge/performance_tests-$(pytest --collect-only -m "performance" -q | tail -1 | cut -d '/' -f 1)-green?style=flat-square -O ../.img/performance-count.svg + + - name: commit changes + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" + + git add . + git commit -m "Updating test count badges: $(date -u)" + + - name: push changes + uses: ad-m/github-push-action@v0.6.0 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: master \ No newline at end of file diff --git a/Tools_and_Testing.png b/.img/Tools_and_Testing.png similarity index 100% rename from Tools_and_Testing.png rename to .img/Tools_and_Testing.png diff --git a/automation_overview.png b/.img/automation_overview.png similarity index 100% rename from automation_overview.png rename to .img/automation_overview.png diff --git a/.img/interop-count.svg b/.img/interop-count.svg new file mode 100644 index 000000000..fafc0d6ad --- /dev/null +++ b/.img/interop-count.svg @@ -0,0 +1 @@ +interop tests: 56interop tests56 \ No newline at end of file diff --git a/.img/performance-count.svg b/.img/performance-count.svg new file mode 100644 index 000000000..619e1ec63 --- /dev/null +++ b/.img/performance-count.svg @@ -0,0 +1 @@ +performance tests: 241performance tests241 \ No newline at end of file diff --git a/.img/sanity-count.svg b/.img/sanity-count.svg new file mode 100644 index 000000000..b8cdc87b6 --- /dev/null +++ b/.img/sanity-count.svg @@ -0,0 +1 @@ +sanity tests: 176sanity tests176 \ No newline at end of file diff --git a/.img/total-count.svg b/.img/total-count.svg new file mode 100644 index 000000000..2ae923dc2 --- /dev/null +++ b/.img/total-count.svg @@ -0,0 +1 @@ +total tests: 519total tests519 \ No newline at end of file diff --git a/README.md b/README.md index c2956ef0b..3a5553e75 100644 --- a/README.md +++ b/README.md @@ -5,13 +5,13 @@ This repository contains the test automation framework and scripts for TIP Open WiFi. Test Framework is implemented in pytest -![Automation Overview](./automation_overview.png) +![Automation Overview](.img/automation_overview.png) The vision is to create an open test framework to ensure production grade Open Wifi Solution. This test automation tied into our overall tooling at TIP as shown below: -![Tools and Test Automation](./Tools_and_Testing.png) +![Tools and Test Automation](.img/Tools_and_Testing.png) ### General guidelines @@ -41,7 +41,6 @@ pylint --fail-under=7 *py the command above would produce a non-zero exit code if the score drops below 7. - ### TIP Controller Integration Using Swagger Autogenerated CloudSDK Library pypi package (implemented with [swagger codegen](https://github.com/swagger-api/swagger-codegen)). @@ -50,7 +49,7 @@ Using Swagger Autogenerated CloudSDK Library pypi package (implemented with [swa Currently the plan is to use pytest integrated with [allure](https://docs.qameta.io/allure/#_pytest) to create visual reports for the test outcomes -### Miscelanneous +### Miscellaneous 1. Do not use old style string formatting: `"Hello %s" % var`; use `f"Hello {var}` instead 2. use `"""` in Docstrings @@ -62,9 +61,17 @@ https://docs.pytest.org/en/latest/usage.html http://pythontesting.net/framework/pytest/pytest-introduction/ ### Test status + +![total test count](.img/total-count.svg) + [![sanity testing](https://github.com/Telecominfraproject/wlan-testing/actions/workflows/sanity.yml/badge.svg)](https://github.com/Telecominfraproject/wlan-testing/actions/workflows/sanity.yml) +![sanity test count](.img/sanity-count.svg) + [![interop testing](https://github.com/Telecominfraproject/wlan-testing/actions/workflows/interop.yml/badge.svg)](https://github.com/Telecominfraproject/wlan-testing/actions/workflows/interop.yml) +![interop test count](.img/interop-count.svg) + [![performance testing](https://github.com/Telecominfraproject/wlan-testing/actions/workflows/performance.yml/badge.svg)](https://github.com/Telecominfraproject/wlan-testing/actions/workflows/performance.yml) +![performance test count](.img/performance-count.svg) ### Best Practice @@ -75,11 +82,11 @@ http://pythontesting.net/framework/pytest/pytest-introduction/ All code must be written in python 3 and conform to PEP 8 style guide. The test framework is built using pytest. -[![made-with-python](https://img.shields.io/badge/Made%20with-Python-1f425f.svg)](https://www.python.org/) +[![made-with-python](https://img.shields.io/badge/Made%20with-Python-1f425f.svg)](https://www.python.org/) [![PEP8](https://img.shields.io/badge/code%20style-pep8-orange.svg)](https://www.python.org/dev/peps/pep-0008/) - ### Directory Structure + ```bash ├── lanforge - /* to be migrated */ ├── libs @@ -101,6 +108,7 @@ All code must be written in python 3 and conform to PEP 8 style guide. The test |── scale |── README.md -/* Pytest framework and testcases information */ ``` + ### Setup Instructions #### Step 1 @@ -124,6 +132,19 @@ cd wlan-testing #### Step 2 +Please ensure you follow the steps outlined in [here](./libs/controller/README.md) + +```shell +Lets add the TIP pypi repository by following the below steps: + +mkdir ~/.pip +echo "[global]" > ~/.pip/pip.conf +echo "index-url = https://pypi.org/simple" >> ~/.pip/pip.conf +echo "extra-index-url = https://tip-read:tip-read@tip.jfrog.io/artifactory/api/pypi/tip-wlan-python-pypi-local/simple" >> ~/.pip/pip.conf +``` + +#### Step 3 + Please ensure you have python version >= 3 is required. Double check this by running "python --version" command. ```shell @@ -131,31 +152,7 @@ User this to check "python --version" Lets Install the Python Packages needed -pip3 install pytest==6.2.2 -pip3 install bs4 -pip3 install paramiko -pip3 install xlsxwriter -pip3 install influxdb_client -pip3 install allure-pytest - - - - -``` - -#### Step 3 - -Please ensure you follow the steps outlined in [here](./libs/controller/README.md) - -```shell -Lets Install Controller Libraries, follow below steps: - -mkdir ~/.pip -echo "[global]" > ~/.pip/pip.conf -echo "index-url = https://pypi.org/simple" >> ~/.pip/pip.conf -echo "extra-index-url = https://tip-read:tip-read@tip.jfrog.io/artifactory/api/pypi/tip-wlan-python-pypi-local/simple" >> ~/.pip/pip.conf -echo "tip-wlan-cloud" > ~/.pip/requirements.txt -pip3 install -r ~/.pip/requirements.txt +pip3 install -r requirements.txt ``` #### Step 4 diff --git a/docker/Dockerfile b/docker/Dockerfile index 6cf159ceb..33f5ebf28 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -3,7 +3,8 @@ RUN mkdir ~/.pip RUN echo "[global]" > ~/.pip/pip.conf RUN echo "index-url = https://pypi.org/simple" >> ~/.pip/pip.conf RUN echo "extra-index-url = https://tip-read:tip-read@tip.jfrog.io/artifactory/api/pypi/tip-wlan-python-pypi-local/simple" >> ~/.pip/pip.conf -RUN pip3 install pytest==6.2.2 bs4 paramiko xlsxwriter requests pandas influxdb influxdb-client scp allure-pytest tip-wlan-cloud selenium perfecto-py37 Appium-Python-Client +COPY requirements.txt requirements.txt +RUN pip3 install -r requirements.txt COPY lanforge /wlan-testing/lanforge COPY tests /wlan-testing/tests COPY libs /wlan-testing/libs diff --git a/lanforge/lanforge-scripts b/lanforge/lanforge-scripts index 7e1dc7dce..7b596c3f2 160000 --- a/lanforge/lanforge-scripts +++ b/lanforge/lanforge-scripts @@ -1 +1 @@ -Subproject commit 7e1dc7dce71e9386ccc28ce4a85a4740e1bec683 +Subproject commit 7b596c3f2fc04e350bf22961169a875e70379824 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 000000000..5d016dd98 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,14 @@ +allure-pytest +Appium-Python-Client +bs4 +influxdb +influxdb-client +pandas +paramiko +perfecto-py37 +pytest==6.2.2 +requests +scp +selenium +tip-wlan-cloud +xlsxwriter \ No newline at end of file