Page 1 of 1

Test execution bugfixes

Posted: Thu Mar 25, 2010 7:42 am
by austvik
I am trying to use test automation to start some automated tests for me, but have hit some bugs on the way. Here are some small patches against CVS HEAD which make it work, and which expand on what you can use it for.

The first patch does:
- add a missing require
- send with more information to do_remote_execution, so that we can send information that the test execution server could use to make queries about this test run back to testlink.
- insert platform id and execution type automated into the executions table after result is returned (they were reported as manual as default)

Code: Select all

Index: lib/execute/execSetResults.php
===================================================================
RCS file: /cvsroot/testlink/testlink/lib/execute/execSetResults.php,v
retrieving revision 1.152
diff -r1.152 execSetResults.php
42a43
> require_once('remote_exec.php');
96c96
< 	 $status_and_notes=do_remote_execution($db,$args->tc_versions);
---
> 	$status_and_notes=do_remote_execution($db,$args->tc_versions, $args->build_id, $args->user_id, $args->tplan_id, $args->platform_id, $args->tproject_id, $args->version_id);
702c702
< function do_remote_execution(&$db,$tc_versions)
---
> function do_remote_execution(&$db,$tc_versions, $build_id, $user_id, $tplan_id, $platform_id, $tproject_id, $tcversion_id)
719c719
< 		$executionResults[$tcase_id] = executeTestCase($tcase_id,$tree_mgr,$cfield_mgr);
---
> 		$executionResults[$tcase_id] = executeTestCase($tcase_id,$tree_mgr,$cfield_mgr,$tplan_id,$tproject_id,$build_id,$platform_id,$tcversion_id);
738,739c738,739
< 				$sql = "INSERT INTO executions (build_id,tester_id,status,testplan_id,tcversion_id,execution_ts,notes) ".
< 				       "VALUES ({$build_id},{$user_id},'{$my_result}',{$tplan_id},{$version_id},{$db_now},'{$my_notes}')";
---
> 				$sql = "INSERT INTO executions (build_id,tester_id,status,testplan_id,tcversion_id,execution_ts,notes,platform_id, execution_type) ".
> 				       "VALUES ({$build_id},{$user_id},'{$my_result}',{$tplan_id},{$version_id},{$db_now},'{$my_notes}',{$platform_id}, 2)";
The next patch does:
- Read and send the extra information to the test execution server
- Read server_host _port and _path correctly

I think it would be even better (easier to expand) if the parameters here were sent as a map/hash than as an array.

Code: Select all

Index: lib/functions/remote_exec.php
===================================================================
RCS file: /cvsroot/testlink/testlink/lib/functions/remote_exec.php,v
retrieving revision 1.3
diff -r1.3 remote_exec.php
39c39
< function executeTestCase($testcase_id,$tree_manager,$cfield_manager)
---
> function executeTestCase($testcase_id,$tree_manager,$cfield_manager,$testplan_id,$build_id,$project_id,$platform_id,$tcversion_id)
54,56c54,56
< 		$server_host = $server_params["xml_server_host"];
< 		$server_port = $server_params["xml_server_port"];
< 		$server_path = $server_params["xml_server_path"];
---
> 		$server_host = $server_params["xml_server_host"]["value"];
> 		$server_port = $server_params["xml_server_port"]["value"];
> 		$server_path = $server_params["xml_server_path"]["value"];
75c75
<   	$myVar1 = new xmlrpcval($testcase_name,'string');
---
>   	$myvar1 = new xmlrpcval($testcase_name,'string');
76a77,81
>   	$myvar3 = new xmlrpcval($testplan_id,'string');
>   	$myvar4 = new xmlrpcval($build_id,'string');
>   	$myvar5 = new xmlrpcval($project_id,'string');
>   	$myvar6 = new xmlrpcval($platform_id,'string');
>   	$myvar7 = new xmlrpcval($tcversion_id,'string');
78c83,84
<   	$messageToServer = new xmlrpcmsg('ExecuteTest', array($myVar1,$myvar2));
---
>   	$messageToServer = new xmlrpcmsg('ExecuteTest', array($myvar1,$myvar2,$myvar3,$myvar4,$myvar5,$myvar6,$myvar7));
> 
This is just the small bugfixes that I have. I'll create RFEs and maybe provide patches for some of the bigger things I see missing (some navigation methods between entities in the API, ability to run whole test plan automated with a separate execute method sent to the test execution server, set test case execution attachment and set test case execution custom field value from API, custom fields on platforms and custom fields on machines and being able to read and set both from automation, connecting platforms to machines, connecting machines to test executions).

Posted: Thu Mar 25, 2010 5:55 pm
by austvik
Ah, saw on the "Contributions"-page that this was the wrong approach. Filed a contributions mantis report instead:

http://www.testlink.org/mantis/view.php?id=3338