User Tag List

Results 1 to 3 of 3

Thread: QC OTA code

  1. #1
    Junior Member
    Join Date
    May 2012
    Post Thanks / Like
    0 Post(s)
    0 Thread(s)

    QC OTA code

    Can any one help me in OTA code to get requirment id for a test case using a OTA code??

  2. #2
    Advanced Member
    Join Date
    Nov 2006
    Post Thanks / Like
    3 Post(s)
    2 Thread(s)

    Re: QC OTA code

    Show us what you have so far.
    Trudy C
    (Opinions and information contained in this post are wholly my own and do not reflect the opinions of my employer.)

  3. #3
    Junior Member
    Join Date
    May 2012
    Post Thanks / Like
    0 Post(s)
    0 Thread(s)

    Re: QC OTA code

    I am using below to move test cases from test plan to test lab.
    Now the req is to pull the test cases to test lab if they are mapped to reqs.
    I hav to add conditions in the above code to check this..

    I am working on a function to "copy" a test plan folder to test lab, i. e. a folder from test plan "becomes" a folder in test lab. The last folder of the test plan folder will be the test set in test lab.

    '--------- Put these lines in Common Script ----------'
    Dim myFolderID
    Dim myFolderPath


    '----- put the rest of the lines into Test Plan ------'
    Function TestPlan_ActionCanExecute(ActionName)

    TestPlan_ActionCanExecute = Project_DefaultRes

    '----------- Add this to your existing func ----------'

    If ActionName = "copyToLab" And _
    User.IsInGroup("Testmanager") Then
    ' Check if user has correct group
    ' Change if necessary
    End If

    On Error Resume Next
    End Function

    Sub MoveToSubject(Subject)
    On Error Resume Next

    myFolderID = Subject.nodeID
    myFolderPath = Subject.Path

    On Error GoTo 0
    End Sub

    Sub copyToLab()
    On Error Resume Next

    Set tdc = TDConnection
    Set treemgr = tdc.treemanager
    Set myTestFact = tdc.TestFactory
    Set myTestFilter = myTestFact.Filter

    ' build filter regarding the last known folder'
    myTestFilter.Filter("TS_SUBJECT") = "^\" & myFolderPath & "^"
    Set myTestList = myTestFact.NewList(myTestFilter.Text)

    'are you sure you want to copy?'
    strMsg = myTestList.Count & " Testfälle gefunden!" & vbCRLF
    strMsg = strMsg & "Kopieren für " & myFolderPath & " starten?"
    result = MsgBox (strMsg,vbYesNo,"Test Plan kopieren?")

    If result = vbNo Then
    ' no copy wanted
    Exit Sub
    End If

    'now the fun begins

    For Each actTest In myTestList
    ' Node of Subject-Folder
    Set mySNode = actTest.Field("TS_Subject")
    ' Path of Subject-Folder [Subject\... (w/o Testname)]
    myPath = mySNode.Path

    'build testset and add testinstance
    result = build_case(myPath,actTest)
    Next 'Testcase

    'now the end is near
    MsgBox "Kopieren beendet", vbOKOnly

    Set myTestList = Nothing
    Set myTestFilter = Nothing
    Set myTestFact = Nothing

    On Error GoTo 0
    End Sub

    Function build_case(CurrentPath, CurrentTest)
    Dim tdcF
    Dim TStmgr
    Dim myRoot
    Dim newTSTest

    On Error Resume Next
    ' Preparation
    Set tdcF = TDConnection
    Set TStmgr = tdcF.TestSetTreeManager
    ' Split path for loop
    subjectArray = Split(currentPath, "\")

    ' initialize variable for path
    ' Remember: Test Plan begins with Subject and Test Lab with Root!
    NewPath = "Root"
    OldPath = ""

    'Begin loop

    For idx = 1 To UBound(subjectArray)
    'save path
    OldPath = NewPath

    'get new folder
    CurrentSubName = subjectArray(idx)
    'build new path
    NewPath = Trim(NewPath) & "\" & CurrentSubname

    'search Folder
    Set newNode = TStmgr.NodeByPath(NewPath)

    'create folder if it does not exist

    If newNode Is Nothing Then
    Set TStmgr = Nothing
    Set TStmgr = tdcF.TestSetTreeManager

    If idx = 1 Then
    Set myRoot = TStmgr.Root
    Set myRoot = TStmgr.NodeByPath(OldPath)
    End If ' idx'

    Set newNode = myRoot.addNode(CurrentSubName)
    End If 'new Node

    ' if the current folder is the last folder of the array
    ' create a testset (if necessary) and add the current test

    If idx = UBound(subjectArray) Then
    'Check: Does the testset exist?
    ' create a filter with Folder-id and -name
    Set testSetF = newNode.TestSetFactory
    Set testSetFilter = testSetF.Filter
    testSetFilter.Filter("CY_FOLDER_ID") = NewNode.Nodeid
    testSetFilter.Filter("CY_CYCLE") = CurrentSubName
    Set TSList = testSetF.newList(testSetFilter.Text)

    'Add Testset only if necessary

    If TSList.Count = 0 Then
    'nothing found'
    Set testSet1 = testSetF.AddItem(Null)
    testSet1.Name = CurrentSubName
    testSet1.Status = "Open"
    'else get it
    Set testSet1 = TSList.Item(1)
    End If 'TSList

    'Check: testinstance
    'DO not use FindTestInstance (way too much overhead)
    Set TSTestF = TestSet1.TSTestFactory
    Set TSTestList = TSTestF.newList("")

    'initialize marker
    foundTS = 0

    If TSTestList.Count > 0 Then

    For Each myTSTest In TSTestList

    If myTSTest.testId = Trim(CurrentTest.ID & " ") Then
    foundTS = 1
    End If

    Next ' myTSTest

    End If ' TSTestList

    'Add Test if necessary [img]/images/graemlins/smile.gif[/img]

    If foundTS = 0 Then
    'nothing found => add test to testset
    Set newTSTest = TSTestF.AddItem(CurrentTest.ID)
    End If ' foundTS

    End If ' idx

    'Cleanup for objects (just to be sure)
    Set newTSTest = Nothing
    Set myTSTest = Nothing
    Set testSetFilter = Nothing
    Set TSTestF = Nothing
    Set TSTestList = Nothing
    Set testSetFilter = Nothing
    Set testSetF = Nothing
    Set folder = Nothing
    Set newNode = Nothing

    Next 'idx

    On Error GoTo 0
    build_case = True
    End Function



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 04:15 AM.

Copyright BetaSoft Inc.