How to summate a custom field?

1.8 related questions and discussions.
Please upgrade to LATEST 1.9.x.
No more fixes for 1.8.

Moderators: Amaradana, TurboPT, TL Developers

franny2006
TestLink user
Posts: 3
Joined: Fri May 02, 2008 7:54 am

How to summate a custom field?

Post by franny2006 »

Hi,

I have defined a custom field "working time", to record the time spent for each testcase. Now I want to know, how many time has to be spent on a testplan. So is there a way to cumulate the content of custom field "working time" for all testcases of a testplan?

Thank you for advice...
fman
Member of TestLink Community
Posts: 3123
Joined: Tue Nov 15, 2005 7:19 am

Post by fman »

right now only a couple of well known CF are summed

see:
third_party/user_contribution/cfields_for_computing_time.sql

think is what you need
fman
Member of TestLink Community
Posts: 3123
Joined: Tue Nov 15, 2005 7:19 am

Post by fman »

/**
* TestLink Open Source Project - http://testlink.sourceforge.net/
* This script is distributed under the GNU General Public License 2 or later.
*
* Filename $RCSfile: customfields_for_computing_times.txt,v $
*
* @version $Revision: 1.1 $
* @modified $Date: 2009/02/19 07:08:40 $ by $Author: franciscom $
* @author Martin Havlat
*
*/

Quick Help - Computing Times using Custom Fields

Two custom fields with special name are managed by TestLink to compute times:


CF_ESTIMATED_EXEC_TIME
used by TEST PLAN designers, during Test Case Assignment to test plan, to give testers
an indication about time (IN MINUTES) needed to execute test case.

CF_EXEC_TIME
used by testers while executing test cases, to indicate time (IN MINUTES) used to run test case.

Test Link will do sum() on values present on these custom fields while creating reports



Using following SQL you can configure these Custom Fields

/*Data for the table `custom_fields` */
insert into custom_fields
(name,label,type,possible_values,default_value,valid_regexp,length_min,length_max,
show_on_design,enable_on_design,show_on_execution,enable_on_execution,
show_on_testplan_design,enable_on_testplan_design)
values ('CF_ESTIMATED_EXEC_TIME','Estimated Exec time (minutes)',2,'','','',0,0,1,1,1,0,0,0);

insert into custom_fields
(name,label,type,possible_values,default_value,valid_regexp,length_min,length_max,
show_on_design,enable_on_design,show_on_execution,enable_on_execution,
show_on_testplan_design,enable_on_testplan_design)
values ('CF_EXEC_TIME','Time used to execute test (min)',2,'','','',0,0,0,0,1,1,0,0);

/*Data for the table `cfield_node_types` */
insert into cfield_node_types (field_id,node_type_id)
values ( (SELECT id FROM custom_fields WHERE name='CF_ESTIMATED_EXEC_TIME') ,3);

insert into cfield_node_types (field_id,node_type_id)
values ( (SELECT id FROM custom_fields WHERE name='CF_EXEC_TIME') ,3);
franny2006
TestLink user
Posts: 3
Joined: Fri May 02, 2008 7:54 am

Post by franny2006 »

Thank you very much, this works great!
Ilissan
TestLink user
Posts: 8
Joined: Tue Nov 04, 2008 10:43 am

Post by Ilissan »

fman Are this custom_fields are built in in 1.8 RC4 ? Or by this query you add them ??



I understand that this specific custom fields id's ( CF_ESTIMATED_EXEC_TIME
and CF_EXEC_TIME) are hardcoded and therefore only their values will be summed? right?
Ilissan
TestLink user
Posts: 8
Joined: Tue Nov 04, 2008 10:43 am

Post by Ilissan »

I mean, are these fields already there (in the custom fields) by default or i should create them by my self???

Thanks in Advance!!!!

:!:
milton
Advanced user
Posts: 15
Joined: Wed Nov 19, 2008 11:46 am

Post by milton »

It is my doubt!
Merch
TestLink user
Posts: 8
Joined: Thu Mar 19, 2009 7:26 pm

Post by Merch »

Ilissan wrote:I mean, are these fields already there (in the custom fields) by default or i should create them by my self???

Thanks in Advance!!!!

:!:
They are not there by default, when you run the script they will be added. After running the script you have to go into the custom field management and activate them.
Amaradana
Member of TestLink Community
Posts: 398
Joined: Mon Feb 16, 2009 11:19 am
Contact:

Post by Amaradana »

Hi I am sorry to bother, but can you please teel in which reports does this caliculate and show the results, since i ran the reports, but i was unable to get that, where do i need to find these fields in the reports.
Amaradana
Member of TestLink Community
Posts: 398
Joined: Mon Feb 16, 2009 11:19 am
Contact:

Post by Amaradana »

Found it. Solved. Thanks, I was able to see in test plan reports
Amaradana
Member of TestLink Community
Posts: 398
Joined: Mon Feb 16, 2009 11:19 am
Contact:

Post by Amaradana »

Amaradana wrote:Found it. Solved. Thanks, I was able to see in test plan reports
The above is vible in 1.8Rc4, when i generate the test plan, i was able to see in the test plan(summation of both the field). but in 1.8.1 i was unable to see in the test plan, Can you please let me know where to see in the results. Where does summation of results are availble in reports.

Can also provide some more information in which file does this both fields are hard coded.
Ilissan
TestLink user
Posts: 8
Joined: Tue Nov 04, 2008 10:43 am

Post by Ilissan »

The same is here...
Amaradana
Member of TestLink Community
Posts: 398
Joined: Mon Feb 16, 2009 11:19 am
Contact:

Post by Amaradana »

Ok I got it, here is the solution those were moved to test report you can find the checkbox "METRICS", upon seletcing that you can get the values in the report.
NOTE: HELLO FMAN/MHAVALT, a small suggestion if any such changes taken place i feel that they should be documented, since these type of question will not come, at least in help file or say this is related to summate fields so in the user contribution in the file it can be updated saying that this fields are visinble in so and so place..
If this is possible, please do changes from the next release. This would be helpful.

Please let me know if anything else is required.
fman
Member of TestLink Community
Posts: 3123
Joined: Tue Nov 15, 2005 7:19 am

Post by fman »

dear users we need LOT of help with help/documentation then please whyt do not you volunteer for this taks ?
Amaradana
Member of TestLink Community
Posts: 398
Joined: Mon Feb 16, 2009 11:19 am
Contact:

Post by Amaradana »

Hi Fman, I am happy to do that, can you please tell me the procedure, so that If at all any such updations i am really happy to update.
Locked