Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jimfuqian/BB2-3216 Investigate adding coverage report to tests #1200

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
demo add tests coverage report.
  • Loading branch information
JFU-NAVA-PBC committed May 30, 2024
commit 3d003bcec9c1a65d80271ac09b6e38726769e338
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ ENV PATH="/tmp/venv/bin:${PATH}"
RUN pip install --upgrade pip
RUN pip install --upgrade pip-tools
RUN pip install --upgrade setuptools
RUN pip install --upgrade coverage
RUN pip install -r requirements/requirements.dev.txt --no-index --find-links ./vendor/
34 changes: 17 additions & 17 deletions Dockerfile.selenium
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
FROM selenium/standalone-chrome
ENV PYTHONUNBUFFERED 1
USER root
RUN apt-get update ; apt-get install -yq git curl libpq-dev libffi-dev
RUN apt-get update ; apt-get install -yq python3 python3-venv
RUN ln -s /usr/bin/python3 /usr/local/bin/python
RUN useradd -m -s /bin/bash DEV
USER DEV
ADD . /code
WORKDIR /code
RUN python -m venv /tmp/venv
RUN . /tmp/venv/bin/activate
ENV PATH="/tmp/venv/bin:${PATH}"
RUN pip3 install --upgrade pip
RUN pip3 install selenium pytest jsonschema
FROM seleniarm/standalone-chromium

ENV PYTHONUNBUFFERED 1
USER root
RUN apt-get update ; apt-get install -yq git curl libpq-dev libffi-dev
RUN apt-get update ; apt-get install -yq python3 python3-venv
RUN ln -s /usr/bin/python3 /usr/local/bin/python
RUN useradd -m -s /bin/bash DEV
USER DEV
ADD . /code
WORKDIR /code
RUN python -m venv /tmp/venv
RUN . /tmp/venv/bin/activate
ENV PATH="/tmp/venv/bin:${PATH}"
RUN pip3 install --upgrade pip
RUN pip3 install selenium pytest jsonschema

3 changes: 2 additions & 1 deletion Jenkinsfiles/Jenkinsfile.cbc-run-multi-pr-checks-w-selenium
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ pipeline {
. venv/bin/activate
make reqs-download
make reqs-install-dev
pip install --upgrade coverage
"""
}
}
Expand All @@ -74,7 +75,7 @@ pipeline {
steps{
sh """
. venv/bin/activate
python runtests.py
coverage run runtests.py && coverage report -m
"""
}
}
Expand Down
9 changes: 9 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,12 @@ services:
- .:/code
profiles:
- tests
tests:
build: .
command: bash -c "coverage run runtests.py && coverage report -m"
env_file:
- docker-compose/unittests-env-vars.env
volumes:
- .:/code
profiles:
- coverage
3 changes: 2 additions & 1 deletion docker-compose/run_integration_tests_local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,8 @@ else
pip install -r requirements/requirements.txt \
--no-index --find-links ./vendor/; \
pip install sqlparse; \
python runtests.py --integration ${INTEGRATION_TESTS_LIST}"
coverage run runtests.py --integration ${INTEGRATION_TESTS_LIST}; \
coverage report -m"
fi
fi

Expand Down
2 changes: 1 addition & 1 deletion docker-compose/run_selenium_tests_remote.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ SYSTEM=$(uname -s)
echo "USE_NEW_PERM_SCREEN=" ${USE_NEW_PERM_SCREEN}
echo "BB2 Server URL=" ${HOSTNAME_URL}

export USE_NEW_PERM_SCREEN
## export USE_NEW_PERM_SCREEN
export USE_MSLSX=false

# stop all before run selenium remote tests
Expand Down
Loading