drun 7.2.2__tar.gz → 7.2.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. {drun-7.2.2 → drun-7.2.5}/PKG-INFO +78 -76
  2. {drun-7.2.2 → drun-7.2.5}/README.md +76 -75
  3. {drun-7.2.2 → drun-7.2.5}/drun/__init__.py +1 -1
  4. {drun-7.2.2 → drun-7.2.5}/drun/cli.py +626 -195
  5. {drun-7.2.2 → drun-7.2.5}/drun/commands/run.py +282 -65
  6. {drun-7.2.2 → drun-7.2.5}/drun/loader/hooks.py +3 -3
  7. {drun-7.2.2 → drun-7.2.5}/drun/loader/yaml_loader.py +2 -0
  8. {drun-7.2.2 → drun-7.2.5}/drun/models/step.py +27 -0
  9. {drun-7.2.2 → drun-7.2.5}/drun/runner/invoke.py +119 -52
  10. {drun-7.2.2 → drun-7.2.5}/drun/scaffolds/templates.py +6 -6
  11. {drun-7.2.2 → drun-7.2.5}/drun.egg-info/PKG-INFO +78 -76
  12. {drun-7.2.2 → drun-7.2.5}/drun.egg-info/SOURCES.txt +2 -0
  13. {drun-7.2.2 → drun-7.2.5}/drun.egg-info/requires.txt +1 -0
  14. drun-7.2.5/drun.egg-info/top_level.txt +2 -0
  15. {drun-7.2.2 → drun-7.2.5}/pyproject.toml +2 -1
  16. drun-7.2.5/tests/test_cli_help_width.py +120 -0
  17. drun-7.2.5/tests/test_invoke_case_selection.py +302 -0
  18. {drun-7.2.2 → drun-7.2.5}/tests/test_run_outputs.py +449 -25
  19. drun-7.2.2/drun.egg-info/top_level.txt +0 -1
  20. {drun-7.2.2 → drun-7.2.5}/LICENSE +0 -0
  21. {drun-7.2.2 → drun-7.2.5}/drun/commands/__init__.py +0 -0
  22. {drun-7.2.2 → drun-7.2.5}/drun/commands/check.py +0 -0
  23. {drun-7.2.2 → drun-7.2.5}/drun/commands/fix.py +0 -0
  24. {drun-7.2.2 → drun-7.2.5}/drun/commands/tags.py +0 -0
  25. {drun-7.2.2 → drun-7.2.5}/drun/db/__init__.py +0 -0
  26. {drun-7.2.2 → drun-7.2.5}/drun/db/database_proxy.py +0 -0
  27. {drun-7.2.2 → drun-7.2.5}/drun/db/generate_mysql_config.py +0 -0
  28. {drun-7.2.2 → drun-7.2.5}/drun/engine/__init__.py +0 -0
  29. {drun-7.2.2 → drun-7.2.5}/drun/engine/http.py +0 -0
  30. {drun-7.2.2 → drun-7.2.5}/drun/engine/request_files.py +0 -0
  31. {drun-7.2.2 → drun-7.2.5}/drun/exporters/curl.py +0 -0
  32. {drun-7.2.2 → drun-7.2.5}/drun/exporters/snippet.py +0 -0
  33. {drun-7.2.2 → drun-7.2.5}/drun/extensions.py +0 -0
  34. {drun-7.2.2 → drun-7.2.5}/drun/importers/base.py +0 -0
  35. {drun-7.2.2 → drun-7.2.5}/drun/importers/curl.py +0 -0
  36. {drun-7.2.2 → drun-7.2.5}/drun/importers/har.py +0 -0
  37. {drun-7.2.2 → drun-7.2.5}/drun/importers/openapi.py +0 -0
  38. {drun-7.2.2 → drun-7.2.5}/drun/importers/postman.py +0 -0
  39. {drun-7.2.2 → drun-7.2.5}/drun/loader/__init__.py +0 -0
  40. {drun-7.2.2 → drun-7.2.5}/drun/loader/collector.py +0 -0
  41. {drun-7.2.2 → drun-7.2.5}/drun/loader/env.py +0 -0
  42. {drun-7.2.2 → drun-7.2.5}/drun/models/case.py +0 -0
  43. {drun-7.2.2 → drun-7.2.5}/drun/models/config.py +0 -0
  44. {drun-7.2.2 → drun-7.2.5}/drun/models/report.py +0 -0
  45. {drun-7.2.2 → drun-7.2.5}/drun/models/request.py +0 -0
  46. {drun-7.2.2 → drun-7.2.5}/drun/models/validators.py +0 -0
  47. {drun-7.2.2 → drun-7.2.5}/drun/notifier/__init__.py +0 -0
  48. {drun-7.2.2 → drun-7.2.5}/drun/notifier/base.py +0 -0
  49. {drun-7.2.2 → drun-7.2.5}/drun/notifier/dingtalk.py +0 -0
  50. {drun-7.2.2 → drun-7.2.5}/drun/notifier/emailer.py +0 -0
  51. {drun-7.2.2 → drun-7.2.5}/drun/notifier/feishu.py +0 -0
  52. {drun-7.2.2 → drun-7.2.5}/drun/notifier/format.py +0 -0
  53. {drun-7.2.2 → drun-7.2.5}/drun/reporter/__init__.py +0 -0
  54. {drun-7.2.2 → drun-7.2.5}/drun/reporter/allure_reporter.py +0 -0
  55. {drun-7.2.2 → drun-7.2.5}/drun/reporter/html_reporter.py +0 -0
  56. {drun-7.2.2 → drun-7.2.5}/drun/reporter/json_reporter.py +0 -0
  57. {drun-7.2.2 → drun-7.2.5}/drun/runner/__init__.py +0 -0
  58. {drun-7.2.2 → drun-7.2.5}/drun/runner/asserting.py +0 -0
  59. {drun-7.2.2 → drun-7.2.5}/drun/runner/assertions.py +0 -0
  60. {drun-7.2.2 → drun-7.2.5}/drun/runner/extractors.py +0 -0
  61. {drun-7.2.2 → drun-7.2.5}/drun/runner/hooks.py +0 -0
  62. {drun-7.2.2 → drun-7.2.5}/drun/runner/runner.py +0 -0
  63. {drun-7.2.2 → drun-7.2.5}/drun/scaffolds/__init__.py +0 -0
  64. {drun-7.2.2 → drun-7.2.5}/drun/server/__init__.py +0 -0
  65. {drun-7.2.2 → drun-7.2.5}/drun/server/app.py +0 -0
  66. {drun-7.2.2 → drun-7.2.5}/drun/server/database.py +0 -0
  67. {drun-7.2.2 → drun-7.2.5}/drun/server/scanner.py +0 -0
  68. {drun-7.2.2 → drun-7.2.5}/drun/server/services.py +0 -0
  69. {drun-7.2.2 → drun-7.2.5}/drun/server/templates/detail.html +0 -0
  70. {drun-7.2.2 → drun-7.2.5}/drun/server/templates/index.html +0 -0
  71. {drun-7.2.2 → drun-7.2.5}/drun/templating/__init__.py +0 -0
  72. {drun-7.2.2 → drun-7.2.5}/drun/templating/builtins.py +0 -0
  73. {drun-7.2.2 → drun-7.2.5}/drun/templating/compat.py +0 -0
  74. {drun-7.2.2 → drun-7.2.5}/drun/templating/context.py +0 -0
  75. {drun-7.2.2 → drun-7.2.5}/drun/templating/engine.py +0 -0
  76. {drun-7.2.2 → drun-7.2.5}/drun/utils/__init__.py +0 -0
  77. {drun-7.2.2 → drun-7.2.5}/drun/utils/config.py +0 -0
  78. {drun-7.2.2 → drun-7.2.5}/drun/utils/curl.py +0 -0
  79. {drun-7.2.2 → drun-7.2.5}/drun/utils/data_exporter.py +0 -0
  80. {drun-7.2.2 → drun-7.2.5}/drun/utils/env_writer.py +0 -0
  81. {drun-7.2.2 → drun-7.2.5}/drun/utils/errors.py +0 -0
  82. {drun-7.2.2 → drun-7.2.5}/drun/utils/logging.py +0 -0
  83. {drun-7.2.2 → drun-7.2.5}/drun/utils/mask.py +0 -0
  84. {drun-7.2.2 → drun-7.2.5}/drun/utils/timeit.py +0 -0
  85. {drun-7.2.2 → drun-7.2.5}/drun.egg-info/dependency_links.txt +0 -0
  86. {drun-7.2.2 → drun-7.2.5}/drun.egg-info/entry_points.txt +0 -0
  87. {drun-7.2.2 → drun-7.2.5}/setup.cfg +0 -0
  88. {drun-7.2.2 → drun-7.2.5}/tests/test_binary_response.py +0 -0
  89. {drun-7.2.2 → drun-7.2.5}/tests/test_request_files.py +0 -0
  90. {drun-7.2.2 → drun-7.2.5}/tests/test_run_env.py +0 -0
  91. {drun-7.2.2 → drun-7.2.5}/tests/test_template_engine.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: drun
