Search code examples
c#almtest-plan

Programatically (C#) update QC/ALM Test Plan > Test Script tab content


I am trying to programmatically (C#) overwrite the default generated contents of the Test Script tab for a QC/ALM VAPI-XP-TEST Test Plan.

I have been able to create/update the content of the Details, Design Steps, Parameters, etc tabs using code from the web, but cannot find refs on how to do the Test Script tab.


Solution

  • SOLUTION:

    1. run the first 6 lines of code in step 5 to create a VAPI-XP-TEST.

    2. In the created test > Test Script tab, go to the referenced Script path in Windows Explorer. Looks something like this:

      C:\Users\user_id\AppData\Local\Temp\TD_80\ip_address\hex_code\Test

    3. open any child node folder path all the way until you see a test.sr file

    4. Copy the test.sr file to the same folder as your VB Script file

    5. change C# code as follows:

      
           TestFactory TF = qc.TestFactory; // qc is the ALM connection
           Test test = (Test)TF.AddItem(System.DBNull.Value);
           test["TS_NAME"] = "test name";
           test["TS_TYPE"] = "VAPI-XP-TEST";
           test["TS_SUBJECT"] = "Test Plan folder path/node id";
           test.Post();
           // add your script.vbs to Test Script tab of Test Plan test. 
           var es = test.ExtendedStorage; 
           es.ClientPath = "folder of your script.vbs and copied test.sr file"; 
           es.Save("script.vbs, test.sr", true);
       
    6. re-run your C# code and check Test Script tab of Test Plan test to see your VB script.