示例#1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GenericDriver"/> class.
        /// </summary>
        /// <param name="remoteAddress">The base address for the Agent API (e.g. http://localhost:8585).</param>
        /// <param name="token">The development token used to communicate with the Agent, see <a href="https://app.testproject.io/#/integrations/sdk">here</a> for more info.</param>
        /// <param name="projectName">The project name to report.</param>
        /// <param name="jobName">The job name to report.</param>
        /// <param name="disableReports">Set to true to disable all reporting (no report will be created on TestProject).</param>
        /// <param name="reportType">The report type of the execution, can be local, cloud or both.</param>
        /// <param name="reportName">The name of the local generated report.</param>
        /// <param name="reportPath">The path of the local generated report.</param>
        /// <param name="restClientTimeout"> The connection timeout to the agent in milliseconds. Default is 120 seconds.</param>
        public GenericDriver(
            Uri remoteAddress     = null,
            string token          = null,
            string projectName    = null,
            string jobName        = null,
            bool disableReports   = false,
            ReportType reportType = ReportType.CLOUD_AND_LOCAL,
            string reportName     = null,
            string reportPath     = null,
            int restClientTimeout = AgentClient.DefaultRestClientTimeoutInMilliseconds)
        {
            AgentClient agentClient = AgentClient.GetInstance(remoteAddress, token, new GenericOptions(), new ReportSettings(projectName, jobName, reportType, reportName, reportPath), disableReports, restClientTimeout, this.minGenericDriverSupportedVersion);

            this.commandExecutor = new GenericCommandExecutor(remoteAddress, disableReports);

            this.IsRunning = true;

            if (StackTraceHelper.Instance.TryDetectSpecFlow())
            {
                var report = this.Report();

                if (!StackTraceHelper.Instance.IsSpecFlowPluginInstalled())
                {
                    string message = "TestProject Plugin for SpecFlow is not installed, please install the plugin and run the Test again.";
                    report.Step(description: message, passed: false);
                    Logger.Error(message);
                    this.Stop();
                    throw new SdkException(message);
                }

                report.DisableCommandReports(DriverCommandsFilter.All);
                report.DisableAutoTestReports(true);
                Logger.Info("SpecFlow detected, applying SpecFlow-specific reporting settings...");
            }
        }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GenericDriver"/> class.
        /// </summary>
        /// <param name="remoteAddress">The base address for the Agent API (e.g. http://localhost:8585).</param>
        /// <param name="token">The development token used to communicate with the Agent, see <a href="https://app.testproject.io/#/integrations/sdk">here</a> for more info.</param>
        /// <param name="projectName">The project name to report.</param>
        /// <param name="jobName">The job name to report.</param>
        /// <param name="disableReports">Set to true to disable all reporting (no report will be created on TestProject).</param>
        public GenericDriver(
            Uri remoteAddress   = null,
            string token        = null,
            string projectName  = null,
            string jobName      = null,
            bool disableReports = false)
        {
            AgentClient agentClient = AgentClient.GetInstance(remoteAddress, token, new GenericOptions(), new ReportSettings(projectName, jobName), disableReports, this.minGenericDriverSupportedVersion);

            this.commandExecutor = new GenericCommandExecutor(remoteAddress, disableReports);

            if (StackTraceHelper.Instance.TryDetectSpecFlow())
            {
                Logger.Info("SpecFlow detected, applying SpecFlow-specific reporting settings...");
                this.Report().DisableCommandReports(true);
                this.Report().DisableAutoTestReports(true);
            }
        }