3
- Version: 7.2.2
3
+ Version: 7.2.5
4
4
  Summary: Easy-to-use API testing with DevOps automation support
5
5
  Author: Drun Team
6
6
  Requires-Python: >=3.10
@@ -17,6 +17,7 @@ Requires-Dist: uvicorn>=0.24
17
17
  Requires-Dist: Faker>=24.0
18
18
  Provides-Extra: dev
19
19
  Requires-Dist: build>=1.2; extra == "dev"
20
+ Requires-Dist: pytest>=9.0.2; extra == "dev"
20
21
  Dynamic: license-file
21
22
 
22
23
  # Drun — Modern HTTP API Testing Framework
@@ -124,7 +125,7 @@ my-api-test/
124
125
  ├── logs/ # Log file output
125
126
  ├── snippets/ # Auto-generated code snippets
126
127
  ├── .env # Environment variables
127
- ├── drun_hooks.py # Custom Hooks functions
128
+ ├── Dhook.py # Custom Hooks functions
128
129
  └── .gitignore # Git ignore rules
129
130
  ```
130
131
 
@@ -177,17 +178,17 @@ steps:
177
178
 
178
179
  ```bash
179
180
  # Run single test (with or without .yaml extension)
180
- drun run testcases/test_user_api.yaml --env dev
181
- drun run test_user_api --env dev
181
+ drun run testcases/test_user_api.yaml -env dev
182
+ drun run test_user_api -env dev
182
183
 
