Beispiel #1
0
        public override bool ConnectALMServer()
        {
            try
            {
                Reporter.ToLog(eLogLevel.DEBUG, "Connecting to qTest server");
                connObj = new QTestApi.LoginApi(ALMCore.DefaultAlmConfig.ALMServerURL);
                string granttype     = "password";
                string authorization = "Basic bWFoZXNoLmthbGUzQHQtbW9iaWxlLmNvbTo=";
                string accessToken   = ALMCore.DefaultAlmConfig.ALMPassword;
                string tokenType     = "bearer";

                if (ALMCore.DefaultAlmConfig.UseToken)
                {
                    QTestApiModel.OAuthTokenStatusVM oAuthTokenStatusVM = connObj.TokenStatus(tokenType + " " + accessToken);
                    if (oAuthTokenStatusVM.ToString().ToLower().Contains("error"))
                    {
                        Reporter.ToLog(eLogLevel.ERROR, "Failed to connect qTest Server" + System.Environment.NewLine + oAuthTokenStatusVM.ToString());
                        return(false);
                    }
                }
                else
                {
                    QTestApiModel.OAuthResponse response = connObj.PostAccessToken(granttype, ALMCore.DefaultAlmConfig.ALMUserName, ALMCore.DefaultAlmConfig.ALMPassword, authorization);
                    accessToken = response.AccessToken;
                    tokenType   = response.TokenType;
                }
                connObj.Configuration.AccessToken = accessToken;
                connObj.Configuration.ApiKey.Add("Authorization", accessToken);
                connObj.Configuration.ApiKeyPrefix.Add("Authorization", tokenType);

                string almConfigPackageFolderPathCalculated = WorkSpace.Instance.Solution.SolutionOperations.ConvertSolutionRelativePath(ALMCore.DefaultAlmConfig.ALMConfigPackageFolderPath);
                if (General.IsConfigPackageExists(almConfigPackageFolderPathCalculated, GingerCoreNET.ALMLib.ALMIntegrationEnums.eALMType.Qtest))
                {
                    connObj.Configuration.MyAPIConfig.LoadSettingsFromConfig(Path.Combine(almConfigPackageFolderPathCalculated, "QTestSettings", "QTestSettings.json"));
                }
                else
                {
                    connObj.Configuration.MyAPIConfig = new QTestApiClient.QTestClientConfig();
                }
                return(true);
            }
            catch (Exception ex)
            {
                Reporter.ToLog(eLogLevel.ERROR, "Connecting to qTest server", ex);
                connObj = null;
                return(false);
            }
        }
Beispiel #2
0
        public ObservableList <QTestApiModel.TestCycleResource> GetQTestCyclesByProject(string qTestServerUrl, string qTestUserName, string qTestPassword, string qTestProject)
        {
            ObservableList <QTestApiModel.TestCycleResource> cyclestList;

            QTestApi.LoginApi connObj       = new QTestApi.LoginApi(ALMCore.DefaultAlmConfig.ALMServerURL);
            string            granttype     = "password";
            string            authorization = "Basic bWFoZXNoLmthbGUzQHQtbW9iaWxlLmNvbTo=";

            QTestApiModel.OAuthResponse response = connObj.PostAccessToken(granttype, ALMCore.DefaultAlmConfig.ALMUserName, ALMCore.DefaultAlmConfig.ALMPassword, authorization);
            connObj.Configuration.AccessToken = response.AccessToken;
            connObj.Configuration.ApiKey.Add("Authorization", response.AccessToken);
            connObj.Configuration.ApiKeyPrefix.Add("Authorization", response.TokenType);

            QTestApi.TestcycleApi TestcycleApi = new QTestApi.TestcycleApi(connObj.Configuration);
            cyclestList = new ObservableList <QTestApiModel.TestCycleResource>(TestcycleApi.GetTestCycles((long)Convert.ToInt32(qTestProject), null, null, "descendants"));

            return(cyclestList);
        }
Beispiel #3
0
 public override bool ConnectALMServer()
 {
     try
     {
         Reporter.ToLog(eLogLevel.DEBUG, "Connecting to qTest server");
         connObj = new QTestApi.LoginApi(ALMCore.DefaultAlmConfig.ALMServerURL);
         string granttype     = "password";
         string authorization = "Basic bWFoZXNoLmthbGUzQHQtbW9iaWxlLmNvbTo=";
         QTestApiModel.OAuthResponse response = connObj.PostAccessToken(granttype, ALMCore.DefaultAlmConfig.ALMUserName, ALMCore.DefaultAlmConfig.ALMPassword, authorization);
         connObj.Configuration.MyAPIConfig = new QTestApiClient.QTestClientConfig();
         connObj.Configuration.AccessToken = response.AccessToken;
         connObj.Configuration.ApiKey.Add("Authorization", response.AccessToken);
         connObj.Configuration.ApiKeyPrefix.Add("Authorization", response.TokenType);
         System.Diagnostics.Trace.WriteLine("Authentication Successful");
         return(true);
     }
     catch (Exception ex)
     {
         Reporter.ToLog(eLogLevel.ERROR, "Connecting to qTest server", ex);
         connObj = null;
         return(false);
     }
 }