testrail-cases.t 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. use strict;
  2. use warnings;
  3. use FindBin;
  4. use lib $FindBin::Bin.'/../bin';
  5. require 'testrail-cases';
  6. use Test::More "tests" => 6;
  7. use IO::CaptureOutput qw{capture};
  8. #check plan mode
  9. my @args = (qw{-j TestProject -t}, 'HAMBURGER-IZE HUMANITY', qw{-d t --mock --test --extension .test});
  10. my ($out,$code) = TestRail::Bin::Cases::run(@args);
  11. is($code, 0, "Exit code OK running add, update, orphans");
  12. chomp $out;
  13. like($out,qr/fake\.test/,"Shows existing tests by default");
  14. @args = (qw{-j TestProject -t}, 'HAMBURGER-IZE HUMANITY', qw{-d t --mock -o --extension .test});
  15. ($out,$code) = TestRail::Bin::Cases::run(@args);
  16. chomp $out;
  17. like($out,qr/nothere\.test/,"Shows orphan tests");
  18. @args = (qw{-j TestProject -t}, 'HAMBURGER-IZE HUMANITY', qw{-d t --mock -m --extension .test});
  19. ($out,$code) = TestRail::Bin::Cases::run(@args);
  20. chomp $out;
  21. like($out,qr/t\/skipall\.test/,"Shows missing tests");
  22. #Verify no-match returns non path
  23. @args = qw{--help};
  24. $0 = $FindBin::Bin.'/../bin/testrail-cases';
  25. (undef,$code) = capture {TestRail::Bin::Cases::run(@args)} \$out, \$out;
  26. is($code, 0, "Exit code OK asking for help");
  27. like($out,qr/encoding of arguments/i,"Help output OK");