From 1138eec88af800c01148606f74aabf0c1995e4c9 Mon Sep 17 00:00:00 2001 From: JE-Chen Date: Sat, 29 Apr 2023 18:34:55 +0800 Subject: [PATCH] Refactor and update Refactor and update --- README.md | 73 ++--- .../__init__.py | 12 +- .../__main__.py | 0 .../automation_editor_ui}/__init__.py | 0 .../editor_main}/__init__.py | 0 .../editor_main/main_ui.py | 11 +- .../automation_editor_ui/menu}/__init__.py | 0 .../menu/api_testka_menu}/__init__.py | 0 .../api_testka_menu/build_api_testka_menu.py | 6 +- .../menu/auto_control_menu}/__init__.py | 0 .../build_autocontrol_menu.py | 6 +- .../menu/load_density_menu}/__init__.py | 0 .../build_load_density_menu.py | 6 +- .../menu/web_runner_menu}/__init__.py | 0 .../web_runner_menu/build_webrunner_menu.py | 6 +- .../show_code_window}/__init__.py | 0 .../show_code_window/code_window.py | 0 .../automation_editor_ui/syntax}/__init__.py | 0 .../syntax/syntax_extend.py | 4 +- .../syntax/syntax_keyword.py | 0 .../extend}/__init__.py | 0 .../extend/mail_thunder_extend}/__init__.py | 0 .../mail_thunder_setting.py | 72 ++--- .../utils/__init__.py | 0 .../utils/exception/__init__.py | 0 .../utils/exception/exception_tags.py | 0 .../utils/exception/exceptions.py | 100 +++--- .../utils/file_process/__init__.py | 0 .../utils/file_process/get_dir_file_list.py | 60 ++-- .../utils/json_format/__init__.py | 0 .../utils/json_format/json_process.py | 6 +- .../utils/manager/__init__.py | 0 .../utils/manager/package_manager/__init__.py | 0 .../package_manager/package_manager_class.py | 104 +++---- .../utils/test_executor/__init__.py | 0 .../test_executor/api_testka/__init__.py | 0 .../api_testka/api_testka_process.py | 210 ++++++------- .../test_executor/auto_control/__init__.py | 0 .../auto_control/auto_control_process.py | 210 ++++++------- .../utils/test_executor/check_mail_thunder.py | 10 + .../test_executor/load_density/__init__.py | 0 .../load_density/load_density_process.py | 210 ++++++------- .../test_executor/task_process_manager.py | 284 +++++++++--------- .../test_executor/web_runner/__init__.py | 0 .../web_runner/web_runner_process.py | 206 ++++++------- .../utils/test_executor/check_mail_thunder.py | 10 - pyproject.toml | 12 +- dev.toml => stable.toml | 14 +- .../open_extend_test/open_extend_ui_test.py | 2 +- 49 files changed, 808 insertions(+), 826 deletions(-) rename {integration_testing_environment => automation_editor}/__init__.py (50%) rename {integration_testing_environment => automation_editor}/__main__.py (100%) rename {integration_testing_environment/extend => automation_editor/automation_editor_ui}/__init__.py (100%) rename {integration_testing_environment/extend/mail_thunder_extend => automation_editor/automation_editor_ui/editor_main}/__init__.py (100%) rename {integration_testing_environment/integration_testing_environment_ui => automation_editor/automation_editor_ui}/editor_main/main_ui.py (70%) rename {integration_testing_environment/integration_testing_environment_ui => automation_editor/automation_editor_ui/menu}/__init__.py (100%) rename {integration_testing_environment/integration_testing_environment_ui/editor_main => automation_editor/automation_editor_ui/menu/api_testka_menu}/__init__.py (100%) rename {integration_testing_environment/integration_testing_environment_ui => automation_editor/automation_editor_ui}/menu/api_testka_menu/build_api_testka_menu.py (92%) rename {integration_testing_environment/integration_testing_environment_ui/menu => automation_editor/automation_editor_ui/menu/auto_control_menu}/__init__.py (100%) rename {integration_testing_environment/integration_testing_environment_ui => automation_editor/automation_editor_ui}/menu/auto_control_menu/build_autocontrol_menu.py (92%) rename {integration_testing_environment/integration_testing_environment_ui/menu/api_testka_menu => automation_editor/automation_editor_ui/menu/load_density_menu}/__init__.py (100%) rename {integration_testing_environment/integration_testing_environment_ui => automation_editor/automation_editor_ui}/menu/load_density_menu/build_load_density_menu.py (92%) rename {integration_testing_environment/integration_testing_environment_ui/menu/auto_control_menu => automation_editor/automation_editor_ui/menu/web_runner_menu}/__init__.py (100%) rename {integration_testing_environment/integration_testing_environment_ui => automation_editor/automation_editor_ui}/menu/web_runner_menu/build_webrunner_menu.py (92%) rename {integration_testing_environment/integration_testing_environment_ui/menu/load_density_menu => automation_editor/automation_editor_ui/show_code_window}/__init__.py (100%) rename {integration_testing_environment/integration_testing_environment_ui => automation_editor/automation_editor_ui}/show_code_window/code_window.py (100%) rename {integration_testing_environment/integration_testing_environment_ui/menu/web_runner_menu => automation_editor/automation_editor_ui/syntax}/__init__.py (100%) rename {integration_testing_environment/integration_testing_environment_ui => automation_editor/automation_editor_ui}/syntax/syntax_extend.py (73%) rename {integration_testing_environment/integration_testing_environment_ui => automation_editor/automation_editor_ui}/syntax/syntax_keyword.py (100%) rename {integration_testing_environment/integration_testing_environment_ui/show_code_window => automation_editor/extend}/__init__.py (100%) rename {integration_testing_environment/integration_testing_environment_ui/syntax => automation_editor/extend/mail_thunder_extend}/__init__.py (100%) rename {integration_testing_environment => automation_editor}/extend/mail_thunder_extend/mail_thunder_setting.py (86%) rename {integration_testing_environment => automation_editor}/utils/__init__.py (100%) rename {integration_testing_environment => automation_editor}/utils/exception/__init__.py (100%) rename {integration_testing_environment => automation_editor}/utils/exception/exception_tags.py (100%) rename {integration_testing_environment => automation_editor}/utils/exception/exceptions.py (91%) rename {integration_testing_environment => automation_editor}/utils/file_process/__init__.py (100%) rename {integration_testing_environment => automation_editor}/utils/file_process/get_dir_file_list.py (97%) rename {integration_testing_environment => automation_editor}/utils/json_format/__init__.py (100%) rename {integration_testing_environment => automation_editor}/utils/json_format/json_process.py (71%) rename {integration_testing_environment => automation_editor}/utils/manager/__init__.py (100%) rename {integration_testing_environment => automation_editor}/utils/manager/package_manager/__init__.py (100%) rename {integration_testing_environment => automation_editor}/utils/manager/package_manager/package_manager_class.py (97%) rename {integration_testing_environment => automation_editor}/utils/test_executor/__init__.py (100%) rename {integration_testing_environment => automation_editor}/utils/test_executor/api_testka/__init__.py (100%) rename {integration_testing_environment => automation_editor}/utils/test_executor/api_testka/api_testka_process.py (78%) rename {integration_testing_environment => automation_editor}/utils/test_executor/auto_control/__init__.py (100%) rename {integration_testing_environment => automation_editor}/utils/test_executor/auto_control/auto_control_process.py (78%) create mode 100644 automation_editor/utils/test_executor/check_mail_thunder.py rename {integration_testing_environment => automation_editor}/utils/test_executor/load_density/__init__.py (100%) rename {integration_testing_environment => automation_editor}/utils/test_executor/load_density/load_density_process.py (78%) rename {integration_testing_environment => automation_editor}/utils/test_executor/task_process_manager.py (97%) rename {integration_testing_environment => automation_editor}/utils/test_executor/web_runner/__init__.py (100%) rename {integration_testing_environment => automation_editor}/utils/test_executor/web_runner/web_runner_process.py (78%) delete mode 100644 integration_testing_environment/utils/test_executor/check_mail_thunder.py rename dev.toml => stable.toml (71%) diff --git a/README.md b/README.md index 637e380..92f2950 100644 --- a/README.md +++ b/README.md @@ -1,38 +1,20 @@ -# Table of contents -> ITE Intro \ +# Table of contents > Editor components \ -> GUI Testing components \ -> WEB Testing components \ -> API Testing components \ -> Load & Stress Testing components +> GUI components \ +> WEB components \ +> API components \ +> Load components --- -## What is ITE +## What is Automation Editor > Project Kanban \ -> https://github.com/orgs/Integrated-Testing-Environment/projects/4/views/1 \ -> Integrated Testing Environment (ITE) -> * ITE mainly provides an integrated automated testing environment. -> * ITE is composed of the following components: +> https://github.com/orgs/Intergration-Automation-Testing/projects/2/views/1 \ +> Tool for automation +> * Automation Editor is composed of the following components: >> * Editor。 ->> * GUI Testing。 ->> * Web Testing。 ->> * API Testing。 ->> * Load & Stress Testing。 ---- -## ITE Testing - -> How does ITE perform self-testing? -> * CircleCI & GitHub Actions。 ->> * What are the benefits of using CircleCI and GitHub Actions? ->> * They provide GitHub/Gitlab hooks for automated testing on every commit. ->> * They provide detailed test logs. ->> * They allow for automatic deployment to selected environments. ->> * They make it easy to specify branches for testing. ->> * They can parallelize multiple tests for faster execution. ---- -## ITE Dev -> * ITE's development process: CI/CD (Continuous Integration/Continuous Deployment). -> * Continuous Integration: The longer the code is away from the last update, the higher the risk, so continuous integration encourages committing and automated testing after completing each part to reduce risk. -> * Continuous Deployment: Continuously deploying the code to the real environment for testing, usually achieved through automation. +>> * GUI Automation。 +>> * Web Automation。 +>> * API Automation。 +>> * Load Automation。 --- ### JEditor > * JEditor is a simple text editor, but it has all the necessary features. @@ -49,8 +31,8 @@ >> * Run shell commands. --- ### GUI Testing components -> Image & Coordinate based GUI Testing \ -> GUI automated testing based on image comparison and coordinates. \ +> Image & Coordinate based GUI Automation \ +> GUI automated based on image comparison and coordinates. \ > Cross-platform and cross-programming language.\ > Solve problems: >> * Provide automation execution for repetitive tasks. @@ -62,8 +44,8 @@ >> * Can use keywords for development to improve readability. --- ### WEB Testing components -> Multiton Selenium Instance testing \ -> The WEB Testing component is a web automation testing solution based on Selenium. \ +> Multiton Selenium Instance Automation \ +> The WEB Automation component is a web automation solution based on Selenium. \ > It wraps Selenium and therefore has all the functionality of Selenium. \ > What problems does it solve? >> * Automatically downloads and updates the required web driver, so users no longer need to install it manually. @@ -74,7 +56,7 @@ >> * Offers a CLI mode for Web Testing. --- ### API Testing components -> Simple way to testing HTTP/S & Soap \ +> Simple way to Automation Requests HTTP/S & Soap \ > Wrapper for Requests package, designed for those with experience using Requests. \ > Send HTTP/S and SOAP requests with a simple line of code or keyword. \ > Detailed information on Requests and Responses. \ @@ -96,12 +78,11 @@ ### Features -> * ITE GUI for beginner -> * GUI testing (use AutoControl) -> * API testing (use APITestka) -> * Web testing (use WebRunner) -> * Loading testing (use LoadDensity) -> * Multi test task runner (multi process) +> * GUI Automation (use AutoControl) +> * API Automation (use APITestka) +> * Web Automation (use WebRunner) +> * Loading Automation (use LoadDensity) +> * Multi test task runner (multiprocess, but without AutoControl) > * you can run multi testing on same time > * open log window to check testing result > * Send mail when testing failure (need to setting mail) @@ -112,12 +93,12 @@ [![CircleCI](https://dl.circleci.com/status-badge/img/gh/Integrated-Testing-Environment/Integration-testing-environment/tree/main.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/Integrated-Testing-Environment/Integration-testing-environment/tree/main) -[![ITE GitHub Actions Dev](https://github.com/JE-Chen/Integration-testing-environment/actions/workflows/ITE-github-actions_dev.yml/badge.svg)](https://github.com/JE-Chen/Integration-testing-environment/actions/workflows/ITE-github-actions_dev.yml) +[![GitHub Actions Dev](https://github.com/JE-Chen/Integration-testing-environment/actions/workflows/ITE-github-actions_dev.yml/badge.svg)](https://github.com/JE-Chen/Integration-testing-environment/actions/workflows/ITE-github-actions_dev.yml) -[![ITE GitHub Actions Stable](https://github.com/JE-Chen/Integration-testing-environment/actions/workflows/ITE-github-actions_stable.yml/badge.svg)](https://github.com/JE-Chen/Integration-testing-environment/actions/workflows/ITE-github-actions_stable.yml) +[![GitHub Actions Stable](https://github.com/JE-Chen/Integration-testing-environment/actions/workflows/ITE-github-actions_stable.yml/badge.svg)](https://github.com/JE-Chen/Integration-testing-environment/actions/workflows/ITE-github-actions_stable.yml) ### install #### we suggest install full package -* pip install integration_testing_environment[full_extension] +* pip install automation_editor[full_extension] #### if we don't want to use send after test -* pip install integration_testing_environment +* pip install automation_editor diff --git a/integration_testing_environment/__init__.py b/automation_editor/__init__.py similarity index 50% rename from integration_testing_environment/__init__.py rename to automation_editor/__init__.py index 1005bf9..1666c9e 100644 --- a/integration_testing_environment/__init__.py +++ b/automation_editor/__init__.py @@ -1,6 +1,6 @@ -from integration_testing_environment.integration_testing_environment_ui\ - .editor_main.main_ui import start_editor - -__all__ = [ - "start_editor" -] +from automation_editor.automation_editor_ui\ + .editor_main.main_ui import start_editor + +__all__ = [ + "start_editor" +] diff --git a/integration_testing_environment/__main__.py b/automation_editor/__main__.py similarity index 100% rename from integration_testing_environment/__main__.py rename to automation_editor/__main__.py diff --git a/integration_testing_environment/extend/__init__.py b/automation_editor/automation_editor_ui/__init__.py similarity index 100% rename from integration_testing_environment/extend/__init__.py rename to automation_editor/automation_editor_ui/__init__.py diff --git a/integration_testing_environment/extend/mail_thunder_extend/__init__.py b/automation_editor/automation_editor_ui/editor_main/__init__.py similarity index 100% rename from integration_testing_environment/extend/mail_thunder_extend/__init__.py rename to automation_editor/automation_editor_ui/editor_main/__init__.py diff --git a/integration_testing_environment/integration_testing_environment_ui/editor_main/main_ui.py b/automation_editor/automation_editor_ui/editor_main/main_ui.py similarity index 70% rename from integration_testing_environment/integration_testing_environment_ui/editor_main/main_ui.py rename to automation_editor/automation_editor_ui/editor_main/main_ui.py index b2c065f..0d2180f 100644 --- a/integration_testing_environment/integration_testing_environment_ui/editor_main/main_ui.py +++ b/automation_editor/automation_editor_ui/editor_main/main_ui.py @@ -4,15 +4,15 @@ from je_editor import EditorMain from qt_material import apply_stylesheet -from integration_testing_environment.integration_testing_environment_ui. \ +from automation_editor.automation_editor_ui. \ menu.api_testka_menu.build_api_testka_menu import set_apitestka_menu -from integration_testing_environment.integration_testing_environment_ui. \ +from automation_editor.automation_editor_ui. \ menu.auto_control_menu.build_autocontrol_menu import set_autocontrol_menu -from integration_testing_environment.integration_testing_environment_ui.menu. \ +from automation_editor.automation_editor_ui.menu. \ load_density_menu.build_load_density_menu import set_load_density_menu -from integration_testing_environment.integration_testing_environment_ui \ +from automation_editor.automation_editor_ui \ .menu.web_runner_menu.build_webrunner_menu import set_web_runner_menu -from integration_testing_environment.integration_testing_environment_ui.syntax.syntax_extend import \ +from automation_editor.automation_editor_ui.syntax.syntax_extend import \ syntax_extend_package @@ -27,6 +27,7 @@ def __init__(self): set_load_density_menu(self) set_web_runner_menu(self) syntax_extend_package(self) + self.setWindowTitle("ITE & RPA") def start_editor(): diff --git a/integration_testing_environment/integration_testing_environment_ui/__init__.py b/automation_editor/automation_editor_ui/menu/__init__.py similarity index 100% rename from integration_testing_environment/integration_testing_environment_ui/__init__.py rename to automation_editor/automation_editor_ui/menu/__init__.py diff --git a/integration_testing_environment/integration_testing_environment_ui/editor_main/__init__.py b/automation_editor/automation_editor_ui/menu/api_testka_menu/__init__.py similarity index 100% rename from integration_testing_environment/integration_testing_environment_ui/editor_main/__init__.py rename to automation_editor/automation_editor_ui/menu/api_testka_menu/__init__.py diff --git a/integration_testing_environment/integration_testing_environment_ui/menu/api_testka_menu/build_api_testka_menu.py b/automation_editor/automation_editor_ui/menu/api_testka_menu/build_api_testka_menu.py similarity index 92% rename from integration_testing_environment/integration_testing_environment_ui/menu/api_testka_menu/build_api_testka_menu.py rename to automation_editor/automation_editor_ui/menu/api_testka_menu/build_api_testka_menu.py index 9fb952d..1952b25 100644 --- a/integration_testing_environment/integration_testing_environment_ui/menu/api_testka_menu/build_api_testka_menu.py +++ b/automation_editor/automation_editor_ui/menu/api_testka_menu/build_api_testka_menu.py @@ -3,8 +3,8 @@ from PySide6.QtGui import QAction from PySide6.QtWidgets import QMainWindow -from integration_testing_environment.utils.manager.package_manager.package_manager_class import package_manager -from integration_testing_environment.utils.test_executor.api_testka.api_testka_process import call_api_testka_test, \ +from automation_editor.utils.manager.package_manager.package_manager_class import package_manager +from automation_editor.utils.test_executor.api_testka.api_testka_process import call_api_testka_test, \ call_api_testka_test_with_send, call_api_testka_test_multi_file, call_api_testka_test_multi_file_and_send @@ -66,7 +66,7 @@ def set_apitestka_menu(ui_we_want_to_set: QMainWindow): ui_we_want_to_set.open_apitestka_github_action = QAction("Open APITestka GitHub") ui_we_want_to_set.open_apitestka_github_action.triggered.connect( lambda: open_web_browser( - "https://github.com/Integrated-Testing-Environment/APITestka" + "https://github.com/Intergration-Automation-Testing/APITestka" ) ) ui_we_want_to_set.apitestka_help_menu.addAction( diff --git a/integration_testing_environment/integration_testing_environment_ui/menu/__init__.py b/automation_editor/automation_editor_ui/menu/auto_control_menu/__init__.py similarity index 100% rename from integration_testing_environment/integration_testing_environment_ui/menu/__init__.py rename to automation_editor/automation_editor_ui/menu/auto_control_menu/__init__.py diff --git a/integration_testing_environment/integration_testing_environment_ui/menu/auto_control_menu/build_autocontrol_menu.py b/automation_editor/automation_editor_ui/menu/auto_control_menu/build_autocontrol_menu.py similarity index 92% rename from integration_testing_environment/integration_testing_environment_ui/menu/auto_control_menu/build_autocontrol_menu.py rename to automation_editor/automation_editor_ui/menu/auto_control_menu/build_autocontrol_menu.py index 06e7eac..c75d3ab 100644 --- a/integration_testing_environment/integration_testing_environment_ui/menu/auto_control_menu/build_autocontrol_menu.py +++ b/automation_editor/automation_editor_ui/menu/auto_control_menu/build_autocontrol_menu.py @@ -3,8 +3,8 @@ from PySide6.QtGui import QAction from PySide6.QtWidgets import QMainWindow -from integration_testing_environment.utils.manager.package_manager.package_manager_class import package_manager -from integration_testing_environment.utils.test_executor.auto_control.auto_control_process import \ +from automation_editor.utils.manager.package_manager.package_manager_class import package_manager +from automation_editor.utils.test_executor.auto_control.auto_control_process import \ call_auto_control_test, call_auto_control_test_with_send, call_auto_control_test_multi_file, \ call_auto_control_test_multi_file_and_send @@ -67,7 +67,7 @@ def set_autocontrol_menu(ui_we_want_to_set: QMainWindow): ui_we_want_to_set.open_autocontrol_github_action = QAction("Open AutoControl GitHub") ui_we_want_to_set.open_autocontrol_github_action.triggered.connect( lambda: open_web_browser( - "https://github.com/Integrated-Testing-Environment/AutoControl" + "https://github.com/Intergration-Automation-Testing/AutoControl" ) ) ui_we_want_to_set.autocontrol_help_menu.addAction( diff --git a/integration_testing_environment/integration_testing_environment_ui/menu/api_testka_menu/__init__.py b/automation_editor/automation_editor_ui/menu/load_density_menu/__init__.py similarity index 100% rename from integration_testing_environment/integration_testing_environment_ui/menu/api_testka_menu/__init__.py rename to automation_editor/automation_editor_ui/menu/load_density_menu/__init__.py diff --git a/integration_testing_environment/integration_testing_environment_ui/menu/load_density_menu/build_load_density_menu.py b/automation_editor/automation_editor_ui/menu/load_density_menu/build_load_density_menu.py similarity index 92% rename from integration_testing_environment/integration_testing_environment_ui/menu/load_density_menu/build_load_density_menu.py rename to automation_editor/automation_editor_ui/menu/load_density_menu/build_load_density_menu.py index f54dc66..f18ffc1 100644 --- a/integration_testing_environment/integration_testing_environment_ui/menu/load_density_menu/build_load_density_menu.py +++ b/automation_editor/automation_editor_ui/menu/load_density_menu/build_load_density_menu.py @@ -3,8 +3,8 @@ from PySide6.QtGui import QAction from PySide6.QtWidgets import QMainWindow -from integration_testing_environment.utils.manager.package_manager.package_manager_class import package_manager -from integration_testing_environment.utils.test_executor.load_density.load_density_process import \ +from automation_editor.utils.manager.package_manager.package_manager_class import package_manager +from automation_editor.utils.test_executor.load_density.load_density_process import \ call_load_density_test, call_load_density_test_with_send, call_load_density_test_multi_file, \ call_load_density_test_multi_file_and_send @@ -67,7 +67,7 @@ def set_load_density_menu(ui_we_want_to_set: QMainWindow): ui_we_want_to_set.open_load_density_github_action = QAction("Open LoadDensity GitHub") ui_we_want_to_set.open_load_density_github_action.triggered.connect( lambda: open_web_browser( - "https://github.com/Integrated-Testing-Environment/LoadDensity" + "https://github.com/Intergration-Automation-Testing/LoadDensity" ) ) ui_we_want_to_set.load_density_help_menu.addAction( diff --git a/integration_testing_environment/integration_testing_environment_ui/menu/auto_control_menu/__init__.py b/automation_editor/automation_editor_ui/menu/web_runner_menu/__init__.py similarity index 100% rename from integration_testing_environment/integration_testing_environment_ui/menu/auto_control_menu/__init__.py rename to automation_editor/automation_editor_ui/menu/web_runner_menu/__init__.py diff --git a/integration_testing_environment/integration_testing_environment_ui/menu/web_runner_menu/build_webrunner_menu.py b/automation_editor/automation_editor_ui/menu/web_runner_menu/build_webrunner_menu.py similarity index 92% rename from integration_testing_environment/integration_testing_environment_ui/menu/web_runner_menu/build_webrunner_menu.py rename to automation_editor/automation_editor_ui/menu/web_runner_menu/build_webrunner_menu.py index 41f0dea..3a3dc67 100644 --- a/integration_testing_environment/integration_testing_environment_ui/menu/web_runner_menu/build_webrunner_menu.py +++ b/automation_editor/automation_editor_ui/menu/web_runner_menu/build_webrunner_menu.py @@ -3,8 +3,8 @@ from PySide6.QtGui import QAction from PySide6.QtWidgets import QMainWindow -from integration_testing_environment.utils.manager.package_manager.package_manager_class import package_manager -from integration_testing_environment.utils.test_executor.web_runner.web_runner_process import call_web_runner_test, \ +from automation_editor.utils.manager.package_manager.package_manager_class import package_manager +from automation_editor.utils.test_executor.web_runner.web_runner_process import call_web_runner_test, \ call_web_runner_test_with_send, call_web_runner_test_multi_file, call_web_runner_test_multi_file_and_send @@ -66,7 +66,7 @@ def set_web_runner_menu(ui_we_want_to_set: QMainWindow): ui_we_want_to_set.open_web_runner_github_action = QAction("Open WebRunner GitHub") ui_we_want_to_set.open_web_runner_github_action.triggered.connect( lambda: open_web_browser( - "https://github.com/Integrated-Testing-Environment/LoadDensity" + "https://github.com/Intergration-Automation-Testing/WebRunner" ) ) ui_we_want_to_set.web_runner_help_menu.addAction( diff --git a/integration_testing_environment/integration_testing_environment_ui/menu/load_density_menu/__init__.py b/automation_editor/automation_editor_ui/show_code_window/__init__.py similarity index 100% rename from integration_testing_environment/integration_testing_environment_ui/menu/load_density_menu/__init__.py rename to automation_editor/automation_editor_ui/show_code_window/__init__.py diff --git a/integration_testing_environment/integration_testing_environment_ui/show_code_window/code_window.py b/automation_editor/automation_editor_ui/show_code_window/code_window.py similarity index 100% rename from integration_testing_environment/integration_testing_environment_ui/show_code_window/code_window.py rename to automation_editor/automation_editor_ui/show_code_window/code_window.py diff --git a/integration_testing_environment/integration_testing_environment_ui/menu/web_runner_menu/__init__.py b/automation_editor/automation_editor_ui/syntax/__init__.py similarity index 100% rename from integration_testing_environment/integration_testing_environment_ui/menu/web_runner_menu/__init__.py rename to automation_editor/automation_editor_ui/syntax/__init__.py diff --git a/integration_testing_environment/integration_testing_environment_ui/syntax/syntax_extend.py b/automation_editor/automation_editor_ui/syntax/syntax_extend.py similarity index 73% rename from integration_testing_environment/integration_testing_environment_ui/syntax/syntax_extend.py rename to automation_editor/automation_editor_ui/syntax/syntax_extend.py index 9aa074c..e15fc51 100644 --- a/integration_testing_environment/integration_testing_environment_ui/syntax/syntax_extend.py +++ b/automation_editor/automation_editor_ui/syntax/syntax_extend.py @@ -2,9 +2,9 @@ from PySide6.QtGui import QTextCharFormat, QColor from PySide6.QtWidgets import QMainWindow -from integration_testing_environment.integration_testing_environment_ui.syntax.syntax_keyword import \ +from automation_editor.automation_editor_ui.syntax.syntax_keyword import \ package_keyword_list -from integration_testing_environment.utils.manager.package_manager.package_manager_class import package_manager +from automation_editor.utils.manager.package_manager.package_manager_class import package_manager def syntax_extend_package(main_window: QMainWindow): diff --git a/integration_testing_environment/integration_testing_environment_ui/syntax/syntax_keyword.py b/automation_editor/automation_editor_ui/syntax/syntax_keyword.py similarity index 100% rename from integration_testing_environment/integration_testing_environment_ui/syntax/syntax_keyword.py rename to automation_editor/automation_editor_ui/syntax/syntax_keyword.py diff --git a/integration_testing_environment/integration_testing_environment_ui/show_code_window/__init__.py b/automation_editor/extend/__init__.py similarity index 100% rename from integration_testing_environment/integration_testing_environment_ui/show_code_window/__init__.py rename to automation_editor/extend/__init__.py diff --git a/integration_testing_environment/integration_testing_environment_ui/syntax/__init__.py b/automation_editor/extend/mail_thunder_extend/__init__.py similarity index 100% rename from integration_testing_environment/integration_testing_environment_ui/syntax/__init__.py rename to automation_editor/extend/mail_thunder_extend/__init__.py diff --git a/integration_testing_environment/extend/mail_thunder_extend/mail_thunder_setting.py b/automation_editor/extend/mail_thunder_extend/mail_thunder_setting.py similarity index 86% rename from integration_testing_environment/extend/mail_thunder_extend/mail_thunder_setting.py rename to automation_editor/extend/mail_thunder_extend/mail_thunder_setting.py index f6bd9a4..081c4bc 100644 --- a/integration_testing_environment/extend/mail_thunder_extend/mail_thunder_setting.py +++ b/automation_editor/extend/mail_thunder_extend/mail_thunder_setting.py @@ -1,36 +1,36 @@ -import sys -from email.mime.multipart import MIMEMultipart - -from integration_testing_environment.utils.exception.exception_tags import send_html_exception_tag -from integration_testing_environment.utils.exception.exceptions import ITESendHtmlReportException - - -def send_after_test(html_report_path: str = None): - try: - from je_mail_thunder import SMTPWrapper - mail_thunder_smtp: SMTPWrapper = SMTPWrapper() - if html_report_path is None and mail_thunder_smtp.login_state is True: - user: str = mail_thunder_smtp.user - with open("default_name.html", "r+") as file: - html_string: str = file.read() - message = mail_thunder_smtp.create_message_with_attach( - html_string, - {"Subject": "Test Report", "To": user, "From": user}, - "default_name.html", use_html=True) - mail_thunder_smtp.send_message(message) - mail_thunder_smtp.quit() - elif mail_thunder_smtp.login_state is True: - user: str = mail_thunder_smtp.user - with open(html_report_path, "r+") as file: - html_string: str = file.read() - message: MIMEMultipart = mail_thunder_smtp.create_message_with_attach( - html_string, - {"Subject": "Test Report", "To": user, "From": user}, - html_report_path, use_html=True) - mail_thunder_smtp.send_message(message) - mail_thunder_smtp.quit() - else: - raise ITESendHtmlReportException - except ITESendHtmlReportException as error: - print(repr(error), file=sys.stderr) - print(send_html_exception_tag, file=sys.stderr) +import sys +from email.mime.multipart import MIMEMultipart + +from automation_editor.utils.exception.exception_tags import send_html_exception_tag +from automation_editor.utils.exception.exceptions import ITESendHtmlReportException + + +def send_after_test(html_report_path: str = None): + try: + from je_mail_thunder import SMTPWrapper + mail_thunder_smtp: SMTPWrapper = SMTPWrapper() + if html_report_path is None and mail_thunder_smtp.login_state is True: + user: str = mail_thunder_smtp.user + with open("default_name.html", "r+") as file: + html_string: str = file.read() + message = mail_thunder_smtp.create_message_with_attach( + html_string, + {"Subject": "Test Report", "To": user, "From": user}, + "default_name.html", use_html=True) + mail_thunder_smtp.send_message(message) + mail_thunder_smtp.quit() + elif mail_thunder_smtp.login_state is True: + user: str = mail_thunder_smtp.user + with open(html_report_path, "r+") as file: + html_string: str = file.read() + message: MIMEMultipart = mail_thunder_smtp.create_message_with_attach( + html_string, + {"Subject": "Test Report", "To": user, "From": user}, + html_report_path, use_html=True) + mail_thunder_smtp.send_message(message) + mail_thunder_smtp.quit() + else: + raise ITESendHtmlReportException + except ITESendHtmlReportException as error: + print(repr(error), file=sys.stderr) + print(send_html_exception_tag, file=sys.stderr) diff --git a/integration_testing_environment/utils/__init__.py b/automation_editor/utils/__init__.py similarity index 100% rename from integration_testing_environment/utils/__init__.py rename to automation_editor/utils/__init__.py diff --git a/integration_testing_environment/utils/exception/__init__.py b/automation_editor/utils/exception/__init__.py similarity index 100% rename from integration_testing_environment/utils/exception/__init__.py rename to automation_editor/utils/exception/__init__.py diff --git a/integration_testing_environment/utils/exception/exception_tags.py b/automation_editor/utils/exception/exception_tags.py similarity index 100% rename from integration_testing_environment/utils/exception/exception_tags.py rename to automation_editor/utils/exception/exception_tags.py diff --git a/integration_testing_environment/utils/exception/exceptions.py b/automation_editor/utils/exception/exceptions.py similarity index 91% rename from integration_testing_environment/utils/exception/exceptions.py rename to automation_editor/utils/exception/exceptions.py index 0a100e7..4a3b023 100644 --- a/integration_testing_environment/utils/exception/exceptions.py +++ b/automation_editor/utils/exception/exceptions.py @@ -1,50 +1,50 @@ -class ITEException(Exception): - pass - - -# Executor - -class ITEAddCommandException(ITEException): - pass - - -class ITEExecException(ITEException): - pass - - -class ITETestExecutorException(ITEException): - pass - - -# HTML - -class ITESendHtmlReportException(ITEException): - pass - - -# UI - -class ITEUIException(ITEException): - pass - - -# Content - -class ITEContentFileException(ITEException): - pass - - -# Json - -class ITEJsonException(ITEException): - pass - - -# XML - -class XMLException(ITEException): - pass - - -class XMLTypeException(XMLException): - pass +class ITEException(Exception): + pass + + +# Executor + +class ITEAddCommandException(ITEException): + pass + + +class ITEExecException(ITEException): + pass + + +class ITETestExecutorException(ITEException): + pass + + +# HTML + +class ITESendHtmlReportException(ITEException): + pass + + +# UI + +class ITEUIException(ITEException): + pass + + +# Content + +class ITEContentFileException(ITEException): + pass + + +# Json + +class ITEJsonException(ITEException): + pass + + +# XML + +class XMLException(ITEException): + pass + + +class XMLTypeException(XMLException): + pass diff --git a/integration_testing_environment/utils/file_process/__init__.py b/automation_editor/utils/file_process/__init__.py similarity index 100% rename from integration_testing_environment/utils/file_process/__init__.py rename to automation_editor/utils/file_process/__init__.py diff --git a/integration_testing_environment/utils/file_process/get_dir_file_list.py b/automation_editor/utils/file_process/get_dir_file_list.py similarity index 97% rename from integration_testing_environment/utils/file_process/get_dir_file_list.py rename to automation_editor/utils/file_process/get_dir_file_list.py index 0ffd758..e7e11fa 100644 --- a/integration_testing_environment/utils/file_process/get_dir_file_list.py +++ b/automation_editor/utils/file_process/get_dir_file_list.py @@ -1,30 +1,30 @@ -import sys -import tkinter.filedialog -from os import getcwd -from os import walk -from os.path import abspath -from os.path import join - -from PySide6.QtWidgets import QFileDialog, QMainWindow - - -def get_dir_files_as_list(dir_path: str = getcwd(), default_search_file_extension: str = ".json") -> list: - """ - get dir file when end with default_search_file_extension - :param dir_path: which dir we want to walk and get file list - :param default_search_file_extension: which extension we want to search - :return: [] if nothing searched or [file1, file2.... files] file was searched - """ - return [ - abspath(join(dir_path, file)) for root, dirs, files in walk(dir_path) - for file in files - if file.endswith(default_search_file_extension.lower()) - ] - - -def ask_and_get_dir_files_as_list(main_window: QMainWindow, default_search_file_extension: str = ".json") -> list: - choose_dir = QFileDialog(parent=main_window).getExistingDirectory() - if choose_dir is not None and choose_dir != "": - return get_dir_files_as_list(choose_dir, default_search_file_extension) - else: - print("Not select any dir", file=sys.stderr) +import sys +import tkinter.filedialog +from os import getcwd +from os import walk +from os.path import abspath +from os.path import join + +from PySide6.QtWidgets import QFileDialog, QMainWindow + + +def get_dir_files_as_list(dir_path: str = getcwd(), default_search_file_extension: str = ".json") -> list: + """ + get dir file when end with default_search_file_extension + :param dir_path: which dir we want to walk and get file list + :param default_search_file_extension: which extension we want to search + :return: [] if nothing searched or [file1, file2.... files] file was searched + """ + return [ + abspath(join(dir_path, file)) for root, dirs, files in walk(dir_path) + for file in files + if file.endswith(default_search_file_extension.lower()) + ] + + +def ask_and_get_dir_files_as_list(main_window: QMainWindow, default_search_file_extension: str = ".json") -> list: + choose_dir = QFileDialog(parent=main_window).getExistingDirectory() + if choose_dir is not None and choose_dir != "": + return get_dir_files_as_list(choose_dir, default_search_file_extension) + else: + print("Not select any dir", file=sys.stderr) diff --git a/integration_testing_environment/utils/json_format/__init__.py b/automation_editor/utils/json_format/__init__.py similarity index 100% rename from integration_testing_environment/utils/json_format/__init__.py rename to automation_editor/utils/json_format/__init__.py diff --git a/integration_testing_environment/utils/json_format/json_process.py b/automation_editor/utils/json_format/json_process.py similarity index 71% rename from integration_testing_environment/utils/json_format/json_process.py rename to automation_editor/utils/json_format/json_process.py index 8429a68..979d72a 100644 --- a/integration_testing_environment/utils/json_format/json_process.py +++ b/automation_editor/utils/json_format/json_process.py @@ -3,9 +3,9 @@ from json import dumps from json import loads -from integration_testing_environment.utils.exception.exception_tags import cant_reformat_json_error -from integration_testing_environment.utils.exception.exception_tags import wrong_json_data_error -from integration_testing_environment.utils.exception.exceptions import ITEJsonException +from automation_editor.utils.exception.exception_tags import cant_reformat_json_error +from automation_editor.utils.exception.exception_tags import wrong_json_data_error +from automation_editor.utils.exception.exceptions import ITEJsonException def __process_json(json_string: str, **kwargs): diff --git a/integration_testing_environment/utils/manager/__init__.py b/automation_editor/utils/manager/__init__.py similarity index 100% rename from integration_testing_environment/utils/manager/__init__.py rename to automation_editor/utils/manager/__init__.py diff --git a/integration_testing_environment/utils/manager/package_manager/__init__.py b/automation_editor/utils/manager/package_manager/__init__.py similarity index 100% rename from integration_testing_environment/utils/manager/package_manager/__init__.py rename to automation_editor/utils/manager/package_manager/__init__.py diff --git a/integration_testing_environment/utils/manager/package_manager/package_manager_class.py b/automation_editor/utils/manager/package_manager/package_manager_class.py similarity index 97% rename from integration_testing_environment/utils/manager/package_manager/package_manager_class.py rename to automation_editor/utils/manager/package_manager/package_manager_class.py index 419f7ab..b376ed2 100644 --- a/integration_testing_environment/utils/manager/package_manager/package_manager_class.py +++ b/automation_editor/utils/manager/package_manager/package_manager_class.py @@ -1,52 +1,52 @@ -import os -import sys -from importlib import import_module -from importlib.util import find_spec - - -class PackageManager(object): - - def __init__(self): - os.environ["WDM_LOG"] = "0" - self.installed_package_dict = { - "je_auto_control": None, - "je_load_density": None, - "je_api_testka": None, - "je_web_runner": None, - "je_mail_thunder": None, - } - self.syntax_check_list = [ - "je_auto_control", - "je_load_density", - "je_api_testka", - "je_web_runner" - ] - try: - import je_load_density - import je_web_runner - import je_auto_control - import je_api_testka - self.installed_package_dict.update( - { - "je_api_testka": je_api_testka, - "je_web_runner": je_web_runner, - "je_auto_control": je_auto_control, - "je_load_density": je_load_density, - } - ) - except ImportError: - pass - - # This will make subprocess deadlock so emm we don't use this - def check_package(self): - for package, value in self.installed_package_dict.items(): - found_spec = find_spec(package) - if found_spec is not None and value is None: - try: - installed_package = import_module(found_spec.name) - self.installed_package_dict.update({found_spec.name: installed_package}) - except ModuleNotFoundError as error: - print(repr(error), file=sys.stderr) - - -package_manager = PackageManager() +import os +import sys +from importlib import import_module +from importlib.util import find_spec + + +class PackageManager(object): + + def __init__(self): + os.environ["WDM_LOG"] = "0" + self.installed_package_dict = { + "je_auto_control": None, + "je_load_density": None, + "je_api_testka": None, + "je_web_runner": None, + "je_mail_thunder": None, + } + self.syntax_check_list = [ + "je_auto_control", + "je_load_density", + "je_api_testka", + "je_web_runner" + ] + try: + import je_load_density + import je_web_runner + import je_auto_control + import je_api_testka + self.installed_package_dict.update( + { + "je_api_testka": je_api_testka, + "je_web_runner": je_web_runner, + "je_auto_control": je_auto_control, + "je_load_density": je_load_density, + } + ) + except ImportError: + pass + + # This will make subprocess deadlock so emm we don't use this + def check_package(self): + for package, value in self.installed_package_dict.items(): + found_spec = find_spec(package) + if found_spec is not None and value is None: + try: + installed_package = import_module(found_spec.name) + self.installed_package_dict.update({found_spec.name: installed_package}) + except ModuleNotFoundError as error: + print(repr(error), file=sys.stderr) + + +package_manager = PackageManager() diff --git a/integration_testing_environment/utils/test_executor/__init__.py b/automation_editor/utils/test_executor/__init__.py similarity index 100% rename from integration_testing_environment/utils/test_executor/__init__.py rename to automation_editor/utils/test_executor/__init__.py diff --git a/integration_testing_environment/utils/test_executor/api_testka/__init__.py b/automation_editor/utils/test_executor/api_testka/__init__.py similarity index 100% rename from integration_testing_environment/utils/test_executor/api_testka/__init__.py rename to automation_editor/utils/test_executor/api_testka/__init__.py diff --git a/integration_testing_environment/utils/test_executor/api_testka/api_testka_process.py b/automation_editor/utils/test_executor/api_testka/api_testka_process.py similarity index 78% rename from integration_testing_environment/utils/test_executor/api_testka/api_testka_process.py rename to automation_editor/utils/test_executor/api_testka/api_testka_process.py index 9f98638..74828a6 100644 --- a/integration_testing_environment/utils/test_executor/api_testka/api_testka_process.py +++ b/automation_editor/utils/test_executor/api_testka/api_testka_process.py @@ -1,105 +1,105 @@ -import json -import sys - -from PySide6.QtWidgets import QMainWindow - -from integration_testing_environment.extend.mail_thunder_extend.mail_thunder_setting import send_after_test -from integration_testing_environment.integration_testing_environment_ui.show_code_window.code_window import CodeWindow -from integration_testing_environment.utils.exception.exception_tags import wrong_test_data_format_exception_tag -from integration_testing_environment.utils.exception.exceptions import ITETestExecutorException -from integration_testing_environment.utils.file_process.get_dir_file_list import ask_and_get_dir_files_as_list -from integration_testing_environment.utils.test_executor.check_mail_thunder import check_mail_thunder_install -from integration_testing_environment.utils.test_executor.task_process_manager import TaskProcessManager - - -def call_api_testka_test( - main_window: QMainWindow, - test_format_code: str, - program_buffer: int = 1024000 -): - try: - code_window = CodeWindow() - main_window.current_run_code_window.append(code_window) - TaskProcessManager( - main_window=code_window, - program_buffer_size=program_buffer - ).start_test_process( - "je_api_testka", - exec_str=test_format_code, - ) - except json.decoder.JSONDecodeError as error: - print( - repr(error) + - "\n" - + wrong_test_data_format_exception_tag, - file=sys.stderr - ) - except ITETestExecutorException as error: - print(repr(error), file=sys.stderr) - - -def call_api_testka_test_with_send( - main_window: QMainWindow, - test_format_code: str, - program_buffer: int = 1024000 -): - try: - check_mail_thunder_install() - code_window = CodeWindow() - main_window.current_run_code_window.append(code_window) - TaskProcessManager( - main_window=code_window, - task_done_trigger_function=send_after_test, - program_buffer_size=program_buffer - ).start_test_process( - "je_api_testka", - exec_str=test_format_code, - ) - except json.decoder.JSONDecodeError as error: - print( - repr(error) + - "\n" - + wrong_test_data_format_exception_tag, - file=sys.stderr - ) - except ITETestExecutorException as error: - print(repr(error), file=sys.stderr) - - -def call_api_testka_test_multi_file( - main_window: QMainWindow, - program_buffer: int = 1024000 -): - try: - need_to_execute_list: list = ask_and_get_dir_files_as_list(main_window) - if need_to_execute_list is not None \ - and isinstance(need_to_execute_list, list) and len(need_to_execute_list) > 0: - for execute_file in need_to_execute_list: - with open(execute_file, "r+") as test_script_json: - call_api_testka_test( - main_window, - test_script_json.read(), - program_buffer - ) - except Exception as error: - print(repr(error), file=sys.stderr) - - -def call_api_testka_test_multi_file_and_send( - main_window: QMainWindow, - program_buffer: int = 1024000 -): - try: - check_mail_thunder_install() - need_to_execute_list: list = ask_and_get_dir_files_as_list(main_window) - if need_to_execute_list is not None \ - and isinstance(need_to_execute_list, list) and len(need_to_execute_list) > 0: - for execute_file in need_to_execute_list: - with open(execute_file, "r+") as test_script_json: - call_api_testka_test_with_send( - main_window, - test_script_json.read(), - program_buffer - ) - except Exception as error: - print(repr(error), file=sys.stderr) +import json +import sys + +from PySide6.QtWidgets import QMainWindow + +from automation_editor.extend.mail_thunder_extend.mail_thunder_setting import send_after_test +from automation_editor.automation_editor_ui.show_code_window.code_window import CodeWindow +from automation_editor.utils.exception.exception_tags import wrong_test_data_format_exception_tag +from automation_editor.utils.exception.exceptions import ITETestExecutorException +from automation_editor.utils.file_process.get_dir_file_list import ask_and_get_dir_files_as_list +from automation_editor.utils.test_executor.check_mail_thunder import check_mail_thunder_install +from automation_editor.utils.test_executor.task_process_manager import TaskProcessManager + + +def call_api_testka_test( + main_window: QMainWindow, + test_format_code: str, + program_buffer: int = 1024000 +): + try: + code_window = CodeWindow() + main_window.current_run_code_window.append(code_window) + TaskProcessManager( + main_window=code_window, + program_buffer_size=program_buffer + ).start_test_process( + "je_api_testka", + exec_str=test_format_code, + ) + except json.decoder.JSONDecodeError as error: + print( + repr(error) + + "\n" + + wrong_test_data_format_exception_tag, + file=sys.stderr + ) + except ITETestExecutorException as error: + print(repr(error), file=sys.stderr) + + +def call_api_testka_test_with_send( + main_window: QMainWindow, + test_format_code: str, + program_buffer: int = 1024000 +): + try: + check_mail_thunder_install() + code_window = CodeWindow() + main_window.current_run_code_window.append(code_window) + TaskProcessManager( + main_window=code_window, + task_done_trigger_function=send_after_test, + program_buffer_size=program_buffer + ).start_test_process( + "je_api_testka", + exec_str=test_format_code, + ) + except json.decoder.JSONDecodeError as error: + print( + repr(error) + + "\n" + + wrong_test_data_format_exception_tag, + file=sys.stderr + ) + except ITETestExecutorException as error: + print(repr(error), file=sys.stderr) + + +def call_api_testka_test_multi_file( + main_window: QMainWindow, + program_buffer: int = 1024000 +): + try: + need_to_execute_list: list = ask_and_get_dir_files_as_list(main_window) + if need_to_execute_list is not None \ + and isinstance(need_to_execute_list, list) and len(need_to_execute_list) > 0: + for execute_file in need_to_execute_list: + with open(execute_file, "r+") as test_script_json: + call_api_testka_test( + main_window, + test_script_json.read(), + program_buffer + ) + except Exception as error: + print(repr(error), file=sys.stderr) + + +def call_api_testka_test_multi_file_and_send( + main_window: QMainWindow, + program_buffer: int = 1024000 +): + try: + check_mail_thunder_install() + need_to_execute_list: list = ask_and_get_dir_files_as_list(main_window) + if need_to_execute_list is not None \ + and isinstance(need_to_execute_list, list) and len(need_to_execute_list) > 0: + for execute_file in need_to_execute_list: + with open(execute_file, "r+") as test_script_json: + call_api_testka_test_with_send( + main_window, + test_script_json.read(), + program_buffer + ) + except Exception as error: + print(repr(error), file=sys.stderr) diff --git a/integration_testing_environment/utils/test_executor/auto_control/__init__.py b/automation_editor/utils/test_executor/auto_control/__init__.py similarity index 100% rename from integration_testing_environment/utils/test_executor/auto_control/__init__.py rename to automation_editor/utils/test_executor/auto_control/__init__.py diff --git a/integration_testing_environment/utils/test_executor/auto_control/auto_control_process.py b/automation_editor/utils/test_executor/auto_control/auto_control_process.py similarity index 78% rename from integration_testing_environment/utils/test_executor/auto_control/auto_control_process.py rename to automation_editor/utils/test_executor/auto_control/auto_control_process.py index 45940a1..95c149f 100644 --- a/integration_testing_environment/utils/test_executor/auto_control/auto_control_process.py +++ b/automation_editor/utils/test_executor/auto_control/auto_control_process.py @@ -1,105 +1,105 @@ -import json -import sys - -from PySide6.QtWidgets import QMainWindow - -from integration_testing_environment.extend.mail_thunder_extend.mail_thunder_setting import send_after_test -from integration_testing_environment.integration_testing_environment_ui.show_code_window.code_window import CodeWindow -from integration_testing_environment.utils.exception.exception_tags import wrong_test_data_format_exception_tag -from integration_testing_environment.utils.exception.exceptions import ITETestExecutorException -from integration_testing_environment.utils.file_process.get_dir_file_list import ask_and_get_dir_files_as_list -from integration_testing_environment.utils.test_executor.check_mail_thunder import check_mail_thunder_install -from integration_testing_environment.utils.test_executor.task_process_manager import TaskProcessManager - - -def call_auto_control_test( - main_window: QMainWindow, - test_format_code: str, - program_buffer: int = 1024000 -): - try: - code_window = CodeWindow() - main_window.current_run_code_window.append(code_window) - TaskProcessManager( - main_window=code_window, - program_buffer_size=program_buffer - ).start_test_process( - "je_auto_control", - exec_str=test_format_code, - ) - except json.decoder.JSONDecodeError as error: - print( - repr(error) + - "\n" - + wrong_test_data_format_exception_tag, - file=sys.stderr - ) - except ITETestExecutorException as error: - print(repr(error), file=sys.stderr) - - -def call_auto_control_test_with_send( - main_window: QMainWindow, - test_format_code: str, - program_buffer: int = 1024000 -): - try: - check_mail_thunder_install() - code_window = CodeWindow() - main_window.current_run_code_window.append(code_window) - TaskProcessManager( - code_window, - task_done_trigger_function=send_after_test, - program_buffer_size=program_buffer - ).start_test_process( - "je_auto_control", - exec_str=test_format_code, - ) - except json.decoder.JSONDecodeError as error: - print( - repr(error) + - "\n" - + wrong_test_data_format_exception_tag, - file=sys.stderr - ) - except ITETestExecutorException as error: - print(repr(error), file=sys.stderr) - - -def call_auto_control_test_multi_file( - main_window: QMainWindow, - program_buffer: int = 1024000 -): - try: - need_to_execute_list: list = ask_and_get_dir_files_as_list(main_window) - if need_to_execute_list is not None \ - and isinstance(need_to_execute_list, list) and len(need_to_execute_list) > 0: - for execute_file in need_to_execute_list: - with open(execute_file, "r+") as test_script_json: - call_auto_control_test( - main_window, - test_script_json.read(), - program_buffer - ) - except Exception as error: - print(repr(error), file=sys.stderr) - - -def call_auto_control_test_multi_file_and_send( - main_window: QMainWindow, - program_buffer: int = 1024000 -): - try: - check_mail_thunder_install() - need_to_execute_list: list = ask_and_get_dir_files_as_list(main_window) - if need_to_execute_list is not None \ - and isinstance(need_to_execute_list, list) and len(need_to_execute_list) > 0: - for execute_file in need_to_execute_list: - with open(execute_file, "r+") as test_script_json: - call_auto_control_test_with_send( - main_window, - test_script_json.read(), - program_buffer - ) - except Exception as error: - print(repr(error), file=sys.stderr) +import json +import sys + +from PySide6.QtWidgets import QMainWindow + +from automation_editor.extend.mail_thunder_extend.mail_thunder_setting import send_after_test +from automation_editor.automation_editor_ui.show_code_window.code_window import CodeWindow +from automation_editor.utils.exception.exception_tags import wrong_test_data_format_exception_tag +from automation_editor.utils.exception.exceptions import ITETestExecutorException +from automation_editor.utils.file_process.get_dir_file_list import ask_and_get_dir_files_as_list +from automation_editor.utils.test_executor.check_mail_thunder import check_mail_thunder_install +from automation_editor.utils.test_executor.task_process_manager import TaskProcessManager + + +def call_auto_control_test( + main_window: QMainWindow, + test_format_code: str, + program_buffer: int = 1024000 +): + try: + code_window = CodeWindow() + main_window.current_run_code_window.append(code_window) + TaskProcessManager( + main_window=code_window, + program_buffer_size=program_buffer + ).start_test_process( + "je_auto_control", + exec_str=test_format_code, + ) + except json.decoder.JSONDecodeError as error: + print( + repr(error) + + "\n" + + wrong_test_data_format_exception_tag, + file=sys.stderr + ) + except ITETestExecutorException as error: + print(repr(error), file=sys.stderr) + + +def call_auto_control_test_with_send( + main_window: QMainWindow, + test_format_code: str, + program_buffer: int = 1024000 +): + try: + check_mail_thunder_install() + code_window = CodeWindow() + main_window.current_run_code_window.append(code_window) + TaskProcessManager( + code_window, + task_done_trigger_function=send_after_test, + program_buffer_size=program_buffer + ).start_test_process( + "je_auto_control", + exec_str=test_format_code, + ) + except json.decoder.JSONDecodeError as error: + print( + repr(error) + + "\n" + + wrong_test_data_format_exception_tag, + file=sys.stderr + ) + except ITETestExecutorException as error: + print(repr(error), file=sys.stderr) + + +def call_auto_control_test_multi_file( + main_window: QMainWindow, + program_buffer: int = 1024000 +): + try: + need_to_execute_list: list = ask_and_get_dir_files_as_list(main_window) + if need_to_execute_list is not None \ + and isinstance(need_to_execute_list, list) and len(need_to_execute_list) > 0: + for execute_file in need_to_execute_list: + with open(execute_file, "r+") as test_script_json: + call_auto_control_test( + main_window, + test_script_json.read(), + program_buffer + ) + except Exception as error: + print(repr(error), file=sys.stderr) + + +def call_auto_control_test_multi_file_and_send( + main_window: QMainWindow, + program_buffer: int = 1024000 +): + try: + check_mail_thunder_install() + need_to_execute_list: list = ask_and_get_dir_files_as_list(main_window) + if need_to_execute_list is not None \ + and isinstance(need_to_execute_list, list) and len(need_to_execute_list) > 0: + for execute_file in need_to_execute_list: + with open(execute_file, "r+") as test_script_json: + call_auto_control_test_with_send( + main_window, + test_script_json.read(), + program_buffer + ) + except Exception as error: + print(repr(error), file=sys.stderr) diff --git a/automation_editor/utils/test_executor/check_mail_thunder.py b/automation_editor/utils/test_executor/check_mail_thunder.py new file mode 100644 index 0000000..c66d909 --- /dev/null +++ b/automation_editor/utils/test_executor/check_mail_thunder.py @@ -0,0 +1,10 @@ +from automation_editor.utils.exception.exception_tags import not_install_exception +from automation_editor.utils.exception.exceptions import ITETestExecutorException +from automation_editor.utils.manager.package_manager.package_manager_class import package_manager + + +def check_mail_thunder_install(): + if package_manager.installed_package_dict.get("je_mail_thunder", None) is None: + raise ITETestExecutorException( + not_install_exception + " je_mail_thunder" + ) diff --git a/integration_testing_environment/utils/test_executor/load_density/__init__.py b/automation_editor/utils/test_executor/load_density/__init__.py similarity index 100% rename from integration_testing_environment/utils/test_executor/load_density/__init__.py rename to automation_editor/utils/test_executor/load_density/__init__.py diff --git a/integration_testing_environment/utils/test_executor/load_density/load_density_process.py b/automation_editor/utils/test_executor/load_density/load_density_process.py similarity index 78% rename from integration_testing_environment/utils/test_executor/load_density/load_density_process.py rename to automation_editor/utils/test_executor/load_density/load_density_process.py index 1717725..a02c858 100644 --- a/integration_testing_environment/utils/test_executor/load_density/load_density_process.py +++ b/automation_editor/utils/test_executor/load_density/load_density_process.py @@ -1,105 +1,105 @@ -import json -import sys - -from PySide6.QtWidgets import QMainWindow - -from integration_testing_environment.extend.mail_thunder_extend.mail_thunder_setting import send_after_test -from integration_testing_environment.integration_testing_environment_ui.show_code_window.code_window import CodeWindow -from integration_testing_environment.utils.exception.exception_tags import wrong_test_data_format_exception_tag -from integration_testing_environment.utils.exception.exceptions import ITETestExecutorException -from integration_testing_environment.utils.file_process.get_dir_file_list import ask_and_get_dir_files_as_list -from integration_testing_environment.utils.test_executor.check_mail_thunder import check_mail_thunder_install -from integration_testing_environment.utils.test_executor.task_process_manager import TaskProcessManager - - -def call_load_density_test( - main_window: QMainWindow, - test_format_code: str, - program_buffer: int = 1024000 -): - try: - code_window = CodeWindow() - main_window.current_run_code_window.append(code_window) - TaskProcessManager( - main_window=code_window, - program_buffer_size=program_buffer - ).start_test_process( - "je_load_density", - exec_str=test_format_code, - ) - except json.decoder.JSONDecodeError as error: - print( - repr(error) + - "\n" - + wrong_test_data_format_exception_tag, - file=sys.stderr - ) - except ITETestExecutorException as error: - print(repr(error), file=sys.stderr) - - -def call_load_density_test_with_send( - main_window: QMainWindow, - test_format_code: str, - program_buffer: int = 1024000 -): - try: - check_mail_thunder_install() - code_window = CodeWindow() - main_window.current_run_code_window.append(code_window) - TaskProcessManager( - main_window=code_window, - task_done_trigger_function=send_after_test, - program_buffer_size=program_buffer - ).start_test_process( - "je_load_density", - exec_str=test_format_code, - ) - except json.decoder.JSONDecodeError as error: - print( - repr(error) + - "\n" - + wrong_test_data_format_exception_tag, - file=sys.stderr - ) - except ITETestExecutorException as error: - print(repr(error), file=sys.stderr) - - -def call_load_density_test_multi_file( - main_window: QMainWindow, - program_buffer: int = 1024000 -): - try: - need_to_execute_list: list = ask_and_get_dir_files_as_list(main_window) - if need_to_execute_list is not None and isinstance(need_to_execute_list, list) and len( - need_to_execute_list) > 0: - for execute_file in need_to_execute_list: - with open(execute_file, "r+") as test_script_json: - call_load_density_test( - main_window, - test_script_json.read(), - program_buffer - ) - except Exception as error: - print(repr(error), file=sys.stderr) - - -def call_load_density_test_multi_file_and_send( - main_window: QMainWindow, - program_buffer: int = 1024000 -): - try: - check_mail_thunder_install() - need_to_execute_list: list = ask_and_get_dir_files_as_list(main_window) - if need_to_execute_list is not None and isinstance(need_to_execute_list, list) and len( - need_to_execute_list) > 0: - for execute_file in need_to_execute_list: - with open(execute_file, "r+") as test_script_json: - call_load_density_test_with_send( - main_window, - test_script_json.read(), - program_buffer - ) - except Exception as error: - print(repr(error), file=sys.stderr) +import json +import sys + +from PySide6.QtWidgets import QMainWindow + +from automation_editor.extend.mail_thunder_extend.mail_thunder_setting import send_after_test +from automation_editor.automation_editor_ui.show_code_window.code_window import CodeWindow +from automation_editor.utils.exception.exception_tags import wrong_test_data_format_exception_tag +from automation_editor.utils.exception.exceptions import ITETestExecutorException +from automation_editor.utils.file_process.get_dir_file_list import ask_and_get_dir_files_as_list +from automation_editor.utils.test_executor.check_mail_thunder import check_mail_thunder_install +from automation_editor.utils.test_executor.task_process_manager import TaskProcessManager + + +def call_load_density_test( + main_window: QMainWindow, + test_format_code: str, + program_buffer: int = 1024000 +): + try: + code_window = CodeWindow() + main_window.current_run_code_window.append(code_window) + TaskProcessManager( + main_window=code_window, + program_buffer_size=program_buffer + ).start_test_process( + "je_load_density", + exec_str=test_format_code, + ) + except json.decoder.JSONDecodeError as error: + print( + repr(error) + + "\n" + + wrong_test_data_format_exception_tag, + file=sys.stderr + ) + except ITETestExecutorException as error: + print(repr(error), file=sys.stderr) + + +def call_load_density_test_with_send( + main_window: QMainWindow, + test_format_code: str, + program_buffer: int = 1024000 +): + try: + check_mail_thunder_install() + code_window = CodeWindow() + main_window.current_run_code_window.append(code_window) + TaskProcessManager( + main_window=code_window, + task_done_trigger_function=send_after_test, + program_buffer_size=program_buffer + ).start_test_process( + "je_load_density", + exec_str=test_format_code, + ) + except json.decoder.JSONDecodeError as error: + print( + repr(error) + + "\n" + + wrong_test_data_format_exception_tag, + file=sys.stderr + ) + except ITETestExecutorException as error: + print(repr(error), file=sys.stderr) + + +def call_load_density_test_multi_file( + main_window: QMainWindow, + program_buffer: int = 1024000 +): + try: + need_to_execute_list: list = ask_and_get_dir_files_as_list(main_window) + if need_to_execute_list is not None and isinstance(need_to_execute_list, list) and len( + need_to_execute_list) > 0: + for execute_file in need_to_execute_list: + with open(execute_file, "r+") as test_script_json: + call_load_density_test( + main_window, + test_script_json.read(), + program_buffer + ) + except Exception as error: + print(repr(error), file=sys.stderr) + + +def call_load_density_test_multi_file_and_send( + main_window: QMainWindow, + program_buffer: int = 1024000 +): + try: + check_mail_thunder_install() + need_to_execute_list: list = ask_and_get_dir_files_as_list(main_window) + if need_to_execute_list is not None and isinstance(need_to_execute_list, list) and len( + need_to_execute_list) > 0: + for execute_file in need_to_execute_list: + with open(execute_file, "r+") as test_script_json: + call_load_density_test_with_send( + main_window, + test_script_json.read(), + program_buffer + ) + except Exception as error: + print(repr(error), file=sys.stderr) diff --git a/integration_testing_environment/utils/test_executor/task_process_manager.py b/automation_editor/utils/test_executor/task_process_manager.py similarity index 97% rename from integration_testing_environment/utils/test_executor/task_process_manager.py rename to automation_editor/utils/test_executor/task_process_manager.py index d6222cb..732b7b0 100644 --- a/integration_testing_environment/utils/test_executor/task_process_manager.py +++ b/automation_editor/utils/test_executor/task_process_manager.py @@ -1,142 +1,142 @@ -import queue -import shutil -import subprocess -import threading -import typing -from queue import Queue -from threading import Thread - -from PySide6.QtCore import QTimer -from PySide6.QtWidgets import QTextEdit, QWidget -from je_editor import error_color, output_color - - -class TaskProcessManager(object): - def __init__( - self, - main_window, - task_done_trigger_function: typing.Callable = None, - error_trigger_function: typing.Callable = None, - program_buffer_size: int = 1024000 - ): - super().__init__() - # ite_instance param - self.read_program_error_output_from_thread: [threading.Thread, None] = None - self.read_program_output_from_thread: [threading.Thread, None] = None - self.main_window: QWidget = main_window - self.code_result: QTextEdit = self.main_window.code_result - self.timer: QTimer = QTimer(self.main_window) - self.still_run_program: bool = True - self.program_encoding: str = "utf-8" - self.run_output_queue: Queue = Queue() - self.run_error_queue: Queue = Queue() - self.process: [subprocess.Popen, None] = None - self.task_done_trigger_function: typing.Callable = task_done_trigger_function - self.error_trigger_function: typing.Callable = error_trigger_function - self.program_buffer_size = program_buffer_size - - def start_test_process(self, package: str, exec_str: str): - # try to find file and compiler - compiler_path = shutil.which("python") - if compiler_path is None: - compiler_path = shutil.which("python3") - self.process = subprocess.Popen( - [ - compiler_path, - "-m", - package, - "--execute_str", - exec_str - ], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE - ) - self.still_run_program = True - # program output message queue thread - self.read_program_output_from_thread = Thread( - target=self.read_program_output_from_process, - daemon=True - ) - self.read_program_output_from_thread.start() - # program error message queue thread - self.read_program_error_output_from_thread = Thread( - target=self.read_program_error_output_from_process, - daemon=True - ) - self.read_program_error_output_from_thread.start() - # start Pyside update - # start timer - self.timer = QTimer(self.main_window) - self.timer.setInterval(1) - self.timer.timeout.connect(self.pull_text) - self.timer.start() - self.main_window.setWindowTitle(package) - self.main_window.show() - - # Pyside UI update method - def pull_text(self): - try: - self.code_result.setTextColor(error_color) - if not self.run_error_queue.empty(): - error_message = self.run_error_queue.get_nowait() - error_message = str(error_message).strip() - if error_message: - self.code_result.append(error_message) - self.code_result.setTextColor(output_color) - if not self.run_output_queue.empty(): - output_message = self.run_output_queue.get_nowait() - output_message = str(output_message).strip() - if output_message: - self.code_result.append(output_message) - except queue.Empty: - pass - if self.process.returncode == 0: - self.exit_program() - elif self.process.returncode is not None: - self.exit_program() - self.timer.stop() - if self.still_run_program: - # poll return code - self.process.poll() - - # exit program change run flag to false and clean read thread and queue and process - def exit_program(self): - self.still_run_program = False - if self.read_program_output_from_thread is not None: - self.read_program_output_from_thread = None - if self.read_program_error_output_from_thread is not None: - self.read_program_error_output_from_thread = None - self.print_and_clear_queue() - if self.process is not None: - self.process.terminate() - - def print_and_clear_queue(self): - try: - for std_output in iter(self.run_output_queue.get_nowait, None): - std_output = str(std_output).strip() - if std_output: - self.code_result.append(std_output) - self.code_result.setTextColor(error_color) - for std_err in iter(self.run_error_queue.get_nowait, None): - std_err = str(std_err).strip() - if std_err: - self.code_result.append(std_err) - self.code_result.setTextColor(output_color) - except queue.Empty: - pass - self.run_output_queue = queue.Queue() - self.run_error_queue = queue.Queue() - - def read_program_output_from_process(self): - while self.still_run_program: - program_output_data = self.process.stdout.raw.read(self.program_buffer_size).decode(self.program_encoding) - if program_output_data.strip() != "": - self.run_output_queue.put(program_output_data) - - def read_program_error_output_from_process(self): - while self.still_run_program: - program_error_output_data = self.process.stderr.raw.read(self.program_buffer_size).decode( - self.program_encoding) - if program_error_output_data.strip() != "": - self.run_error_queue.put(program_error_output_data) - +import queue +import shutil +import subprocess +import threading +import typing +from queue import Queue +from threading import Thread + +from PySide6.QtCore import QTimer +from PySide6.QtWidgets import QTextEdit, QWidget +from je_editor import error_color, output_color + + +class TaskProcessManager(object): + def __init__( + self, + main_window, + task_done_trigger_function: typing.Callable = None, + error_trigger_function: typing.Callable = None, + program_buffer_size: int = 1024000 + ): + super().__init__() + # ite_instance param + self.read_program_error_output_from_thread: [threading.Thread, None] = None + self.read_program_output_from_thread: [threading.Thread, None] = None + self.main_window: QWidget = main_window + self.code_result: QTextEdit = self.main_window.code_result + self.timer: QTimer = QTimer(self.main_window) + self.still_run_program: bool = True + self.program_encoding: str = "utf-8" + self.run_output_queue: Queue = Queue() + self.run_error_queue: Queue = Queue() + self.process: [subprocess.Popen, None] = None + self.task_done_trigger_function: typing.Callable = task_done_trigger_function + self.error_trigger_function: typing.Callable = error_trigger_function + self.program_buffer_size = program_buffer_size + + def start_test_process(self, package: str, exec_str: str): + # try to find file and compiler + compiler_path = shutil.which("python") + if compiler_path is None: + compiler_path = shutil.which("python3") + self.process = subprocess.Popen( + [ + compiler_path, + "-m", + package, + "--execute_str", + exec_str + ], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE + ) + self.still_run_program = True + # program output message queue thread + self.read_program_output_from_thread = Thread( + target=self.read_program_output_from_process, + daemon=True + ) + self.read_program_output_from_thread.start() + # program error message queue thread + self.read_program_error_output_from_thread = Thread( + target=self.read_program_error_output_from_process, + daemon=True + ) + self.read_program_error_output_from_thread.start() + # start Pyside update + # start timer + self.timer = QTimer(self.main_window) + self.timer.setInterval(1) + self.timer.timeout.connect(self.pull_text) + self.timer.start() + self.main_window.setWindowTitle(package) + self.main_window.show() + + # Pyside UI update method + def pull_text(self): + try: + self.code_result.setTextColor(error_color) + if not self.run_error_queue.empty(): + error_message = self.run_error_queue.get_nowait() + error_message = str(error_message).strip() + if error_message: + self.code_result.append(error_message) + self.code_result.setTextColor(output_color) + if not self.run_output_queue.empty(): + output_message = self.run_output_queue.get_nowait() + output_message = str(output_message).strip() + if output_message: + self.code_result.append(output_message) + except queue.Empty: + pass + if self.process.returncode == 0: + self.exit_program() + elif self.process.returncode is not None: + self.exit_program() + self.timer.stop() + if self.still_run_program: + # poll return code + self.process.poll() + + # exit program change run flag to false and clean read thread and queue and process + def exit_program(self): + self.still_run_program = False + if self.read_program_output_from_thread is not None: + self.read_program_output_from_thread = None + if self.read_program_error_output_from_thread is not None: + self.read_program_error_output_from_thread = None + self.print_and_clear_queue() + if self.process is not None: + self.process.terminate() + + def print_and_clear_queue(self): + try: + for std_output in iter(self.run_output_queue.get_nowait, None): + std_output = str(std_output).strip() + if std_output: + self.code_result.append(std_output) + self.code_result.setTextColor(error_color) + for std_err in iter(self.run_error_queue.get_nowait, None): + std_err = str(std_err).strip() + if std_err: + self.code_result.append(std_err) + self.code_result.setTextColor(output_color) + except queue.Empty: + pass + self.run_output_queue = queue.Queue() + self.run_error_queue = queue.Queue() + + def read_program_output_from_process(self): + while self.still_run_program: + program_output_data = self.process.stdout.raw.read(self.program_buffer_size).decode(self.program_encoding) + if program_output_data.strip() != "": + self.run_output_queue.put(program_output_data) + + def read_program_error_output_from_process(self): + while self.still_run_program: + program_error_output_data = self.process.stderr.raw.read(self.program_buffer_size).decode( + self.program_encoding) + if program_error_output_data.strip() != "": + self.run_error_queue.put(program_error_output_data) + diff --git a/integration_testing_environment/utils/test_executor/web_runner/__init__.py b/automation_editor/utils/test_executor/web_runner/__init__.py similarity index 100% rename from integration_testing_environment/utils/test_executor/web_runner/__init__.py rename to automation_editor/utils/test_executor/web_runner/__init__.py diff --git a/integration_testing_environment/utils/test_executor/web_runner/web_runner_process.py b/automation_editor/utils/test_executor/web_runner/web_runner_process.py similarity index 78% rename from integration_testing_environment/utils/test_executor/web_runner/web_runner_process.py rename to automation_editor/utils/test_executor/web_runner/web_runner_process.py index 66821b8..4916dbf 100644 --- a/integration_testing_environment/utils/test_executor/web_runner/web_runner_process.py +++ b/automation_editor/utils/test_executor/web_runner/web_runner_process.py @@ -1,103 +1,103 @@ -import json -import sys - -from PySide6.QtWidgets import QMainWindow - -from integration_testing_environment.extend.mail_thunder_extend.mail_thunder_setting import send_after_test -from integration_testing_environment.integration_testing_environment_ui.show_code_window.code_window import CodeWindow -from integration_testing_environment.utils.exception.exception_tags import wrong_test_data_format_exception_tag -from integration_testing_environment.utils.exception.exceptions import ITETestExecutorException -from integration_testing_environment.utils.file_process.get_dir_file_list import ask_and_get_dir_files_as_list -from integration_testing_environment.utils.test_executor.check_mail_thunder import check_mail_thunder_install -from integration_testing_environment.utils.test_executor.task_process_manager import TaskProcessManager - - -def call_web_runner_test( - main_window: QMainWindow, - test_format_code: str, - program_buffer: int = 1024000 -): - try: - code_window = CodeWindow() - main_window.current_run_code_window.append(code_window) - TaskProcessManager( - main_window=code_window, - program_buffer_size=program_buffer - ).start_test_process( - "je_web_runner", - exec_str=test_format_code, - ) - except json.decoder.JSONDecodeError as error: - print( - repr(error) + - "\n" - + wrong_test_data_format_exception_tag, - file=sys.stderr - ) - except ITETestExecutorException as error: - print(repr(error), file=sys.stderr) - - -def call_web_runner_test_with_send( - main_window: QMainWindow, - test_format_code: str, - program_buffer: int = 1024000 -): - try: - check_mail_thunder_install() - code_window = CodeWindow() - main_window.current_run_code_window.append(code_window) - TaskProcessManager( - main_window=code_window, - task_done_trigger_function=send_after_test, - program_buffer_size=program_buffer - ).start_test_process( - "je_web_runner", - exec_str=test_format_code, - ) - except json.decoder.JSONDecodeError as error: - print( - repr(error) + - "\n" - + wrong_test_data_format_exception_tag, - file=sys.stderr - ) - except ITETestExecutorException as error: - print(repr(error), file=sys.stderr) - - -def call_web_runner_test_multi_file( - main_window: QMainWindow, - program_buffer: int = 1024000 -): - try: - need_to_execute_list: list = ask_and_get_dir_files_as_list(main_window) - if need_to_execute_list is not None and isinstance(need_to_execute_list, list) and len(need_to_execute_list) > 0: - for execute_file in need_to_execute_list: - with open(execute_file, "r+") as test_script_json: - call_web_runner_test( - main_window, - test_script_json.read(), - program_buffer - ) - except Exception as error: - print(repr(error), file=sys.stderr) - - -def call_web_runner_test_multi_file_and_send( - main_window: QMainWindow, - program_buffer: int = 1024000 -): - try: - check_mail_thunder_install() - need_to_execute_list: list = ask_and_get_dir_files_as_list(main_window) - if need_to_execute_list is not None and isinstance(need_to_execute_list, list) and len(need_to_execute_list) > 0: - for execute_file in need_to_execute_list: - with open(execute_file, "r+") as test_script_json: - call_web_runner_test_with_send( - main_window, - test_script_json.read(), - program_buffer - ) - except Exception as error: - print(repr(error), file=sys.stderr) +import json +import sys + +from PySide6.QtWidgets import QMainWindow + +from automation_editor.extend.mail_thunder_extend.mail_thunder_setting import send_after_test +from automation_editor.automation_editor_ui.show_code_window.code_window import CodeWindow +from automation_editor.utils.exception.exception_tags import wrong_test_data_format_exception_tag +from automation_editor.utils.exception.exceptions import ITETestExecutorException +from automation_editor.utils.file_process.get_dir_file_list import ask_and_get_dir_files_as_list +from automation_editor.utils.test_executor.check_mail_thunder import check_mail_thunder_install +from automation_editor.utils.test_executor.task_process_manager import TaskProcessManager + + +def call_web_runner_test( + main_window: QMainWindow, + test_format_code: str, + program_buffer: int = 1024000 +): + try: + code_window = CodeWindow() + main_window.current_run_code_window.append(code_window) + TaskProcessManager( + main_window=code_window, + program_buffer_size=program_buffer + ).start_test_process( + "je_web_runner", + exec_str=test_format_code, + ) + except json.decoder.JSONDecodeError as error: + print( + repr(error) + + "\n" + + wrong_test_data_format_exception_tag, + file=sys.stderr + ) + except ITETestExecutorException as error: + print(repr(error), file=sys.stderr) + + +def call_web_runner_test_with_send( + main_window: QMainWindow, + test_format_code: str, + program_buffer: int = 1024000 +): + try: + check_mail_thunder_install() + code_window = CodeWindow() + main_window.current_run_code_window.append(code_window) + TaskProcessManager( + main_window=code_window, + task_done_trigger_function=send_after_test, + program_buffer_size=program_buffer + ).start_test_process( + "je_web_runner", + exec_str=test_format_code, + ) + except json.decoder.JSONDecodeError as error: + print( + repr(error) + + "\n" + + wrong_test_data_format_exception_tag, + file=sys.stderr + ) + except ITETestExecutorException as error: + print(repr(error), file=sys.stderr) + + +def call_web_runner_test_multi_file( + main_window: QMainWindow, + program_buffer: int = 1024000 +): + try: + need_to_execute_list: list = ask_and_get_dir_files_as_list(main_window) + if need_to_execute_list is not None and isinstance(need_to_execute_list, list) and len(need_to_execute_list) > 0: + for execute_file in need_to_execute_list: + with open(execute_file, "r+") as test_script_json: + call_web_runner_test( + main_window, + test_script_json.read(), + program_buffer + ) + except Exception as error: + print(repr(error), file=sys.stderr) + + +def call_web_runner_test_multi_file_and_send( + main_window: QMainWindow, + program_buffer: int = 1024000 +): + try: + check_mail_thunder_install() + need_to_execute_list: list = ask_and_get_dir_files_as_list(main_window) + if need_to_execute_list is not None and isinstance(need_to_execute_list, list) and len(need_to_execute_list) > 0: + for execute_file in need_to_execute_list: + with open(execute_file, "r+") as test_script_json: + call_web_runner_test_with_send( + main_window, + test_script_json.read(), + program_buffer + ) + except Exception as error: + print(repr(error), file=sys.stderr) diff --git a/integration_testing_environment/utils/test_executor/check_mail_thunder.py b/integration_testing_environment/utils/test_executor/check_mail_thunder.py deleted file mode 100644 index f2727bc..0000000 --- a/integration_testing_environment/utils/test_executor/check_mail_thunder.py +++ /dev/null @@ -1,10 +0,0 @@ -from integration_testing_environment.utils.exception.exception_tags import not_install_exception -from integration_testing_environment.utils.exception.exceptions import ITETestExecutorException -from integration_testing_environment.utils.manager.package_manager.package_manager_class import package_manager - - -def check_mail_thunder_install(): - if package_manager.installed_package_dict.get("je_mail_thunder", None) is None: - raise ITETestExecutorException( - not_install_exception + " je_mail_thunder" - ) diff --git a/pyproject.toml b/pyproject.toml index 522795f..4e37200 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,18 +1,18 @@ -# Rename to build stable version -# This is stable version +# Rename to dev version +# This is dev version [build-system] requires = ["setuptools>=61.0"] build-backend = "setuptools.build_meta" [project] -name = "integration_testing_environment" -version = "0.0.21" +name = "automation_editor_dev" +version = "0.0.2" authors = [ { name = "JE-Chen", email = "zenmailman@gmail.com" }, ] -description = "Integration testing environment for WEB Testing、GUI Testing、API Testing、Load & Stress Testing" +description = "Automation Editor for GUI, WEB, API, Load Automation" readme = { file = "README.md", content-type = "text/markdown" } -requires-python = ">=3.7" +requires-python = ">=3.8" license = { text = "MIT" } dependencies = [ "je-editor", "je_auto_control", "je_web_runner", diff --git a/dev.toml b/stable.toml similarity index 71% rename from dev.toml rename to stable.toml index 33bcf5f..947a780 100644 --- a/dev.toml +++ b/stable.toml @@ -1,18 +1,18 @@ -# Rename to dev version -# This is dev version +# Rename to build stable version +# This is stable version [build-system] requires = ["setuptools>=61.0"] build-backend = "setuptools.build_meta" [project] -name = "integration_testing_environment_dev" -version = "0.0.22" +name = "automation_editor" +version = "0.0.2" authors = [ { name = "JE-Chen", email = "zenmailman@gmail.com" }, ] -description = "Integration testing environment for WEB Testing、GUI Testing、API Testing、Load & Stress Testing" +description = "Automation Editor for GUI, WEB, API, Load Automation" readme = { file = "README.md", content-type = "text/markdown" } -requires-python = ">=3.7" +requires-python = ">=3.8" license = { text = "MIT" } dependencies = [ "je-editor", "je_auto_control", "je_web_runner", @@ -34,7 +34,7 @@ full_extension = [ ] [project.urls] -"Homepage" = "https://github.com/JE-Chen/Integration-testing-environment" +"Homepage" = "https://github.com/Integrated-Testing-Environment/AutomationEditor" [tool.setuptools.packages] find = { namespaces = false } \ No newline at end of file diff --git a/test/unit_test/open_extend_test/open_extend_ui_test.py b/test/unit_test/open_extend_test/open_extend_ui_test.py index 5d225e2..625b395 100644 --- a/test/unit_test/open_extend_test/open_extend_ui_test.py +++ b/test/unit_test/open_extend_test/open_extend_ui_test.py @@ -1,4 +1,4 @@ -from integration_testing_environment import start_editor +from automation_editor import start_editor start_editor()