Skip to content

Strengthen tests for captured script conditions and output #308

Open

Description

@bms63

Description

The current tests only check that the captured warnings, errors, messages, output, and result fields are non-NULL. That confirms fields were populated, but not that the right content was captured or that it was assigned to the right field.

Where: logrx/tests/testthat/test-utils.R, tests for run_safely_loudly() around lines 118–143.

Improve these tests so they clearly describe and verify what happens when a script produces output, messages, warnings, and an error. The existing fixtures in /home/runner/work/logrx/logrx/tests/testthat/ref/safely_loudly_test_file.R and /home/runner/work/logrx/logrx/tests/testthat/ref/safely_loudly_test_file_result.R can help.

Definition of done

  • Tests compare captured fields against meaningful expected values or distinctive fixture text, rather than only checking for non-NULL.
  • The tests verify that output, messages, warnings, and errors are recorded in their respective fields.
  • The result test checks the captured result’s value or structure.
  • Test names make the behavior under test clear.
  • Relevant tests pass.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions