Forum Discussion

scottkib's avatar
scottkib
Occasional Contributor
10 years ago

I need help with QC Defect Creation via Groovy in SOAPUI

According to the OTA API reference to create a defect using BugFactory Object

 

Visual Basic

Public Function AddItem( _
   ByVal ItemData As Variant _
) As Object

ItemData
When creating defects, always pass Null as the ItemData argument.

 

The VB example is below, and I am looking for a way to do this in Groovy, but when using 'null', I get an error.

 

 

Set Bug1 = BugF.AddItem(Null)
    Bug1.Summary = "Lydia Bennet is 15 years old."
    Bug1.Status = "New"
    Bug1.Priority = "3-High"
    Bug1.Field("BG_SEVERITY") = "3-High"
    Bug1.DetectedBy = c_qcUser
    Bug1.Field("BG_DETECTION_DATE") = Date
    Bug1.Post

 

Error:

com.jacob.com.ComFailException:  Invoke of: 3 

Source:

Description:

1 Reply

  • scottkib's avatar
    scottkib
    Occasional Contributor

    I figured it out.

     

    The 'Null' that VB is passing is a variant Null where all required fields must be populated in order to later post.  The traditional 'null' parameter in Groovy is not the same, and I needed a variant.

     

    Using scriptom:  

     

    import org.codehaus.groovy.scriptom.*

     

    groovyNull = VariantNull.VARIANTNULL
    defect = bugFactory.AddItem(groovyNull)