diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1cd95ff0..60195eb0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,6 +11,8 @@ on: jobs: build: runs-on: ubuntu-20.04 + strategy: + fail-fast: false steps: - name: Checkout code uses: actions/checkout@v3 @@ -22,9 +24,22 @@ jobs: distribution: 'temurin' cache: gradle + - name: Set up Python 3.8 + uses: actions/setup-python@v1 + with: + python-version: 3.8 + + - name: Install Python dependencies + run: | + pip install -U pip wheel + pip install -r devel.txt + - name: Run Unit Tests run: ./gradlew testDebug +# - name: Run UI Tests +# run: ./gradlew connectedDebugAndroidTest + - name: Upload test results if: always() uses: actions/upload-artifact@v3 @@ -32,6 +47,29 @@ jobs: name: test-results path: app/build/reports/ + - name: Install kiwitcms plugin and create config + run: | + pip install git+https://github.com/kiwitcms/junit.xml-plugin@v12.2.999 + cat > ~/.tcms.conf << _EOF + [tcms] + url = https://vocable.wtadev.com/xml-rpc/ + username = kiwi_bot + password = UgAco3GdHhLEyU7zZNZ8 + _EOF + shell: bash + + - name: Run kiwitcms export + run: tcms-junit.xml-plugin $([ "false" == "true" ] && echo "-v") --summary-template '${classname}.${name}' ./app/build/reports/*.xml + shell: bash + env: + TCMS_PREFIX: "Vocable Android 2022" + TCMS_PLAN_ID: "8" + # TCMS_PARENT_PLAN - if defined newly created TestPlan will be a child of this one + # TCMS_RUN_ID - if defined will report results to this TestRun + TCMS_PRODUCT: "Vocable Android" + TCMS_PRODUCT_VERSION: "1.4" + TCMS_BUILD: ${{ github.sha }} + - name: Assemble Debug Variant env: VERSION_CODE: ${{ github.run_number }} diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..b7bcc1c8 --- /dev/null +++ b/Makefile @@ -0,0 +1,30 @@ +.PHONY: flake8 +flake8: + @flake8 *.py tcms_junit_plugin tests + + +.PHONY: pylint +pylint: + pylint -d missing-docstring *.py tcms_junit_plugin/ + pylint --load-plugins=pylint.extensions.no_self_use \ + -d missing-docstring -d invalid-name -d too-few-public-methods \ + -d protected-access -d duplicate-code tests/ + + +.PHONY: test +test: + nose2 -v --with-coverage --coverage tcms_junit_plugin + + +.PHONY: export-kiwi +export: + ./app/build/test-results/testDebugUnitTest/*.xml + + +.PHONY: check-build +check-build: + ./tests/bin/check-build + + +.PHONY: ci +ci: test diff --git a/app/src/androidTest/java/com/willowtree/vocable/screens/MainScreen.kt b/app/src/androidTest/java/com/willowtree/vocable/screens/MainScreen.kt index f8929cfa..9a376fe8 100644 --- a/app/src/androidTest/java/com/willowtree/vocable/screens/MainScreen.kt +++ b/app/src/androidTest/java/com/willowtree/vocable/screens/MainScreen.kt @@ -11,7 +11,7 @@ import org.hamcrest.CoreMatchers.instanceOf class MainScreen { - val defaultCategories = arrayOf("General", "Basic Needs", "Personal Care", "Conversation", "Environment", "123", "My Sayings") + val defaultCategories = arrayOf("General", "Basic Needs", "Personal Care", "Conversation", "Environment", "123", "Recents") val defaultPhraseGeneral = arrayOf("Please", "Yes", "Maybe", "I don't know", "Thank you", "No", "Please wait", "I didn't mean to say that") val defaultPhraseBasicNeeds = arrayOf("I need to go to the restroom", "I am hungry", "I am hot", "I am fine", "I am thirsty", "I am cold", "I am tired", "I am good") diff --git a/app/src/androidTest/java/com/willowtree/vocable/tests/MainScreenTest.kt b/app/src/androidTest/java/com/willowtree/vocable/tests/MainScreenTest.kt index 559e3adb..b0b60096 100644 --- a/app/src/androidTest/java/com/willowtree/vocable/tests/MainScreenTest.kt +++ b/app/src/androidTest/java/com/willowtree/vocable/tests/MainScreenTest.kt @@ -12,7 +12,7 @@ class MainScreenTest : BaseTest() { private val mainScreen = MainScreen() - @Ignore +// @Ignore @Test fun verifyDefaultTextAppears() { mainScreen.apply { @@ -21,7 +21,7 @@ class MainScreenTest : BaseTest() { } } - @Ignore + // @Ignore @Test fun verifyClickingPhraseUpdatesCurrentText() { mainScreen.apply { @@ -30,7 +30,7 @@ class MainScreenTest : BaseTest() { } } - @Ignore + //@Ignore @Test fun verifyDefaultCategoriesExist() { mainScreen.apply { @@ -38,7 +38,7 @@ class MainScreenTest : BaseTest() { } } - @Ignore + //@Ignore @Test fun verifyDefaultSayingsInCategoriesExist() { mainScreen.apply { @@ -47,7 +47,7 @@ class MainScreenTest : BaseTest() { } } - @Ignore + //@Ignore @Test fun verifySelectingCategoryChangesPhrases() { mainScreen.apply { diff --git a/devel.txt b/devel.txt new file mode 100644 index 00000000..5df96c63 --- /dev/null +++ b/devel.txt @@ -0,0 +1,10 @@ +-r requirements.txt + +black +nose2[coverage_plugin] +coverage +flake8 +pylint +twine +pyOpenSSL +readme_renderer[md] \ No newline at end of file diff --git a/make-junit.xml b/make-junit.xml new file mode 100644 index 00000000..f95e0025 --- /dev/null +++ b/make-junit.xml @@ -0,0 +1,12 @@ +#!/bin/bash + + set -e + + # Execute this from the project root directory + # nose2 --verbose --plugin nose2.plugins.junitxml --junit-xml + + ./tcms-junit.xml-plugin --verbose \ +# nose2-junit.xml \ +# tests/data/9.xml \ +# tests/data/mocha.js.xml + app/build/reports/*.xml diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..c3ba051f --- /dev/null +++ b/requirements.txt @@ -0,0 +1,4 @@ +junitparser>=1.1.0 +tcms-api==12.2 +nose-tap +kiwitcms-junit.xml-plugin \ No newline at end of file diff --git a/setup.py b/setup.py new file mode 100644 index 00000000..13f35a49 --- /dev/null +++ b/setup.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python +# pylint: disable=missing-docstring +import os + +from setuptools import setup + + +def get_version(): + version_py_path = os.path.join("tcms_junit_plugin", "version.py") + with open(version_py_path, encoding="utf-8") as version_file: + version = version_file.read() + return version.replace(" ", "").replace("__version__=", "").strip().strip("'").strip('"') + + +with open("README.rst", encoding="utf-8") as readme: + LONG_DESCRIPTION = readme.read() + + +with open("requirements.txt", encoding="utf-8") as requirements: + REQUIREMENTS = requirements.readlines() + + +setup( + name="kiwitcms-junit.xml-plugin", + version=get_version(), + packages=["tcms_junit_plugin"], + scripts=["tcms-junit.xml-plugin"], + description="junit.xml plugin for " "Kiwi TCMS test case management system", + long_description=LONG_DESCRIPTION, + author="Kiwi TCMS", + author_email="info@kiwitcms.org", + license="GPLv3+", + url="https://github.com/kiwitcms/junit.xml-plugin", + install_requires=REQUIREMENTS, + classifiers=[ + "Development Status :: 4 - Beta", + "Environment :: Console", + "Intended Audience :: Developers", + "Intended Audience :: System Administrators", + "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", + "Operating System :: POSIX", + "Programming Language :: Python", + "Programming Language :: Python :: 3.8", + "Topic :: Software Development", + "Topic :: Software Development :: Libraries :: Python Modules", + "Topic :: Software Development :: Quality Assurance", + "Topic :: Software Development :: Testing", + ], +) diff --git a/tcms.conf b/tcms.conf new file mode 100644 index 00000000..2b7777c4 --- /dev/null +++ b/tcms.conf @@ -0,0 +1,11 @@ +[tcms] +url = https://vocable.wtadev.com/xml-rpc/ +username = kiwi-bot +password = UgAco3GdHhLEyU7zZNZ8 + +# define environment variables +pytest -p tcms_pytest_plugin --kiwitcms + TCMS_PLAN_ID=8 + TCMS_RUN_ID=7 + + tcms-junit.xml-plugin /app/build/test-results/testDebugUnitTest/binary \ No newline at end of file