Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions py_jama_rest_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1064,6 +1064,37 @@ def post_tag(self, name: str, project: int):
JamaClient.__handle_response_status(response)
return response.json()['meta']['id']

def get_testplans(self,project_id, allowed_results_per_page=__allowed_results_per_page):
""" This method will return all testplans in the give project.
:param project_id (int) The integer project ID.
:return a json list of testplans
"""
resource_path = 'testplans'
params = {'project': project_id}
testplans = self.__get_all(resource_path, params=params, allowed_results_per_page=allowed_results_per_page)
return testplans

def get_testgroups(self,testplan_id, allowed_results_per_page=__allowed_results_per_page):
""" This method will return all testgroups in the give testplan.
:param testplan_id (int) The integer testplan ID.
:return a json list of testgroups
"""
resource_path = f'testplans/{testplan_id}/testgroups'
params = {}
testgroups = self.__get_all(resource_path, params=params, allowed_results_per_page=allowed_results_per_page)
return testgroups

def get_testgroup_testcases(self,testplan_id, testgroup_id, allowed_results_per_page=__allowed_results_per_page):
""" This method will return all testcases in the give testgroup.
:param testplan_id (int) The integer testplan ID.
:param testgroup_id (int) The integer testgroup ID.
:return a json list of testcases in the give testgroup
"""
resource_path = f"testplans/{testplan_id}/testgroups/{testgroup_id}/testcases"
params = {}
testcases = self.__get_all(resource_path, params=params, allowed_results_per_page=allowed_results_per_page)
return testcases

def post_testplans_testcycles(self, testplan_id, testcycle_name, start_date, end_date, testgroups_to_include=None,
testrun_status_to_include=None):
"""
Expand Down
16 changes: 16 additions & 0 deletions test/test_jamaClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,22 @@ class TestJamaClient(TestCase):
jama_api_password = os.environ['JAMA_API_PASSWORD']
jama_client = JamaClient(jama_url, (jama_api_username, jama_api_password))

def test_get_testplans_and_groups(self):
projects = self.jama_client.get_projects()
self.assertIsNotNone(projects)
project_id = projects[0]['id']
testplans = self.jama_client.get_testplans(project_id)
self.assertIsNotNone(testplans)
testplan_id = testplans[0]['id']
testgroups = self.jama_client.get_testgroups(testplan_id)
self.assertIsNotNone(testgroups)
testgroup_id = testgroups[0]['id']
testcases = self.jama_client.get_testgroup_testcases(testplan_id, testgroup_id)
self.assertIsNotNone(testcases)
self.assertGreater(len(testcases), 0)



def test_get_projects(self):
projects = self.jama_client.get_projects()
self.assertIsNotNone(projects)
Expand Down