testrail-runs.t 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. use strict;
  2. use warnings;
  3. use Test::More 'tests' => 12;
  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. #TODO check configs for real next time
  29. @args = ($^X,qw{bin/testrail-runs --apiurl http://testrail.local --user "test@fake.fake" --password "fake" -j "TestProject" --mock --config testConfig --config eee});
  30. $out = `@args`;
  31. is($? >> 8, 0, "Exit code OK looking for runs with passes");
  32. chomp $out;
  33. is($out,'',"Gets no run correctly when filtering by unassigned config");
  34. #help options
  35. @args = ($^X,qw{bin/testrail-runs --help});
  36. $out = `@args`;
  37. is($? >> 8, 0, "Exit code OK looking for help");
  38. like($out,qr/encoding of arguments/i,"Help output OK");