public void StartRecording(string recordMode, string userAgent, bool isHttp2)
        {
            _recordStarted = true;
            StartRecordingParamsBuilder startRecordingPB = new StartRecordingParamsBuilder();

            HandleUserPathName(startRecordingPB);

            bool isSap = recordMode.ToLower().Contains("sap");

            startRecordingPB.isSapGuiProtocol(isSap);
            startRecordingPB.isHTTP2Protocol(isHttp2);
            if (userAgent != null && !userAgent.Equals(""))
            {
                startRecordingPB.userAgent(userAgent);
            }

            try
            {
                _client.StartRecording(startRecordingPB.Build());
            }
            catch (Exception e)
            {
                _recordStarted = false;
                throw e;
            }
        }
Ejemplo n.º 2
0
        public void startRecording(string userPathName, bool updateUserPath, TimeSpan timeout, TimeSpan interval, string userAgent = "",
                                   bool isWebSocketProtocol = false, bool isHttp2Protocol = false, bool isAdobeRTMPProtocol = false, string addressToExclude = "")
        {
            if (_mode != Mode.DESIGN)
            {
                return;
            }

            this.CheckDesignIsConnected();

            if (!isNeoloadReady())
            {
                throw(new Exception("Error!! Can't start recording. Neoload is not ready yet."));
            }

            this.userPathName = validateUserPathName(userPathName);

            _containsUserPathPB.name(userPathName);
            pathExists = _client.ContainsUserPath(_containsUserPathPB.Build());
            if (!updateUserPath && pathExists)
            {
                string msg = String.Format("Error!! UserPath {0} already exists and update path is disabled!", userPathName);
                throw(new Exception(msg));
            }

            if (!pathExists)
            {
                _startRecordingPB.virtualUser(userPathName);
            }
            else
            {
                _startRecordingPB.virtualUser(userPathName + "_recording");
            }
            _startRecordingPB.isHTTP2Protocol(isHttp2Protocol);
            _startRecordingPB.isWebSocketProtocol(isWebSocketProtocol);
            _startRecordingPB.isAdobeRTMPProtocol(isAdobeRTMPProtocol);
            _startRecordingPB.userAgent(userAgent);

            this.CheckDesignIsConnected();

            var curState = _client.GetStatus();

            switch (curState)
            {
            case DesignState.NO_PROJECT: throw new InvalidOperationException("Failed to start test because no Project is loaded in NeoLoad.");

            default:
                this.WaitForNeoloadState(DesignState.READY, timeout, interval);
                setNeoloadProxy(getProxyHost(), getProxyPort(), addressToExclude);
                _client.StartRecording(_startRecordingPB.Build());
                break;
            }
        }