Class ReportPathProvider
- Namespace
- CSF.Screenplay.Reporting
- Assembly
- CSF.Screenplay.dll
Stateful implementation of IGetsReportPath which caches the outcome of the path-determination logic.
public class ReportPathProvider : IGetsReportPath
- Inheritance
-
ReportPathProvider
- Implements
- Inherited Members
Remarks
This class uses ReportPath as its primary source of truth. However, if that value is null/whitespace or if the path is not writable then this class will return null from GetReportPath(), disabling the reporting functionality.
If ReportPath is a relative path then it is combined with the current working directory to form an absolute path, thus (if GetReportPath() does not return null), its return value will always be an absolute path.
Because of the caching functionality, this class is stateful and should be used as a singleton.
Constructors
ReportPathProvider(ScreenplayOptions, ITestsPathForWritePermissions)
Initializes a new instance of the ReportPathProvider class.
public ReportPathProvider(ScreenplayOptions screenplayOptions, ITestsPathForWritePermissions permissionsTester)
Parameters
screenplayOptionsScreenplayOptionsThe screenplay options.
permissionsTesterITestsPathForWritePermissionsThe permissions tester.
Methods
GetReportPath()
Gets the path to which the report should be written.
public string GetReportPath()
Returns
- string
The report path.
Remarks
If the returned path is null then Screenplay's reporting functionality should be disabled and no report should be written. Otherwise, implementations of this interface should return an absolute file system path to which the report should be written. This path must be writable by the executing process.
Reporting could be disabled if either the Screenplay Options report path is null or a whitespace-only string, or if the path indicated by those options is not writable.