testrail-report.t 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. use strict;
  2. use warnings;
  3. use Test::More 'tests' => 10;
  4. my @args = ($^X,qw{bin/testrail-report --apiurl http://testrail.local --user "test@fake.fake" --password "fake" --project "CRUSH ALL HUMANS" --run "SEND T-1000 INFILTRATION UNITS BACK IN TIME" --mock t/test_multiple_files.tap});
  5. my $out = `@args`;
  6. is($? >> 8, 0, "Exit code OK reported with multiple files");
  7. my $matches = () = $out =~ m/Reporting result of case/ig;
  8. is($matches,2,"Attempts to upload multiple times");
  9. @args = ($^X,qw{bin/testrail-report --apiurl http://testrail.local --user "test@fake.fake" --password "fake" --project "CRUSH ALL HUMANS" --run "SEND T-1000 INFILTRATION UNITS BACK IN TIME" --case-ok --mock t/test_multiple_files.tap});
  10. $out = `@args`;
  11. is($? >> 8, 0, "Exit code OK reported with multiple files (case-ok mode)");
  12. $matches = () = $out =~ m/Reporting result of case/ig;
  13. is($matches,4,"Attempts to upload multiple times (case-ok mode)");
  14. #Test version, case-ok
  15. @args = ($^X,qw{bin/testrail-report --apiurl http://testrail.local --user "test@fake.fake" --password "fake" --project "TestProject" --run "TestingSuite" --case-ok --version '1.0.14' --mock t/test_subtest.tap});
  16. $out = `@args`;
  17. is($? >> 8, 0, "Exit code OK reported with subtests (case-ok mode)");
  18. $matches = () = $out =~ m/Reporting result of case/ig;
  19. is($matches,2,"Attempts to upload do not do subtests (case-ok mode)");
  20. #Test plans/configs
  21. @args = ($^X,qw{bin/testrail-report --apiurl http://testrail.local --user "test@fake.fake" --password "fake" --project "TestProject" --run "Executing the great plan" --plan "GosPlan" --config "testConfig" --case-ok --mock t/test_subtest.tap});
  22. $out = `@args`;
  23. is($? >> 8, 0, "Exit code OK reported with plans");
  24. $matches = () = $out =~ m/Reporting result of case.*OK/ig;
  25. is($matches,2,"Attempts to to plans work");
  26. #Test that spawn works
  27. @args = ($^X,qw{bin/testrail-report --apiurl http://testrail.local --user "test@fake.fake" --password "fake" --project "TestProject" --run "TestingSuite2" --spawn 9 --case-ok --mock t/test_subtest.tap});
  28. $out = `@args`;
  29. is($? >> 8, 0, "Exit code OK reported with spawn");
  30. $matches = () = $out =~ m/Reporting result of case.*OK/ig;
  31. is($matches,2,"Attempts to spawn work");