Module: Kanoah::Services::TestRun

Included in:
Client
Defined in:
lib/services/test_run.rb

Instance Method Summary collapse

Instance Method Details

#get_run_details(test_run_key) ⇒ Object



10
11
12
13
# File 'lib/services/test_run.rb', line 10

def get_run_details(test_run_key)
  @response = self.class.get("/rest/kanoahtests/1.0/testrun/#{test_run_key}", headers: @header)
  self
end

#get_test_runs(project_key) ⇒ Object



27
28
29
30
# File 'lib/services/test_run.rb', line 27

def get_test_runs(project_key)
  @response = self.class.get("/rest/kanoahtests/1.0/testrun/search?query=projectKey = '#{project_key}'", headers: @header)
  self
end

#post_new_result_to_run(scenario) ⇒ Object



15
16
17
18
19
20
# File 'lib/services/test_run.rb', line 15

def post_new_result_to_run(scenario)
  @response = self.class.post("/rest/kanoahtests/1.0/testrun/#{@test_run_id}/testcase/#{scenario[:test_case]}/testresult",
                              body: { 'status' => scenario[:status], 'environment' => @environment, 'comment' => scenario[:comment], 'executionTime' => scenario[:execution_time], 'scriptResults' => scenario[:script_results]}.to_json,
                              headers: @header)
  self
end

#post_new_test_run(body) ⇒ Object



5
6
7
8
# File 'lib/services/test_run.rb', line 5

def post_new_test_run(body)
  @response = self.class.post("/rest/kanoahtests/1.0/testrun", body: body.to_json, headers: @header)
  self
end

#update_result_of_run(test_run_key, test_case_key, body) ⇒ Object



22
23
24
25
# File 'lib/services/test_run.rb', line 22

def update_result_of_run(test_run_key, test_case_key, body)
  @response = self.class.put("/rest/kanoahtests/1.0/testrun/#{test_run_key}/testcase/#{test_case_key}/testresult", body: body.to_json, headers: @header)
  self
end