cancel
Showing results for 
Search instead for 
Did you mean: 

Global Variables in CBTA Composite Testcases possible ?

Former Member
0 Kudos

All,

I am building a CBTA Composite testcase, in which one export value of the first test case is used in many other teststeps.

The handover of the output parameter of testcase 1 can be done using local referencing.

However, since the amount usage of the parameter is high, i rather would use an environment context variable.

However, it seems that the scope of the environment context variables is on testcase level, and not on global, Composite Testcase level.

Passing parameters using a custom function would be a possibility as well, storing the data in a file, or a computer environment variable.

Preferably i would like to use Global variables, is that possible ?

Regards,

Arjan

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member

All,

Unfortunately the only/easiest option seems to be to store the variable in a file, which i suggested already in the question. For this i created a set of custom functions to work with INI files; ReadINIString, WriteINIString, DeleteINIString, DeleteINISection

Since this is a forum to help eachother, feel free to use the code:

https://github.com/arjanvdbroek/SAP-CBTA/

Arjan

former_member640460
Discoverer
0 Kudos

Hi All..

Is it still the same with the CBTA in the new patch also 3.12.6 , passing parameter across composite test cases.

Former Member
0 Kudos

Hi Arjan,

As per my knowledge it is not possible with CBTA to refer to parameter across composite test cases.

Also CBTA doesn't support exporting output parameter values to TDC.

As Jan specified in above comment, you can create a custom function to export this parameter to local file, I would prefer excel which can be referred by another composite script.

I have tried using custom component for exporting and importing data to excel and it works fine.

Regards,

Sachin

Former Member
0 Kudos

Arjan,

Did you find a solution?  I have been wondering if you could update a value in the test data container.  Haven't had a chance to try it yet.  I wanted to save a document number for example to show what document was created the last time the script was run.

Rick Shelton

Former Member
0 Kudos

Hi Rick

To support your need, you can create a custom component as I did to save/load a parameter from file. Otherwise I am not sure if there is any solution based on test data container.

Hope it helps.

Former Member
0 Kudos

Jan,

Good idea.  I was hoping for that capability to already be available.  I'll be greedy and ask if you could share a simplified version of your custom script?

Former Member
0 Kudos

Hi Rick.

This part of script is used to save parameter to file. My script works with to parameters - File name and Data (I pass it in CBTA).

    'Writing to file
    If objFS.FileExists(FileName) Then
        Const ForAppending = 8
        Set objFile = objFS.OpenTextFile(FileName, ForAppending)
    Else
        Set objFile = objFS.CreateTextFile(FileName)
    EndIf
    objFile.WriteLine(DataToSave)
    objFile.Close


And also this guide helped me in doing this.

https://support.sap.com/content/dam/library/SAP%20Support%20Portal/support-programs-services/solutio...


Have a look, hope it helps.