Re: Quality Center VB Scripting (3666 Views)
Reply
Occasional Visitor
Jackson00412
Posts: 2
Registered: ‎04-29-2010
Message 1 of 13 (4,129 Views)

Quality Center VB Scripting

Hey guys/gals,

I'm new to QC and would like to see some vb script examples.

Post away!

Thanks in advance,
Jackson
Frequent Advisor
Sukanya_R
Posts: 58
Registered: ‎04-20-2009
Message 2 of 13 (4,129 Views)

Re: Quality Center VB Scripting

QC is a test management tool. You do not need to know VB Scripting for it. Use of QTP requires VB Scripting.
Valued Contributor
shambu
Posts: 56
Registered: ‎03-10-2008
Message 3 of 13 (4,129 Views)

Re: Quality Center VB Scripting

Hey jackon,

You want more info on VB script and QTP, you can check out my Blog.

http://test-automate.blogspot.com/
http://qtp-automate.blogspot.com/
Valued Contributor
Anliker Marc
Posts: 87
Registered: ‎06-04-2009
Message 4 of 13 (4,129 Views)

Re: Quality Center VB Scripting

Hi Jackson

The last few years I wrote some thousend lines of VBScripts to enhance the possibilities of QC. It makes no sense to provide you with this information if you are not familiar with VBScipt. But I suggest to have a look to the scipts in a new project, you will see only the "empty" subs and functions. Then try the scripts wizards and look where and how the workflow is changed. A possibility is also to check the examples of scripts in the help (however they are not all working...).
Then just try to do some simple changes, you will get familiar with scripting quite soon.
Marc
Occasional Visitor
Jackson00412
Posts: 2
Registered: ‎04-29-2010
Message 5 of 13 (4,129 Views)

Re: Quality Center VB Scripting

Hi Marc,

I have extensive familiarity with vb scripting, and would not mind seeing some of your code snippets. I am just requesting some code snippets in order to get a "feel", if you will, for the scripting environment in QC.

Please get back to me.
Honored Contributor
Rhonda Robinson
Posts: 3,159
Registered: ‎11-13-2007
Message 6 of 13 (4,129 Views)

Re: Quality Center VB Scripting

That's just it - you're being too vague.

There are lots of different code snippets available in the Administrator's Guide and/or the API Reference Manual.

There is code for sending email(s) to specific people in specific circumstances. There is code to make the Comments field Read Only. There is code to automatically complete one field based upon the value of another field. And on, and on, and on.

Please be specific in what you want to accomplish using the code, and someone may have an idea as to how to assist you.
Valued Contributor
Anliker Marc
Posts: 87
Registered: ‎06-04-2009
Message 7 of 13 (4,129 Views)

Re: Quality Center VB Scripting

Hi Jackson

Yes, I agrre with ronda. If you have specific topics, a lot of people in this forum will help you. It make no sense to provide you with a lot of code if we don't know what you want to do.

Marc
Occasional Contributor
Yossi T
Posts: 5
Registered: ‎08-31-2010
Message 8 of 13 (4,129 Views)

Re: Quality Center VB Scripting

hi there

im new to QC and would like to know how do i start writing scripts for QC.

i.e can some one please point me to a tutorial on how to make a "hello world" in the QC enviorment.

cheers
yossi
Valued Contributor
Anliker Marc
Posts: 87
Registered: ‎06-04-2009
Message 9 of 13 (4,129 Views)

Re: Quality Center VB Scripting

Hi YossiT

Try it like this:

In Sub Req_MoveTo add the following code:

If User.UserName = "MyAccount" Then
MsgBox "Hello World!"
End If

Each time you move the cursor to a requirement, you will see the message. Please replace "MyAccount" with your account. The if clause is to prevent other users being affected with your code.

Have fun!
Marc
Frequent Advisor
Nick_NIPR
Posts: 41
Registered: ‎10-05-2012
Message 10 of 13 (3,902 Views)

Re: Quality Center VB Scripting

Hi Folks.

 

