diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d16825f7..32eb9fb2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,9 +35,21 @@ jobs: - name: Run TRLC run: | make trlc + selenium-tests: + name: Run Selenium Tests + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + - name: Install dependencies + run: | + python3 -m pip install --upgrade pip + python3 -m pip install selenium webdriver-manager + - name: Run selenium Tests + run: | + make selenium-tests test: name: TestSuite - needs: [lint, trlc] + needs: [lint, trlc, selenium-tests] strategy: matrix: os: [ubuntu-24.04, windows-2022, macos-13, macos-14] diff --git a/Makefile b/Makefile index 7810db7e..5fab934a 100644 --- a/Makefile +++ b/Makefile @@ -54,6 +54,10 @@ clang-tidy: cmake -S llvm -B build -G Ninja -DLLVM_ENABLE_PROJECTS='clang;clang-tools-extra' -DCMAKE_BUILD_TYPE=Release && \ cmake --build build --target clang-tidy +selenium-tests: + @echo "Running Selenium Tests..." + python3 ./tests-system/lobster-core/html_report/selenium-test/test_html_report.py + integration-tests: packages (cd tests-integration/projects/basic; make) (cd tests-integration/projects/filter; make) diff --git a/tests-system/lobster-core/html_report/selenium-test/test_html_report.html b/tests-system/lobster-core/html_report/selenium-test/test_html_report.html new file mode 100644 index 00000000..50050301 --- /dev/null +++ b/tests-system/lobster-core/html_report/selenium-test/test_html_report.html @@ -0,0 +1,386 @@ + + + +L.O.B.S.T.E.R. + + + +
+

L.O.B.S.T.E.R.

+
Lightweight Open BMW Software Traceability Evidence Report
+
+ +
+

Overview

+
+
+
+

Coverage

+ + + + + + + + + + + + + + + + + + + + + + + + +
CategoryRatioCoverageOK ItemsTotal Items
Requirements0.0% + +0.00% + +03
code0.0% + +0.00% + +03
+
+
+
+

Issues

+
+ +
+

Detailed report

+
+

Requirements and Specification

+

Requirements

+
.\main.trlc
+ +
+
TRLC Requirement vanillaEg.trlc
+
Source: + +.\main.trlc +
+
+
Treat Requirements Like Code
+
+
+
Issues: +
    +
  • missing reference to code
  • +
+
+
+
+ + +
+
TRLC Requirement vanillaEg.lobster
+
Source: + +.\main.trlc +
+
+
Lightweight Open BMW Software Traceability Evidence Report
+
+
+
Issues: +
    +
  • missing reference to code
  • +
+
+
+
+ +
Codebeamer https://codebeamer.company.net/, tracker 65426
+ +
+
codebeamer Technical requirement traffic light detection
+ +
+Status: Valid +
+
+
Issues: +
    +
  • missing reference to code
  • +
+
+
+
+ +

Implementation

+

code

+
.\Test_Setup\main.py
+ +
+
Python Function main.greet_user
+ +
+
Issues: +
    +
  • unknown tracing target req welcome.greet
  • +
  • missing up reference
  • +
+
+
+
+ +
.\software.py
+ +
+
Python Function software.hello
+
Source: + +.\software.py +
+
+
Issues: +
    +
  • missing up reference
  • +
+
+
+
+ + +
+
Python Function software.hello1
+
Source: + +.\software.py +
+
+
Issues: +
    +
  • missing up reference
  • +
+
+
+
+ +

Verification and Validation

+
+
+ + + diff --git a/tests-system/lobster-core/html_report/selenium-test/test_html_report.py b/tests-system/lobster-core/html_report/selenium-test/test_html_report.py new file mode 100644 index 00000000..7504b861 --- /dev/null +++ b/tests-system/lobster-core/html_report/selenium-test/test_html_report.py @@ -0,0 +1,59 @@ +import os +import sys +from selenium import webdriver +from selenium.webdriver.chrome.service import Service +from webdriver_manager.chrome import ChromeDriverManager +from selenium.webdriver.chrome.options import Options + +def test_html_report_title(dynamic_dir, report_filename, expected_title): + """ + Test function to verify the title of an HTML report with dynamic file path. + + Parameters: + - dynamic_dir (str): Base directory containing the report. + - report_filename (str): Name of the HTML report file. + - expected_title (str): Expected title of the report. + + Returns: + - bool: True if the title matches, False otherwise. + """ + dir_path = os.path.dirname(os.path.abspath(__file__)) + + file_path = dir_path + "/test_html_report.html" + + report_path = os.path.join(dynamic_dir, report_filename) + file_url = f"file:///{os.path.abspath(report_path)}" + + # Headless mode options + chrome_options = Options() + chrome_options.add_argument("--headless") + chrome_options.add_argument("--no-sandbox") + chrome_options.add_argument("--disable-dev-shm-usage") + # Automatically download ChromeDriver + driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=chrome_options) + try: + driver.get(file_url) + actual_title = driver.title + if actual_title == expected_title: + print(f"Test Passed: Title is '{actual_title}'") + sys.exit(0) + else: + print(f"Test Failed: Expected '{expected_title}', but got '{actual_title}'") + sys.exit(1) + + except Exception as e: + print(f"Error: {e}") + sys.exit(1) + return False + + finally: + driver.quit() + +if __name__ == "__main__": + + base_directory = "./tests-system/lobster-core/html_report/selenium-test" + report_file = "test_html_report.html" + expected_title = 'L.O.B.S.T.E.' + sys.exit(test_html_report_title(base_directory, report_file, expected_title)) + +