Forum Discussion

Kostja's avatar
Kostja
Contributor
8 years ago

Copy field from one menu to another / Custom fields

Hi everybody,

 

is it possible to copy a field within a menu to another one or maybe to create a custom field with the same values?

 

For example: i would like to have the field 'Run Time' from 'Test Library->Test Case #1 -> Run History' in 'Test Library' to see the last run time at first sight.

 

(Tried to visualize it with the attached file...)

2 Replies

  • Nastya_Khovrina's avatar
    Nastya_Khovrina
    SmartBear Alumni (Retired)

    Hi Kostja,

     

    You can create a custom field of the following types:
    - Choice List (Based on SQL) – On-Premises feature. You can enter a SQL statement that will return a list of items based on your query. These display in a choice list drop down. (Note: This type of field is not compatible with Fast Edit or Import.) See details: Create Custom Fields based on SQL Queries.

     

    - Choice List (Based on Another Field) – This allows you to create a custom field that derives the items in the combo box from another feature area. Please see my sample video about adding a release title field to test sets: http://screencast.com/t/TbsVBHovz

     

    But, note that you cannot add the Run Time field to a Test library screen. The Run Time value is associated with a Test Run, not a Test (one test can has several test runs). For a Test you can add the Avg Run Time field, which show average run time value for a particular test: http://screencast.com/t/rV0uRzF0PhR.

     

    Anastasia

    Customer Care Team

    • Kostja's avatar
      Kostja
      Contributor

      Hey Anastasia,

       

      unfortunately your suggestions were not the solution i was searching for, so now i retrieve the 'Last Run Time' with a more complicated SQL query within the test (just wanted to make it easy to get the value of the last run ).

       

      Now it looks like this:

      var func = arguments.callee.toString().match(/function ([^\(]+)/)[1];
        
      var Cmd = ADO.CreateADOCommand();
        
      Cmd.ConnectionString = "Driver={SQL Server};Server=Server\\SQLEXPRESS;Database=SoftwarePlanner;Uid=uid;Pwd=pwd;";
        
      Cmd.CommandText = "select TestRunItemRunTimeFormated from dbo.View_TestRunsAdHoc where TestRunItemDateFinished = (select max(TestRunItemDateFinished) from dbo.View_TestRunsAdHoc where TestRunItemTestName = (select Title from dbo.View_TestAutomations where EntryPoint like '%"+ func +"'))";
        
      var RecSet = Cmd.Execute();
        
      var rsRT = RecSet.Fields.Item(0).Value;

       

      Although thank you for reply, still helpful for other purposes.