I also have some questions regarding vbscripting in the QC workflow.  I do understand some fundimental elements and have an idea of what I want done.   If there is another place in the forum where I should post this, just let me know.

 

I'm not sure if it's possible, if it's not that is going to be very dissapointing.  I've talked to HP Support, they don't support any customization.  Honestly, that's the only part I have questions regarding, the rest of QC/ALM seems pretty straight forward to me, but lacking in some options/features I'd like.

 

So, essentially, all I want to do is link some system/user fields from the req. module to the testing module so that when I generate tests from the requirements I can move some of the data from the fields over and not have to enter all the information twice.

 

I know I'm in the right place in the workflow because I put a message box and it pops up when I go to generate the test but I can't get any of the fields to actually sync up.  QC does this by default (guessing it's in the compiled code somewhere) when it comes to the "Description" field, but no others.

 

I'm guessing I'm not initiating the req.objects correctly so that the script picks them up to link them to the test fields.

 

Here is a snipppet of my code.

 

Sub Test_New
On Error Resume Next

  Dim Req_Fields
  Set Req_Fields = TDConnection.Req_Fields

  set tFactory = TDConnection.TestFactory
  testObj = tFactory.NewList("")

  reqList = testObj.GetCoverList


  MsgBox  "This is Where This Is!"
  Move_Required_Fields

  set Test_Fields.Field("TS_USER_02").Value = Req_Fields.Field("RQ_USER_30").Value
  set Test_Fields.Field("TS_DEV_COMMENTS").Value = Req_Fields.Field("RQ_DEV_COMMENTS").Value
  set Test_Fields.Field("TS_USER_08").Value = Req_Fields.Field("RQ_USER_04").Value
  set Test_Fields.Field("TS_USER_013").Value = Req_Fields.Field("RQ_USER_08").Value

  On Error GoTo 0
End Sub

 Any help would be greatly appreciated.

Honored Contributor
Trudy Claspill
Posts: 3,767
Registered: ‎09-09-2010
Message 11 of 13 (3,887 Views)

Re: Quality Center VB Scripting

One problem with your code is that Req_Fields is getting you the list of fields for a requirement, not the information for a specific requirement.

You need to first create variables that point at the specific Requirement and the specific Test where you want to synch the data. In some places in the workflow, the scripts automatically have access to the "current" entity being operated on - i.e. in a Test Plan workflow script, you may have a default object already pointing at the current Test Case entity. Most of the time that kind of default object only points to the entity relevant to your current module - a Requirement or a Test Case or.... So you will probably need to do some code to retrieve one or the other entity.

That's just a quick comment trying to point you in the right direction. If you haven't already, you should also look at the Administrator Guide sections on Workflow Customization. They have lots of examples, and talk about the default object variables I mentioned.
[If this post solves or helps solve your issue, mark the thread as solved and give KUDOS to the author for their assistance.]

(Opinions expressed in my postings are mine alone, and do not reflect the opinions of my employer.No warranties express or implied for any solution/suggestion posted.)
Frequent Advisor
Nick_NIPR
Posts: 41
Registered: ‎10-05-2012
Message 12 of 13 (3,666 Views)

Re: Quality Center VB Scripting

Thanks Trudy,

 

I actually got this to work after I fixed my code.  It does seem rather flaky though.  It seems to work sometimes and sometimes it does not. 

 

I've experemented with checking-in, checking-out the requirements, tests it just seems really particular for some reason.  Perhaps like it's not catching it, I've removed the msgbox I had in the sub as I am certain I'm following the same process now.  I'm using QC 11, has anyone else had this issue?

Occasional Visitor
DIONMOT
Posts: 1
Registered: ‎07-28-2014
Message 13 of 13 (867 Views)

Re: Quality Center VB Scripting

Hi

 

Again: novice and probably repeating question. Sorry, could someone help with finding documentation and examples.

 

My task is:

we have small sproject which should create\update HP QC issues. 

For now I have all required values in separate Oracle DB. And I have link + user\password for HPQC

 

I'm sure that exist some automated possibilities for creating and closing issues in HP.

 

So, please, help me with starting point.

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.