Skip to content

test: add unit tests for keyword modules#473

Open
Dor-bl wants to merge 1 commit intoserhatbolsu:masterfrom
Dor-bl:feat/add-keyword-tests
Open

test: add unit tests for keyword modules#473
Dor-bl wants to merge 1 commit intoserhatbolsu:masterfrom
Dor-bl:feat/add-keyword-tests

Conversation

@Dor-bl
Copy link
Copy Markdown
Contributor

@Dor-bl Dor-bl commented Feb 1, 2026

  • Add tests for _keyevent.py (100% coverage)
  • Add tests for _runonfailure.py (81% coverage)
  • Add tests for _screenshot.py (100% coverage)
  • Add tests for _screenrecord.py (57% coverage)
  • Add tests for _waiting.py (100% coverage)

Improves overall test coverage from 33% to 39%

Implements

This pull request adds comprehensive unit tests for several internal keyword classes in the AppiumLibrary, significantly improving test coverage for key functionalities such as key events, run-on-failure behavior, screen recording, screenshots, and waiting mechanisms. The new tests use Python's unittest framework and extensive mocking to verify correct behavior under various scenarios, including edge cases and error handling.

New Unit Test Coverage:

  • Key Event Keywords:

    • Added tests for _KeyeventKeywords, covering press_keycode and long_press_keycode methods, including handling of meta states and string-to-int conversion.
  • Run-On-Failure Keywords:

    • Introduced tests for _RunOnFailureKeywords, verifying registration, state transitions, disabling, and error reporting logic for run-on-failure keywords.
  • Screen Recording Keywords:

    • Implemented tests for _ScreenrecordKeywords, checking start/stop behavior, time limits, output format handling, prevention of duplicate recordings, and error handling for missing sessions.
  • Screenshot Keywords:

    • Added tests for _ScreenshotKeywords, ensuring correct screenshot capture with and without filenames, file saving, fallback mechanisms, subdirectory handling, and HTML embedding.
  • Waiting Keywords:

    • Developed tests for _WaitingKeywords, covering sleep interval management, timeout formatting, and all major wait-until behaviors (element/text presence/absence), including error and edge cases.

- Add tests for _keyevent.py (100% coverage)
- Add tests for _runonfailure.py (81% coverage)
- Add tests for _screenshot.py (100% coverage)
- Add tests for _screenrecord.py (57% coverage)
- Add tests for _waiting.py (100% coverage)

Improves overall test coverage from 33% to 39%
@emanlove emanlove added enhancement Acknowledge Acknowledge within Release Notes needs review labels Feb 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Acknowledge Acknowledge within Release Notes enhancement needs review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants