Example #1
0
        /// <summary>
        /// Get the list of API Test Cases associated with the specified Project
        /// </summary>
        /// <param name="projectId">Identifier for the Project to fetch API Test Cases from</param>
        /// <param name="onlyAutomated">Get only the API Test Cases that are Automated?</param>
        /// <param name="onlyDescription">Get only the API Test Case(s) that matches the Description?</param>
        /// <returns>List of API Test Cases as Array of Objects</returns>
        /// <exception cref="Exception">In case of failure</exception>
        public List <TestCaseAPI> GetAPITestCases(
            string projectId,
            bool onlyAutomated     = false,
            string onlyDescription = "")
        {
            var apiClient = new APIClient(_baseURL);

            apiClient.Headers.Add(new KeyValue("Content-Type", "application/json"));
            apiClient.Headers.Add(new KeyValue("Authorization", "Bearer " + _user.access_token));
            apiClient.Queries.Add(new KeyValue("projectId", projectId));
            var apiCases = apiClient.Get <List <TestCaseAPI> >("/api/apiTestcases");

            _lastResponse = apiClient.Response.Content;
            if (!apiClient.Response.IsSuccessful)
            {
                throw apiClient.GetError();
            }
            // Filter only Automated Test Cases (if requested)
            if (onlyAutomated)
            {
                apiCases = apiCases.Where(tc => tc.isAutomated.Equals(true)).ToList();
            }

            // Filter only Test Cases that matches the Description (if requested)
            if (!string.IsNullOrEmpty(onlyDescription))
            {
                apiCases = apiCases.Where(
                    tc => tc.description.Equals(onlyDescription, StringComparison.CurrentCultureIgnoreCase)).ToList();
            }

            return(apiCases);
        }
Example #2
0
        /// <summary>
        /// Get the list of Projects associated with the User
        /// </summary>
        /// <returns>List of Projects as Array of Objects</returns>
        /// <exception cref="Exception">In case of failure</exception>
        public List <Project> GetProjects()
        {
            var apiClient = new APIClient(_baseURL);

            apiClient.Headers.Add(new KeyValue("Content-Type", "application/json"));
            apiClient.Headers.Add(new KeyValue("Authorization", "Bearer " + _user.access_token));
            apiClient.Queries.Add(new KeyValue("userId", _user.userId));
            var projects = apiClient.Get <List <Project> >("/api/projects");

            _lastResponse = apiClient.Response.Content;
            if (!apiClient.Response.IsSuccessful)
            {
                throw apiClient.GetError();
            }
            return(projects);
        }
Example #3
0
        public List <Tool> GetTools(string projecId)
        {
            var apiClient = new APIClient(_baseURL);

            apiClient.Headers.Add(new KeyValue("Content-Type", "application/json"));
            apiClient.Headers.Add(new KeyValue("Authorization", "Bearer " + _user.access_token));
            apiClient.Queries.Add(new KeyValue("projectId", projecId));
            var tools = apiClient.Get <List <Tool> >("api/tools");

            if (!apiClient.Response.IsSuccessful)
            {
                throw apiClient.GetError();
            }

            return(tools);
        }
Example #4
0
        /// <summary>
        /// Post the provided test Suite to the QViz Instance
        /// </summary>
        /// <param name="testSuite">Test Suite as JSON Object</param>
        //public void PostTestSuite(SubModule testSuite)
        //{
        //	var apiClient = new APIClient(_baseURL);
        //	apiClient.Headers.Add(new KeyValue("Content-Type", "application/json"));
        //	apiClient.Headers.Add(new KeyValue("Authorization", "Bearer " + _user.access_token));
        //	apiClient.Headers.Add(new KeyValue("userId", _user.userId));
        //	apiClient.Body = testSuite;
        //	apiClient.Post<object>("/api/TestSuites");
        //	_lastResponse = apiClient.Response.Content;
        //	if (!apiClient.Response.IsSuccessful) throw apiClient.GetError();
        //}


        /// <summary>
        /// Get test case type
        /// </summary>
        /// <returns>List of test case type</returns>
        public List <TestCaseType> GetTestCaseTypes()
        {
            var apiClient = new APIClient(_baseURL);

            apiClient.Headers.Add(new KeyValue("Content-Type", "application/json"));
            apiClient.Headers.Add(new KeyValue("Authorization", "Bearer " + _user.access_token));

            var TCtypes = apiClient.Get <List <TestCaseType> >("api/testcasetypes");

            if (!apiClient.Response.IsSuccessful)
            {
                throw apiClient.GetError();
            }

            return(TCtypes);
        }
Example #5
0
        /// <summary>
        /// Get SubModule under a module in project
        /// </summary>
        /// <param name="moduleId"></param>
        /// <returns></returns>
        public List <SubModule> GetSubModules(string moduleId)
        {
            var apiClient = new APIClient(_baseURL);

            apiClient.Headers.Add(new KeyValue("Content-Type", "application/json"));
            apiClient.Headers.Add(new KeyValue("Authorization", "Bearer " + _user.access_token));
            apiClient.Queries.Add(new KeyValue("moduleId", moduleId));
            var subModules = apiClient.Get <List <SubModule> >("/api/sub-modules");

            _lastResponse = apiClient.Response.Content;
            if (!apiClient.Response.IsSuccessful)
            {
                throw apiClient.GetError();
            }
            return(subModules);
        }