UsefulUnitTests.pas

  1. (**
  2.  * These unit tests are from a project I inherited. Look how /incredibly/
  3.  * useful they are! I'm very glad this developer is no longer working with us.
  4.  *)
  5.  
  6. unit BPMTestCases;
  7.  
  8. interface
  9.  
  10. uses Sysutils, // Format Command
  11. Forms,
  12. TestFramework;
  13.  
  14. Type
  15.  
  16. TJobs = class(TTestCase)
  17. Private
  18. pathscript : String;
  19. protected
  20. procedure SetUp; override;
  21. procedure TearDown; override;
  22. published
  23. procedure CreateDatabase;
  24. procedure InsertJobs;
  25. procedure InsertJobsItems;
  26. end;
  27.  
  28. TJobsHandSheets = class(TTestCase)
  29. Private
  30. pathscript : String;
  31. published
  32. procedure InsertErectJobsHandOverSheets;
  33. procedure DismantleErectJobsHandOverSheets;
  34. procedure InsertErectJobsHandOverSheetsH;
  35. procedure DismantleErectJobsHandOverSheetsH;
  36. end;
  37.  
  38. function UnitTests: ITestSuite;
  39.  
  40. implementation
  41.  
  42. { TTestCaseFirst }
  43.  
  44. uses uGeneral;
  45.  
  46. procedure TJobs.CreateDatabase;
  47. begin
  48. pathscript := 'PPSTest.bat';
  49. ExecNewProcess(pathscript,true);
  50. end;
  51.  
  52. procedure TJobs.InsertJobs;
  53. begin
  54. //
  55. pathscript := 'PPSTest_InsertJobs.bat';
  56. ExecNewProcess(pathscript,true);
  57. end;
  58.  
  59. procedure TJobs.InsertJobsItems;
  60. begin
  61. // Go Ahead Insert Jobs
  62. pathscript := 'PPSTest_InsertJobsItems.bat';
  63. ExecNewProcess(pathscript,true);
  64. end;
  65.  
  66. procedure TJobs.SetUp;
  67. begin
  68. // Extract Database
  69. //pathscript := Format('mysql -uroot -proot ppstest < %s ',[ExtractFilePath(Application.ExeName) + 'PPSTest.sql']);
  70.  
  71. end;
  72.  
  73. procedure TJobs.TearDown;
  74. begin
  75. // Free Objects
  76. end;
  77.  
  78. function UnitTests: ITestSuite;
  79. var
  80. ATestSuite: TTestSuite;
  81. begin
  82. ATestSuite := TTestSuite.create('Hand Over Sheets');
  83. ATestSuite.addTest(TJobs.Suite);
  84. ATestSuite.addTest(TJobsHandSheets.Suite);
  85. Result := ATestSuite;
  86. end;
  87.  
  88. { TJobsHandSheets }
  89. procedure TJobsHandSheets.DismantleErectJobsHandOverSheets;
  90. begin
  91. // Go Ahead Insert Jobs
  92. pathscript := 'PPSTest_DismantleJobsHandOverSheets.bat';
  93. ExecNewProcess(pathscript,true);
  94. end;
  95.  
  96. procedure TJobsHandSheets.DismantleErectJobsHandOverSheetsH;
  97. begin
  98. pathscript := 'PPSTest_DismantleJobsHandOverSheetsH.bat';
  99. ExecNewProcess(pathscript,true);
  100. end;
  101.  
  102. procedure TJobsHandSheets.InsertErectJobsHandOverSheets;
  103. begin
  104. // Go Ahead Insert Jobs
  105. pathscript := 'PPSTest_InsertJobsHandOverSheets.bat';
  106. ExecNewProcess(pathscript,true);
  107. end;
  108.  
  109. procedure TJobsHandSheets.InsertErectJobsHandOverSheetsH;
  110. begin
  111. pathscript := 'PPSTest_InsertJobsHandOverSheetsH.bat';
  112. ExecNewProcess(pathscript,true);
  113. end;
  114.  
  115. Initialization
  116. RegisterTest('BPM Test Harness', UnitTests);
  117. end.
  118.  
  119.