183
184
  # Run with HTML report
184
- drun run test_user_api --env dev --html reports/report.html
185
+ drun run test_user_api -env dev -html reports/report.html
185
186
 
186
187
  # Run with tag filtering
187
- drun run testcases --env dev -k "smoke and not slow"
188
+ drun run testcases -env dev -k "smoke and not slow"
188
189
 
189
190
  # Run test suite
190
- drun run testsuite_e2e --env dev
191
+ drun run testsuite_e2e -env dev
191
192
  ```
192
193
 
193
194
  ## Core Concepts
@@ -457,7 +458,7 @@ Automatically generate executable Shell and Python scripts from test steps:
457
458
 
458
459
  ```bash
459
460
  # Run test - code snippets are generated automatically
460
- $ drun run test_login --env dev
461
+ $ drun run test_login -env dev
461
462
 
462
463
  2025-11-24 14:23:18.551 | INFO | [CASE] Total: 1 Passed: 1 Failed: 0 Skipped: 0
463
464
  2025-11-24 14:23:18.553 | INFO | [CASE] HTML report written to reports/report.html
@@ -469,21 +470,21 @@ $ drun run test_login --env dev
469
470
  **CLI Options:**
470
471
  ```bash
471
472
  # Disable snippet generation
472
- $ drun run test_api --env dev --no-snippet
473
+ $ drun run test_api -env dev -snippet off
473
474
 
474
475
  # Generate only Python scripts
475
- $ drun run test_api --env dev --snippet-lang python
476
+ $ drun run test_api -env dev -snippet python
476
477
 
477
478
  # Generate only curl scripts
478
- $ drun run test_api --env dev --snippet-lang curl
479
+ $ drun run test_api -env dev -snippet curl
479
480
 
480
481
  # Custom output directory
481
- $ drun run test_api --env dev --snippet-output exports/
482
+ $ drun run test_api -env dev -snippet-output exports/
482
483
  ```
483
484
 
484
485
  ### Custom Hooks
485
486
 
486
- **drun_hooks.py**
487
+ **Dhook.py**
487
488
  ```python
488
489
  import hmac
489
490
  import hashlib
@@ -537,10 +538,10 @@ steps:
537
538
  drun server
538
539
 
539
540
  # Custom port and options
540
- drun server --port 8080 --no-open
541
+ drun server -port 8080 -headless
541
542
 
542
543
  # Development mode with auto-reload
543
- drun server --reload
544
+ drun server -reload
544
545
 
545
546
  # Server will be accessible at http://0.0.0.0:8080
546
547
  # Features:
@@ -556,48 +557,48 @@ drun server --reload
556
557
 
557
558
  ```bash
558
559
  # Basic execution
559
- drun run PATH --env <env_name>
560
+ drun run PATH -env <env_name>
560
561
 
561
562
  # Smart file discovery - extension optional
562
- drun run test_api_health --env dev # Finds test_api_health.yaml or .yml
563
- drun run testcases/test_user --env dev # Supports paths without extension
564
- drun run test_api_health.yaml --env dev # Traditional format still works
563
+ drun run test_api_health -env dev # Finds test_api_health.yaml or .yml
564
+ drun run testcases/test_user -env dev # Supports paths without extension
565
+ drun run test_api_health.yaml -env dev # Traditional format still works
565
566
 
566
567
  # Temporary single-file run outside scaffold
567
568
  # Default output: only one log file in current directory
568
- drun run ./test_api_health.yaml --env-file ./demo.env
569
+ drun run ./test_api_health.yaml -env-file ./demo.env
569
570
 
570
571
  # With more options
571
572
  drun run testcases/ \
572
- --env staging \
573
+ -env staging \
573
574
  -k "smoke and not slow" \
