Struct retest::Plan[][src]

pub struct Plan { /* fields omitted */ }
Expand description

Holds one or more Tests which can be used to generate expected files or to retest by creating actual files and comparing them with the expecteds.

To create a new Plan from a retest plan file (.rt), use the new_from_rt() or new_from_rt_filtered() methods.

See also the retest plan file example.

To create a new Plan programmatically, use new() to create an empty Plan, and then the builder methods. For example, use expected_path() and actual_path() to set non-default paths. Then for each test, call push(). And finally, call build().

See also the builders example.

Once a Plan has been created either from a .rt file or using the builder methods, you can generate or retest by using apply(), generate(), or retest().

Implementations

Returns a new empty Plan.

Creates a new Plan with a default expected path of rt_expected and a default actual path of rt_actual (i.e., both are relative to the current folder), and that contains no tests. When each Test is run its app is assumed to be in the PATH or to include a path. For example, you could do something like this:

let app = Path::new(env!("CARGO_TARGET_DIR")).join("myapp.exe");
let plan = Plan::new()
    .push(Test::new(&app) // etc.

The Plan returned is expected to be used with the Plan builder methods. For example, use expected_path() or actual_path() to set non-default paths. For every test required, call push() giving it a newly built Test. And finally, call build() to make the Plan ready for use.

Note that plans can also be created by reading a retest plan file (.rt) using the new_from_rt() or new_from_rt_filtered() methods.

Sets the Plan’s expected path to the one given.

The default expected path is rt_expected in the current folder.

Sets the Plan’s actual path to the one given.

The default actual path is rt_actual in the current folder.

Appends a new Test to the plan.

The first test added is number 1, the second 2, and so on. The number is used when logging passed, failed, or errored tests.

Returns the Plan you’ve built and on which you can call generate(), retest(), or apply().

Returns a Plan on which you can call generate(), retest(), or apply().

Reads the test plan and all the tests from the file with the given filename which must be in retest plan file (.rt) format, and returns the corresponding Plan.

Note that plans can also be created programatically using new() and the Plan builder methods.

Returns a Plan on which you can call generate(), retest(), or apply().

Reads the test plan from the file with the given filename which must be in retest plan file (.rt) format, and returns the corresponding Plan. Only those tests whose numbers appear in the given numbers set are included in the Plan.

Note that plans can also be created programatically using new() and the Plan builder methods.

Returns a Counts holding the number of tests, passes, fails, and errors.

If the RETEST_GENERATE environment variable is present and set to 1, this method calls generate(); otherwise it calls retest().

Returns a Counts holding the number of tests, passes, fails, and errors.

Runs all the tests in the Plan. For each test, providing the exit code/error level is what’s expected, any test output is saved to the actual path and then the original output that was generated previously in the expected path is compared with the newly saved output.

During retesting, logging output is produced (or not) depending on the logger you are using and the logging level you have set.

All the fields in the returned Counts are used (although some could be 0).

Returns a Counts holding the number of tests and fails.

Runs all the tests in the Plan. For each test, any test output is saved to the expected path.

During generating, logging output is produced (or not) depending on the logger you are using and the logging level you have set.

Only the total and failed fields in the returned Counts are used.

Returns true if this Plan has no tests; otherwise returns false.

Returns how many tests this Plan has (which could be 0).

Returns this test Plan (and any tests it contains) as a single string in retest plan file (.rt) format.

Note that if the plan is created using Plan::new() and if one or more of builders’ tests (created using Tests) uses the stdin_redirect() method, the relevant plan’s tests will have STDIN placeholders like this example:

STDIN: ///87 raw bytes///

This is because the bytes are fed directly into the method rather than read from a file as happens when using a retest plan file (.rt).

Trait Implementations

Formats the value using the given formatter. Read more

Returns Plan::new(); see that function’s documentation.

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.