Remote Runner: checks, examples and tests

We use the term 'check' in a similar way that test is normally used, however in the context of Pharo, a 'test' normally a SUnit test, i.e. a method beginning with test and that is in a subclass of TestCase TestAsserter subclass: #TestCase instanceVariableNames: 'testSelector expectedFails' classVariableNames: 'Announcers DefaultTimeLimit HistoryAnnouncer' package: 'SUnit-Core-Kernel' . An example is a method that has the file:///gtExample pragma, and who's assertions check the correctness of other classes and methods. A 'check' may be either a TestCase TestAsserter subclass: #TestCase instanceVariableNames: 'testSelector expectedFails' classVariableNames: 'Announcers DefaultTimeLimit HistoryAnnouncer' package: 'SUnit-Core-Kernel' test method, or a file:///gtExample method.

RemoteRunner provides the ability to significantly reduce the time it takes to run test suites by delegating checks out to multiple workers.

GtRrChecksFactory GtRrTaskFactory subclass: #GtRrChecksFactory instanceVariableNames: 'ignoreNoTest inImageOnly' classVariableNames: '' package: 'RemoteRunner-Tasks' provides a convenient way of constructing jobs to run the test suite. Checks can be added to a job by package, class or individually.

E.g. to add checks by package:

factory := GtRrChecksFactory new.
factory
	addSUnitPackages: { 'Collections-Tests' asPackage };
	addExamplePackages: { 'RemoteRunner' asPackage }.
job := factory job.
GtRemoteRunner default submitJob: job.
  

Will execute all the checks in the listed packages.

To add checks by class:

factory := GtRrChecksFactory new.
factory
	addSUnitClassNames: #(ArrayTest);
	addExampleClassNames: #(GtRrManagerExamples).
job := factory job.
GtRemoteRunner default submitJob: job.
  

To add SUnit tests individual, supply a collection of class name -> selector assocations, e.g.:

factory := GtRrChecksFactory new.
factory addExampleTestNames:
	{ 'ArrayTest' -> #test0FixtureCloneTest.
	'DoubleLinkedListTest' ->#testEmpty. }.
job := factory job.
GtRemoteRunner default submitJob: job.
  

To add file:///gtExamples individually supply a collection of class name -> selector associations, e.g.:

factory := GtRrChecksFactory new.
factory addExampleTestNames:
	{ 'GtRrTaskExamples' -> #compoundTask.
	'GtRrEpiceaExamples' ->#classCompactChange. }.
job := factory job.
GtRemoteRunner default submitJob: job.
  

In all the examples above the checks are generally constructed as one task for each call made to the factory adding checks. This means that the amount of time taken to run each task may vary wildly.

The checks may be more efficiently scheduled by recording the times of previous runs and grouping checks in to tasks based on those times.

To enable the time recording:

GtRrCheckSchedulingTimes default.
  

Running the job above a second time will record then times.

The job can then be more efficiently scheduled with:

factory := GtRrChecksFactory new.
factory
	addSUnitPackages: { 'Collections-Tests' asPackage };
	addExamplePackages: { 'RemoteRunner' asPackage }.
factory groupTasksByTime.
GtRemoteRunner default submitJob: factory job.
  

The execution times can be saved with:

GtRrCheckSchedulingTimes default save.
  

and loaded with:

GtRrCheckSchedulingTimes loadDefaultInstance.