574
- --vars api_key=secret \
575
- --html reports/report.html \
576
- --report reports/results.json \
577
- --allure-results allure-results \
578
- --mask-secrets \
579
- --failfast
575
+ -vars api_key=secret \
576
+ -html reports/report.html \
577
+ -report reports/results.json \
578
+ -allure-results allure-results \
579
+ -secrets mask \
580
+ -failfast
580
581
  ```
581
582
 
582
583
  **Options:**
583
- - `--env NAME`: Optional named environment; prefers `.env.<name>` and merges named env config if present
584
- - `--env-file FILE`: Explicit environment file path; higher priority than `--env` and default `.env`
584
+ - `-env NAME`: Optional named environment; prefers `.env.<name>` and merges named env config if present
585
+ - `-env-file FILE`: Explicit environment file path; higher priority than `-env` and default `.env`
585
586
  - `-k TAG_EXPR`: Filter by tags (e.g., `smoke and not slow`)
586
- - `--vars k=v`: Override variables from CLI
587
- - `--html FILE`: Generate HTML report (temporary single-file runs do not generate one by default)
588
- - `--report FILE`: Generate JSON report
589
- - `--allure-results DIR`: Generate Allure results
590
- - `--mask-secrets`: Mask sensitive data in logs/reports
591
- - `--reveal-secrets`: Show sensitive data (default for local runs)
592
- - `--response-headers`: Log response headers
593
- - `--failfast`: Stop on first failure
594
- - `--log-level LEVEL`: Set log level (DEBUG, INFO, WARNING, ERROR)
595
- - `--log-file FILE`: Write logs to file (temporary single-file runs otherwise default to `./<yaml>-<ts>.log`)
596
- - `--notify CHANNELS`: Enable notifications (feishu, dingtalk, email)
597
- - `--notify-only POLICY`: Notification policy (always, failed, passed)
598
- - `--no-snippet`: Disable code snippet generation (temporary single-file runs are already disabled by default)
599
- - `--snippet-output DIR`: Custom output directory for snippets
600
- - `--snippet-lang LANG`: Generate snippets in specific language: all|curl|python
587
+ - `-vars k=v`: Override variables from CLI
588
+ - `-html FILE`: Generate HTML report (temporary single-file runs do not generate one by default)
589
+ - `-report FILE`: Generate JSON report
590
+ - `-allure-results DIR`: Generate Allure results
591
+ - `-secrets mask`: Mask sensitive data in logs/reports
592
+ - `-secrets plain`: Show sensitive data (default for local runs)
593
+ - `-response-headers`: Log response headers
594
+ - `-failfast`: Stop on first failure
595
+ - `-log-level LEVEL`: Set log level (DEBUG, INFO, WARNING, ERROR)
596
+ - `-log-file FILE`: Write logs to file (temporary single-file runs otherwise default to `./<yaml>-<ts>.log`)
597
+ - `-notify CHANNELS`: Enable notifications (feishu, dingtalk, email)
598
+ - `-notify-only POLICY`: Notification policy (always, failed, passed)
599
+ - `-snippet off`: Disable code snippet generation (temporary single-file runs are already disabled by default)
600
+ - `-snippet-output DIR`: Custom output directory for snippets
601
+ - `-snippet MODE`: Snippet mode: off|all|curl|python
601
602
 
602
603
  ### Format Conversion
603
604
 
@@ -677,7 +678,7 @@ drun --version
677
678
  ### HTML Reports
678
679
 
679
680
  ```bash
680
- drun run testcases --env dev --html reports/report.html --mask-secrets
681
+ drun run testcases -env dev -html reports/report.html -secrets mask
681
682
  ```
682
683
 
683
684
  **Features:**
@@ -691,7 +692,7 @@ drun run testcases --env dev --html reports/report.html --mask-secrets
691
692
  ### JSON Reports
692
693
 
693
694
  ```bash
694
- drun run testcases --env dev --report reports/results.json
695
+ drun run testcases -env dev -report reports/results.json
695
696
  ```
696
697
 
697
698
  **Structure:**
@@ -719,7 +720,7 @@ drun run testcases --env dev --report reports/results.json
719
720
 
720
721
  ```bash
721
722
  # Generate Allure results
722
- drun run testcases --env dev --allure-results allure-results
723
+ drun run testcases -env dev -allure-results allure-results
723
724
 
724
725
  # View Allure report
725
726
  allure serve allure-results
@@ -753,10 +754,10 @@ NOTIFY_ATTACH_HTML=true
753
754
 
754
755
  **Usage:**
755
756
  ```bash
756
- drun run testcases --env dev \
757
- --notify feishu,email \
758
- --notify-only failed \
759
- --notify-attach-html
757
+ drun run testcases -env dev \
758
+ -notify feishu,email \
759
+ -notify-only failed \
760
+ -notify-attach-html
760
761
  ```
761
762
 
762
763
  ## Architecture
@@ -873,7 +874,7 @@ my-api-test/
873
874
  │ ├── staging.yaml
874
875
  │ └── prod.yaml
875
876
  ├── .env # Local environment
876
- ├── drun_hooks.py # Custom functions
877
+ ├── Dhook.py # Custom functions
877
878
  ├── .gitignore # Exclude .env, logs, reports
878
879
  └── README.md
879
880
  ```
@@ -881,12 +882,12 @@ my-api-test/
881
882
  ### Environment Management
882
883
 
883
884
  ```bash
884
- # .env.dev (used with --env dev)
885
+ # .env.dev (used with -env dev)
885
886
  BASE_URL=https://api.dev.example.com
886
887
  API_KEY=dev-key-here
887
888
  DB_HOST=localhost
888
889
 
889
- # .env.staging (used with --env staging)
890
+ # .env.staging (used with -env staging)
890
891
  BASE_URL=https://api.staging.example.com
891
892
  API_KEY=staging-key-here
892
893
  DB_HOST=staging-db.example.com
@@ -895,13 +896,13 @@ DB_HOST=staging-db.example.com
895
896
  **Multi-environment:**
896
897
  ```bash
897
898
  # Development
898
- drun run testsuites/testsuite_smoke.yaml --env dev
899
+ drun run testsuites/testsuite_smoke.yaml -env dev
899
900
 
900
901
  # Staging
901
- drun run testsuites/testsuite_regression.yaml --env staging
902
+ drun run testsuites/testsuite_regression.yaml -env staging
902
903
 
903
904
  # Production (smoke tests only)
904
- drun run testsuites/testsuite_smoke.yaml --env prod
905
+ drun run testsuites/testsuite_smoke.yaml -env prod
905
906
  ```
906
907
 
907
908
  ### Naming Conventions
@@ -931,9 +932,9 @@ tags: [db, data-verify] # Database validation
931
932
 
932
933
  **Filtering:**
933
934
  ```bash
934
- drun run testcases --env dev -k "smoke" # Smoke tests only
935
- drun run testcases --env dev -k "regression and not slow" # Fast regression
936
- drun run testcases --env dev -k "critical or e2e" # Critical + E2E
935
+ drun run testcases -env dev -k "smoke" # Smoke tests only
936
+ drun run testcases -env dev -k "regression and not slow" # Fast regression
937
+ drun run testcases -env dev -k "critical or e2e" # Critical + E2E
937
938
  ```
938
939
 
939
940
  ### CI/CD Integration
@@ -964,19 +965,19 @@ jobs:
964
965
 
965
966
  - name: Run Smoke Tests
966
967
  run: |
967
- drun run testsuites/testsuite_smoke.yaml --env ci \
968
- --html reports/smoke.html \
969
- --report reports/smoke.json \
970
- --mask-secrets \
971
- --failfast
968
+ drun run testsuites/testsuite_smoke.yaml -env ci \
969
+ -html reports/smoke.html \
970
+ -report reports/smoke.json \
971
+ -secrets mask \
972
+ -failfast
972
973
 
973
974
  - name: Run Regression Tests
974
975
  if: github.event_name == 'pull_request'
975
976
  run: |
976
- drun run testsuites/testsuite_regression.yaml --env ci \
977
- --html reports/regression.html \
978
- --report reports/regression.json \
979
- --mask-secrets
977
+ drun run testsuites/testsuite_regression.yaml -env ci \
978
+ -html reports/regression.html \
979
+ -report reports/regression.json \
980
+ -secrets mask
980
981
 
981
982
  - name: Upload Reports
982
983
  uses: actions/upload-artifact@v3
@@ -989,9 +990,9 @@ jobs:
989
990
  if: failure()
990
991
  run: |
991
992
  echo "FEISHU_WEBHOOK=${{ secrets.FEISHU_WEBHOOK }}" >> .env.ci
992
- drun run testsuites/testsuite_smoke.yaml --env ci \
993
- --notify feishu \
994
- --notify-only failed
993
+ drun run testsuites/testsuite_smoke.yaml -env ci \
994
+ -notify feishu \
995
+ -notify-only failed
995
996
  ```
996
997
 
997
998
  ## Advanced Topics
@@ -1114,7 +1115,7 @@ steps:
1114
1115
 
1115
1116
  ### Database Assertions
1116
1117
 
1117
- **drun_hooks.py:**
1118
+ **Dhook.py:**
1118
1119
  ```python
1119
1120
  import pymysql
1120
1121
 
@@ -1179,13 +1180,14 @@ steps:
1179
1180
  git clone https://github.com/Devliang24/drun.git
1180
1181
  cd drun
1181
1182
 
1182
- # Install development dependencies
1183
+ # Install development dependencies (includes pytest)
1183
1184
  pip install -e ".[dev]"
1184
1185
 
1185
1186
  # Validation commands for the current P0 baseline
1186
1187
  drun --version
1187
1188
  drun run --help
1188
1189
  drun server --help
1190
+ python -m pytest -q
1189
1191
  python -m build
1190
1192
  python -m drun.cli --version
1191
1193
  ```
@@ -1231,7 +1233,7 @@ python -m drun.cli --version
1231
1233
  - Automatic report scanning and indexing
1232
1234
  - SQLite-based report database
1233
1235
  - RESTful API for report management
1234
- - Command: `drun server --port 8080 --no-open`
1236
+ - Command: `drun server -port 8080 -headless`
1235
1237
  - **NEW**: Report list and detail pages with pagination
1236
1238
 
1237
1239
  ### v5.0.0 (2024-11-24) - Enhanced User Experience
@@ -1272,7 +1274,7 @@ MIT License - see [LICENSE](LICENSE) file for details.
1272
1274
  ## Tips
1273
1275
 
1274
1276
  - Use `drun check` before commits
1275
- - Enable `--mask-secrets` in CI/CD
1277
+ - Enable `-secrets mask` in CI/CD
1276
1278
  - Organize tests by module/feature
1277
1279
  - Use test suites for complex workflows
1278
1280
  - Tag tests for easy filtering
@@ -103,7 +103,7 @@ my-api-test/
103
103
  ├── logs/ # Log file output
104
104
  ├── snippets/ # Auto-generated code snippets
105
105
  ├── .env # Environment variables
106
- ├── drun_hooks.py # Custom Hooks functions
106
+ ├── Dhook.py # Custom Hooks functions
107
107
  └── .gitignore # Git ignore rules
108
108
  ```
