Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add basic integration tests for all normally-accessed pages #152

Open
moseshll opened this issue Apr 8, 2024 · 0 comments
Open

Add basic integration tests for all normally-accessed pages #152

moseshll opened this issue Apr 8, 2024 · 0 comments
Labels
test coverage Increase test coverage

Comments

@moseshll
Copy link
Collaborator

moseshll commented Apr 8, 2024

CGI::Test would be the obvious starting point but in order to collect coverage stats the CGI should not be run in a child process. This is hacky but simple: given a $url fragment like 'p=review' we can do something like

  local $ENV{QUERY_STRING} = $url;
  local $ENV{REQUEST_METHOD} = 'GET';
  local $ENV{GATEWAY_INTERFACE} = '1';
  chdir "$ENV{SDRROOT}/crms/cgi";
  my ($stdout, $stderr) = Capture::Tiny::capture {
    eval {
      do './crms';
    };
    ok(!$@, "no error with $url");
  };
@moseshll moseshll added the test coverage Increase test coverage label Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test coverage Increase test coverage
Projects
None yet
Development

No branches or pull requests

1 participant