testrail-runs.t 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. use strict;
  2. use warnings;
  3. use Test::More 'tests' => 14;
  4. #check status filters
  5. my @args = ($^X,qw{bin/testrail-runs --apiurl http://testrail.local --user "test@fake.fake" --password "fake" -j "TestProject" --mock});
  6. my $out = `@args`;
  7. is($? >> 8, 0, "Exit code OK looking for runs with passes");
  8. chomp $out;
  9. like($out,qr/^OtherOtherSuite\nTestingSuite\nFinalRun\nlockRun$/,"Gets run correctly looking for passes");
  10. #check LIFO sort
  11. @args = ($^X,qw{bin/testrail-runs --apiurl http://testrail.local --user "test@fake.fake" --password "fake" -j "TestProject" --lifo --mock});
  12. $out = `@args`;
  13. is($? >> 8, 0, "Exit code OK looking for runs with passes");
  14. chomp $out;
  15. like($out,qr/^lockRun\nTestingSuite\nFinalRun\nOtherOtherSuite$/,"LIFO sort works");
  16. #check milesort
  17. @args = ($^X,qw{bin/testrail-runs --apiurl http://testrail.local --user "test@fake.fake" --password "fake" -j "TestProject" --milesort --mock});
  18. $out = `@args`;
  19. is($? >> 8, 0, "Exit code OK looking for runs with passes");
  20. chomp $out;
  21. like($out,qr/^TestingSuite\nFinalRun\nlockRun\nOtherOtherSuite$/,"milesort works");
  22. #check status filters
  23. @args = ($^X,qw{bin/testrail-runs --apiurl http://testrail.local --user "test@fake.fake" --password "fake" -j "TestProject" --mock --status passed});
  24. $out = `@args`;
  25. is($? >> 8, 0, "Exit code OK looking for runs with passes, which should fail to return results");
  26. chomp $out;
  27. is($out,'',"Gets no runs correctly looking for passes");
  28. @args = ($^X,qw{bin/testrail-runs --apiurl http://testrail.local --user "test@fake.fake" --password "fake" -j "CRUSH ALL HUMANS" --mock --status passed});
  29. $out = `@args`;
  30. is($? >> 8, 0, "Exit code OK looking for runs with passes");
  31. chomp $out;
  32. like($out,qr/SEND T-1000 INFILTRATION UNITS BACK IN TIME$/,"Gets run correctly looking for passes");
  33. #TODO check configs for real next time
  34. @args = ($^X,qw{bin/testrail-runs --apiurl http://testrail.local --user "test@fake.fake" --password "fake" -j "TestProject" --mock --config testConfig});
  35. $out = `@args`;
  36. is($? >> 8, 0, "Exit code OK looking for runs with passes");
  37. chomp $out;
  38. is($out,'',"Gets no run correctly when filtering by unassigned config");
  39. #help options
  40. @args = ($^X,qw{bin/testrail-runs --help});
  41. $out = `@args`;
  42. is($? >> 8, 0, "Exit code OK looking for help");
  43. like($out,qr/encoding of arguments/i,"Help output OK");