109
109
 
@@ -156,17 +156,17 @@ steps:
156
156
 
157
157
  ```bash
158
158
  # Run single test (with or without .yaml extension)
159
- drun run testcases/test_user_api.yaml --env dev
160
- drun run test_user_api --env dev
159
+ drun run testcases/test_user_api.yaml -env dev
160
+ drun run test_user_api -env dev
161
161
 
162
162
  # Run with HTML report
163
- drun run test_user_api --env dev --html reports/report.html
163
+ drun run test_user_api -env dev -html reports/report.html
164
164
 
165
165
  # Run with tag filtering
166
- drun run testcases --env dev -k "smoke and not slow"
166
+ drun run testcases -env dev -k "smoke and not slow"
167
167
 
168
168
  # Run test suite
169
- drun run testsuite_e2e --env dev
169
+ drun run testsuite_e2e -env dev
170
170
  ```
171
171
 
172
172
  ## Core Concepts
@@ -436,7 +436,7 @@ Automatically generate executable Shell and Python scripts from test steps:
436
436
 
437
437
  ```bash
438
438
  # Run test - code snippets are generated automatically
439
- $ drun run test_login --env dev
439
+ $ drun run test_login -env dev
440
440
 
441
441
  2025-11-24 14:23:18.551 | INFO | [CASE] Total: 1 Passed: 1 Failed: 0 Skipped: 0
442
442
  2025-11-24 14:23:18.553 | INFO | [CASE] HTML report written to reports/report.html
@@ -448,21 +448,21 @@ $ drun run test_login --env dev
448
448
  **CLI Options:**
449
449
  ```bash
450
450
  # Disable snippet generation
451
- $ drun run test_api --env dev --no-snippet
451
+ $ drun run test_api -env dev -snippet off
452
452
 
453
453
  # Generate only Python scripts
454
- $ drun run test_api --env dev --snippet-lang python
454
+ $ drun run test_api -env dev -snippet python
455
455
 
456
456
  # Generate only curl scripts
457
- $ drun run test_api --env dev --snippet-lang curl
457
+ $ drun run test_api -env dev -snippet curl
458
458
 
459
459
  # Custom output directory
460
- $ drun run test_api --env dev --snippet-output exports/
460
+ $ drun run test_api -env dev -snippet-output exports/
461
461
  ```
462
462
 
463
463
  ### Custom Hooks
464
464
 
465
- **drun_hooks.py**
465
+ **Dhook.py**
466
466
  ```python
467
467
  import hmac
468
468
  import hashlib
@@ -516,10 +516,10 @@ steps:
516
516
  drun server
517
517
 
518
518
  # Custom port and options
519
- drun server --port 8080 --no-open
519
+ drun server -port 8080 -headless
520
520
 
521
521
  # Development mode with auto-reload
522
- drun server --reload
522
+ drun server -reload
523
523
 
524
524
  # Server will be accessible at http://0.0.0.0:8080
525
525
  # Features:
@@ -535,48 +535,48 @@ drun server --reload
535
535
 
536
536
  ```bash
537
537
  # Basic execution
538
- drun run PATH --env <env_name>
538
+ drun run PATH -env <env_name>
539
539
 
540
540
  # Smart file discovery - extension optional
541
- drun run test_api_health --env dev # Finds test_api_health.yaml or .yml
542
- drun run testcases/test_user --env dev # Supports paths without extension
543
- drun run test_api_health.yaml --env dev # Traditional format still works
541
+ drun run test_api_health -env dev # Finds test_api_health.yaml or .yml
542
+ drun run testcases/test_user -env dev # Supports paths without extension
543
+ drun run test_api_health.yaml -env dev # Traditional format still works
544
544
 
545
545
  # Temporary single-file run outside scaffold
546
546
  # Default output: only one log file in current directory
547
- drun run ./test_api_health.yaml --env-file ./demo.env
547
+ drun run ./test_api_health.yaml -env-file ./demo.env
548
548
 
549
549
  # With more options
550
550
  drun run testcases/ \
551
- --env staging \
551
+ -env staging \
552
552
  -k "smoke and not slow" \
553
- --vars api_key=secret \
554
- --html reports/report.html \
555
- --report reports/results.json \
556
- --allure-results allure-results \
557
- --mask-secrets \
558
- --failfast
553
+ -vars api_key=secret \
554
+ -html reports/report.html \
555
+ -report reports/results.json \
556
+ -allure-results allure-results \
557
+ -secrets mask \
558
+ -failfast
559
559
  ```
560
560
 
561
561
  **Options:**
562
- - `--env NAME`: Optional named environment; prefers `.env.<name>` and merges named env config if present
563
- - `--env-file FILE`: Explicit environment file path; higher priority than `--env` and default `.env`
562
+ - `-env NAME`: Optional named environment; prefers `.env.<name>` and merges named env config if present
563
+ - `-env-file FILE`: Explicit environment file path; higher priority than `-env` and default `.env`
564
564
  - `-k TAG_EXPR`: Filter by tags (e.g., `smoke and not slow`)
565
- - `--vars k=v`: Override variables from CLI
566
- - `--html FILE`: Generate HTML report (temporary single-file runs do not generate one by default)
567
- - `--report FILE`: Generate JSON report
568
- - `--allure-results DIR`: Generate Allure results
569
- - `--mask-secrets`: Mask sensitive data in logs/reports
570
- - `--reveal-secrets`: Show sensitive data (default for local runs)
571
- - `--response-headers`: Log response headers
572
- - `--failfast`: Stop on first failure
573
- - `--log-level LEVEL`: Set log level (DEBUG, INFO, WARNING, ERROR)
574
- - `--log-file FILE`: Write logs to file (temporary single-file runs otherwise default to `./<yaml>-<ts>.log`)
575
- - `--notify CHANNELS`: Enable notifications (feishu, dingtalk, email)
576
- - `--notify-only POLICY`: Notification policy (always, failed, passed)
577
- - `--no-snippet`: Disable code snippet generation (temporary single-file runs are already disabled by default)
578
- - `--snippet-output DIR`: Custom output directory for snippets
579
- - `--snippet-lang LANG`: Generate snippets in specific language: all|curl|python
565
+ - `-vars k=v`: Override variables from CLI
566
+ - `-html FILE`: Generate HTML report (temporary single-file runs do not generate one by default)
567
+ - `-report FILE`: Generate JSON report
568
+ - `-allure-results DIR`: Generate Allure results
569
+ - `-secrets mask`: Mask sensitive data in logs/reports
570
+ - `-secrets plain`: Show sensitive data (default for local runs)
571
+ - `-response-headers`: Log response headers
572
+ - `-failfast`: Stop on first failure
573
+ - `-log-level LEVEL`: Set log level (DEBUG, INFO, WARNING, ERROR)
574
+ - `-log-file FILE`: Write logs to file (temporary single-file runs otherwise default to `./<yaml>-<ts>.log`)
575
+ - `-notify CHANNELS`: Enable notifications (feishu, dingtalk, email)
576
+ - `-notify-only POLICY`: Notification policy (always, failed, passed)
577
+ - `-snippet off`: Disable code snippet generation (temporary single-file runs are already disabled by default)
578
+ - `-snippet-output DIR`: Custom output directory for snippets
579
+ - `-snippet MODE`: Snippet mode: off|all|curl|python
580
580
 
581
581
  ### Format Conversion
582
582
 
@@ -656,7 +656,7 @@ drun --version
656
656
  ### HTML Reports
657
657
 
658
658
  ```bash
659
- drun run testcases --env dev --html reports/report.html --mask-secrets
659
+ drun run testcases -env dev -html reports/report.html -secrets mask
660
660
  ```
661
661
 
662
662
  **Features:**
@@ -670,7 +670,7 @@ drun run testcases --env dev --html reports/report.html --mask-secrets
670
670
  ### JSON Reports
671
671
 
672
672
  ```bash
673
- drun run testcases --env dev --report reports/results.json
673
+ drun run testcases -env dev -report reports/results.json
674
674
  ```
675
675
 
676
676
  **Structure:**
@@ -698,7 +698,7 @@ drun run testcases --env dev --report reports/results.json
698
698
 
699
699
  ```bash
700
700
  # Generate Allure results
701
- drun run testcases --env dev --allure-results allure-results
701
+ drun run testcases -env dev -allure-results allure-results
702
702
 
703
703
  # View Allure report
704
704
  allure serve allure-results
@@ -732,10 +732,10 @@ NOTIFY_ATTACH_HTML=true
732
732
 
733
733
  **Usage:**
734
734
  ```bash
735
- drun run testcases --env dev \
736
- --notify feishu,email \
737
- --notify-only failed \
738
- --notify-attach-html
735
+ drun run testcases -env dev \
736
+ -notify feishu,email \
737
+ -notify-only failed \
738
+ -notify-attach-html
739
739
  ```
740
740
 
741
741
  ## Architecture
@@ -852,7 +852,7 @@ my-api-test/
852
852
  │ ├── staging.yaml
853
853
  │ └── prod.yaml
854
854
  ├── .env # Local environment
855
- ├── drun_hooks.py # Custom functions
855
+ ├── Dhook.py # Custom functions
856
856
  ├── .gitignore # Exclude .env, logs, reports
857
857
  └── README.md
858
858
  ```
@@ -860,12 +860,12 @@ my-api-test/
860
860
  ### Environment Management
861
861
 
862
862
  ```bash
863
- # .env.dev (used with --env dev)
863
+ # .env.dev (used with -env dev)
864
864
  BASE_URL=https://api.dev.example.com
865
865
  API_KEY=dev-key-here
866
866
  DB_HOST=localhost
867
867
 
868
- # .env.staging (used with --env staging)
868
+ # .env.staging (used with -env staging)
869
869
  BASE_URL=https://api.staging.example.com
870
870
  API_KEY=staging-key-here
871
871
  DB_HOST=staging-db.example.com
@@ -874,13 +874,13 @@ DB_HOST=staging-db.example.com
874
874
  **Multi-environment:**
875
875
  ```bash
876
876
  # Development
877
- drun run testsuites/testsuite_smoke.yaml --env dev
877
+ drun run testsuites/testsuite_smoke.yaml -env dev
878
878
 
879
879
  # Staging
880
- drun run testsuites/testsuite_regression.yaml --env staging
880
+ drun run testsuites/testsuite_regression.yaml -env staging
881
881
 
882
882
  # Production (smoke tests only)
883
- drun run testsuites/testsuite_smoke.yaml --env prod
883
+ drun run testsuites/testsuite_smoke.yaml -env prod
884
884
  ```
885
885
 
886
886
  ### Naming Conventions
@@ -910,9 +910,9 @@ tags: [db, data-verify] # Database validation
910
910
 
911
911
  **Filtering:**
912
912
  ```bash
913
- drun run testcases --env dev -k "smoke" # Smoke tests only
914
- drun run testcases --env dev -k "regression and not slow" # Fast regression
915
- drun run testcases --env dev -k "critical or e2e" # Critical + E2E
913
+ drun run testcases -env dev -k "smoke" # Smoke tests only
914
+ drun run testcases -env dev -k "regression and not slow" # Fast regression
915
+ drun run testcases -env dev -k "critical or e2e" # Critical + E2E
916
916
  ```
917
917
 
918
918
  ### CI/CD Integration
@@ -943,19 +943,19 @@ jobs:
943
943
 
944
944
  - name: Run Smoke Tests
945
945
  run: |
946
- drun run testsuites/testsuite_smoke.yaml --env ci \
947
- --html reports/smoke.html \
948
- --report reports/smoke.json \
949
- --mask-secrets \
950
- --failfast
946
+ drun run testsuites/testsuite_smoke.yaml -env ci \
947
+ -html reports/smoke.html \
948
+ -report reports/smoke.json \
949
+ -secrets mask \
950
+ -failfast
951
951
 
952
952
  - name: Run Regression Tests
953
953
  if: github.event_name == 'pull_request'
954
954
  run: |
955
- drun run testsuites/testsuite_regression.yaml --env ci \
956
- --html reports/regression.html \
957
- --report reports/regression.json \
958
- --mask-secrets
955
+ drun run testsuites/testsuite_regression.yaml -env ci \
956
+ -html reports/regression.html \
957
+ -report reports/regression.json \
958
+ -secrets mask
959
959
 
960
960
  - name: Upload Reports
961
961
  uses: actions/upload-artifact@v3
@@ -968,9 +968,9 @@ jobs:
968
968
  if: failure()
969
969
  run: |
970
970
  echo "FEISHU_WEBHOOK=${{ secrets.FEISHU_WEBHOOK }}" >> .env.ci
971
- drun run testsuites/testsuite_smoke.yaml --env ci \
972
- --notify feishu \
973
- --notify-only failed
971
+ drun run testsuites/testsuite_smoke.yaml -env ci \
972
+ -notify feishu \
973
+ -notify-only failed
974
974
  ```
975
975
 
976
976
  ## Advanced Topics
@@ -1093,7 +1093,7 @@ steps:
1093
1093
 
1094
1094
  ### Database Assertions
1095
1095
 
1096
- **drun_hooks.py:**
1096
+ **Dhook.py:**
1097
1097
  ```python
1098
1098
  import pymysql
1099
1099
 
@@ -1158,13 +1158,14 @@ steps:
1158
1158
  git clone https://github.com/Devliang24/drun.git
1159
1159
  cd drun
1160
1160
 
1161
- # Install development dependencies
1161
+ # Install development dependencies (includes pytest)
1162
1162
  pip install -e ".[dev]"
1163
1163
 
1164
1164
  # Validation commands for the current P0 baseline
1165
1165
  drun --version
1166
1166
  drun run --help
1167
1167
  drun server --help
1168
+ python -m pytest -q
1168
1169
  python -m build
1169
1170
  python -m drun.cli --version
1170
1171
  ```
@@ -1210,7 +1211,7 @@ python -m drun.cli --version
1210
1211
  - Automatic report scanning and indexing
1211
1212
  - SQLite-based report database
1212
1213
  - RESTful API for report management
1213
- - Command: `drun server --port 8080 --no-open`
1214
+ - Command: `drun server -port 8080 -headless`
1214
1215
  - **NEW**: Report list and detail pages with pagination
1215
1216
 
1216
1217
  ### v5.0.0 (2024-11-24) - Enhanced User Experience
@@ -1251,7 +1252,7 @@ MIT License - see [LICENSE](LICENSE) file for details.
1251
1252
  ## Tips
1252
1253
 
1253
1254
  - Use `drun check` before commits
1254
- - Enable `--mask-secrets` in CI/CD
1255
+ - Enable `-secrets mask` in CI/CD
1255
1256
  - Organize tests by module/feature
1256
1257
  - Use test suites for complex workflows
1257
1258
  - Tag tests for easy filtering