Saturday, November 27, 2010

HTML5 Gaming Library Ideas

At Øredev this year and I went to a presentation on Cocos2d for Iphone, "a framework for building 2D games, demos, and other graphical/interactive applications on the Iphone". Since I have been working with HTML5 this gave me an idea that there should be a similar library for HTML5.

This is some of the main features that I think need to be a part of it:

Scene
The Scene object should automaticaly cover the entire canvas/screen.
Holds a list of Nodes
Can hold a list of Layers
An Application can have many Scenes.
- A pause scene
- Main menu scene
- Game scene
It should be possible to have transistions between Scenes

Layers
This is an invisible container for nodes. It can be used to create layered effects such as a background layer and a front layer.

Nodes
Nodes are the objects.
Attributes
-position ( in relation to their parent node, scene or layer )
Should the position be midpoint or left corner. I think both should be possible and can be set depending on what kind of object it is we are working with. E.g. Tile(left corner), Bullet(midpoint)
Methods
-Move To
-Move
-Scale
-Rotate
-RegisterEvent

Sprite
A sprite is a type of node that has an image
Used for images and textures.

Label
A sprite is a type of node that has text
Attributes:
-Text
-Font
-Size
Methods
-Update Text

Prebuilt Nodes Structures
To make it easy for people there should be inbuilt node structures.
E.g.
Menu
-Has menu items

Node Factory
There should be a node factory that creates nodes. Similary to Strophe and Jquery
The factory could be accessed through any other node or scene to create a child node
$scene.cnode(parameters);
$node.cnode(parameters);

Identification
Should use Jquery like identification
I am using the JQuery operator $ in my example but likely it would need to be something else.
$('#apa') - Find object with Id 'apa'
$('node') - All nodes
$('.sprite') - All nodes of class sprite (and it should be possible to create your own classes.

Sequence of Actions
Like JQuery and Strophe objects (nodes,scenes,layers) should return them self if nothing else is returned. This makes it possible to to sequences.
$('#apa').rotate(5).scale(-1).move(150)
$(this).cnode(parameters).move(150).up().scale(160)

Schedule
There should be schedule methods to do time based gaming.

Physics
Could be joined with BOX2DJS for 2d physics

Director
Should be a director that controls the flow of things.

Sound
Background Music
Effects

Particle System
It would be coold to have particle system to create fire and stuff like that.

Tuesday, November 16, 2010

QTP: Connecting to SQL Database

This post describes how you can connect to a SQL Database, execute an SQL statement and loop through the results from QTP using vbscript. The process is pretty straight forward, the main issue is getting the correct connection string for your database.

In the example I am connecting to Access database Northwind. But it should be the same code for connecting to any database, just a different connection string. In my current project we are using this to connect to a IBM DB2 database and it works great.

Option Explicit

Dim connectionString, sql, cn, cmd, rs

' Connection String required to connect to MS Access database
connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program Files\Microsoft Office\Office10\Samples\Northwind.mdb;"
' SQL statement to run
sql = "select EmployeeID,LastName from employees"

' Create ADO Connection/Command objects
set cn = createobject("ADODB.Connection")
set cmd = createobject("ADODB.Command")

' Open connection
cn.open connectionString
' Associate connection object with command object
cmd.ActiveConnection = cn
' Set the SQL statement of the command object
cmd.CommandText = sql

' Execute query
set rs = cmd.execute

' Enumerate each row in the result set
while rs.EOF <> true and rs.BOF <> True
' Using ordinal
msgbox "Employee ID: " & rs(0)
' Using name
msgbox "Last Name:" & rs("LastName")

rs.movenext
wend

' Close Connection
cn.Close

Tuesday, October 19, 2010

Multiple Binds/Triggers in JQuery

Today I experimented with Multiple binds/triggers in Jquery. What I wanted to do what to raise an event, lets say "Add Contact" and have multiple other elements react on that. Well, it wasn't as smooth as I expected since you have to trigger an event on a specified element and only that element or a parent element can bind to it.

Example:
Take this very simple webpage. The scenario is that I wan't to trigger an event when clicking on "Add Contact" and on that event something should happen with both my contact list and my twitter widget.
...
<body>
 <div id="main">
  <button id="add_contact">Add Contact </button>
  <div id="contact_list">Contact List: </div>
  <div id="twitter_widget">Twitter Widget: </div>
 </div>
</body>
...

So if I want to trigger an event on the button you have to trigger it on some element. If I trigger it on contact_list then only that element can bind to it, and if I trigger it twitter_widget then contact_list can't bind to it. So the solution is to bind it to both elements.

We'll have to image that I have a variable with the contact object
$('#add_contact').click(function() {
 $('#contact_list, #twitter_widget').trigger('add_contact', contact );
})

And then add binds to both your elements.
$('#contact_list').bind('add_contact', function(e, contact) {
 $(this).append('* ' + contact.name + '
');
});

$('#twitter_widget').bind('add_contact', function(e, contact) {
 $(this).append('> Tweeted: I added ' + contact.name + ' to my contact list, I think this is the beginning of a beautiful friendship.
');
});

I want to finish this post with a lengthy example where I use this technique and also the reverse. Where I have two buttons that trigger the same event on another element. Great for logging. And also an example where one button click triggers more than one event. It know it looks messy in a this post so just copy-paste it to your favorite editor, save as .html and open in a browser and you will see the magic.

Enjoy!
<html>
 <head>
  <title>Welcome to Jquery Multiple Bind Example!</title>
  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.js"></script>
 </head>
 <body bgcolor="white" text="black">
  <center><h1>Welcome to Jquery Multiple Bind Example!</h1></center>

  <p id="add_contact" style="background:#faa; width:300px;">
   <b>Add Contact</b><br/>
   <input id="name"/><br/>
   <button id="add">Add Contact</button><br/>
   <script>
    $('#add').click(function() {
     $('#contact_list, #twitter_widget').trigger('add_contact', $('#name').val() );
     $('#log').trigger('log', 'Contact Added: ' + $('#name').val() );
    })
   </script>
  </p>

  <p id="connect_div" style="background:#faa; width:300px;">
   <b>Connect To Server</b><br/>
   <button id="connect">Connect</button><br/>
   <script>
    $('#connect').click(function() {
     $('#log').trigger('log', 'Connected to the server.' );
    })
   </script>
  </p>

  <p id="contact_list" style="background:#faa; width:300px;">
   <b>Contact List</b><br/>
   <script>
    $('#contact_list').bind('add_contact', function(e, name) {
     $(this).append('* ' + name + '<br>');
    });
   </script>
  </p>

  <p id="twitter_widget" style="background:#faa; width:1000px;">
   <b>Twitter Widget</b><br/>
   <script>
    $('#twitter_widget').bind('add_contact', function(e, name) {
     $(this).append('> Tweeted: I added ' + name + ' to my contact list, I think this is the beginning of a beautiful friendship.<br>');
    });
   </script>
  </p>


  <p id="log" style="background:#faa; width:1000px;">
   <b>Log</b><br/>
   <script>
    $('#log').bind('log', function(e, name) {
     $(this).append(new Date().getTime() + ':' + name + '<br>');
    });
   </script>
  </p>
 </body>
</html>

Saturday, October 16, 2010

Getting started with Ngix and Strophe.js on Ubuntu

In this post I will get you started on Nginx and Strophe.js
If you missed it, check out my post on Getting started with Ejabberd, it's a precondition to get the stuff in this post going.

I am doing this on Ubuntu 10.04, but I am sure you'll get this running on any Linux flavor.
Lets get started!

Installing Nginx
>sudo apt-get install nginx

Change port on Nginx
I am using port 80 for something else so I will change the port to 8080, this port will be used in all subsequent examples. And you should check the root directory, on some systems it's /var/www, but on mine it was /var/www/nginx-default so that's what I'll use in the rest of this example.
>sudo nano /etc/nginx/sites-available/default
server {
listen 8080 default;
server_name localhost;
...
location / {
root /var/www/nginx-default;
index index.html index.htm;
}


Reload Nginx
sudo nginx -s reload
-s is for signal
Note: On some systems, e.g. Kubunut 10.10, nginx does not start by default. In that case you can start it with >sudo nginx

Check that it works
Point your webbrowser to http://localhost:8080/
You now get a message saying Welcome to nginx!
Yay! It works

Download Strophe.js
Download Strophe.js from http://code.stanziq.com/strophe/
Unzip Strophe somewhere
>unzip strophejs-1.0.1.zip -d ~
Create a Symlink from the root web directory to the folder
>sudo ln -s ~/strophejs-1.0.1

Check that you can reach the page
Go to http://localhost:8080/strophejs-1.0.1/examples/echobot.html
You should now see a page with a simple page with a two field form.

Lets try it out!
Enter form
JID: jonas@localhost
Password: jonas
And click "connect"
Strophe is connecting.
Strophe is disconnecting.

It's not working but we don't expect it to. If you investigate with Firebug you will see that the server is trying to connect with BOSH to http://localhost:8080/xmpp-httpbind and since don't have anything there in our Nginx Web Server the connection fail. What we need to do now is add what is called to proxy_pass to /xmpp-httpbind so it directs the traffic to Ejabbers http-bind page, which we set up in the previous post.

Add xmpp-httpbind redirect Nginx
>sudo nano /etc/nginx/sites-available/default
server {
...
location /xmpp-httpbind {
proxy_pass http://localhost:5280/http-bind;
}
...
}

And reload
>sudo nginx -s reload

Start Echobot
Go to http://localhost:8080/strophejs-1.0.1/examples/echobot.html
Enter same details as above and click "connect".
Now you should get...
Strophe is connecting.
Strophe is connected.
ECHOBOT: Send a message to jonas@localhost/15070348051287336618874524 to talk to me.

Great, almost there.
Use an IM, I use Empathy, to connect to localhost with user jonas2@localhost/jonas2 and then send a message to jonas@localhost. Lets send "Test"
Now in the webpage you should see
ECHOBOT: I got a message from jonas2@localhost/c69ef25a: Test
ECHOBOT: I sent jonas2@localhost/c69ef25a: Test

And in Empathy see
sent jonas2@localhost 19:33: Test
received jonas@localhost 19:33: Test


And now you can see that the echobot webpage works. I hope you have enjoyed these two posts on getting started with Ejabberd, Nginx and Strophe.js, if you have any questions or comments feel free to comment on this post.

See you soon!

Friday, October 15, 2010

Getting started with Ejabberd on Ubuntu

This is a post on getting started on Ejabber on Linux. I am using Ubuntu 10.04 but it should be the same on most linux flavors. This is part of a html5-xmpp project I am doing with a friend. More on that later.

Lets get started!

Install Ejabberd
>sudo apt-get install ejabberd

Give user admin rights
To give user admin rights you need to edit the config file.
>sudo nano /etc/ejabberd/ejabberd.cfg
In the file you need to add a user who will be admin. To confuse matters, I will call this user "admin" and put him on the host "localhost" which is default.
%% Admin user
{acl, admin, {user, "admin", "localhost"}}.

Ctrl-X to Exit and Save

Register User
Ejabber comes with a admin command called ejabberctl, with that you can do the most wonderful things. Lets register the user "admin" on "localhost" with the password "secret"
>sudo ejabberdctl register admin localhost secret

See all registered user
To see all the users on a host run "ejabberdctl registered_users"
>sudo ejabberdctl registered_users localhost
ejabberdctl should now return a simple
admin

Register bunch of users
Lets register two users, we will need them in the next post
>sudo ejabberdctl register jonas localhost jonas
>sudo ejabberdctl register jonas2 localhost jonas2
>sudo ejabberdctl register jonas3 localhost jonas3


Unregister User
This is how you unregister users if you need to do that.
>sudo ejabberdctl unregister jonas3 localhost

Restart Server
Lets restart the server
>sudo ejabberdctl restart

Webadmin
There is a webadmin where you can administer and monitor your ejabber server
Go to http://localhost:5280/admin/
Log in with admin/secret to see all the wonderful stats

Get ready for XMPP


Now that we have the server up and running with a bunch of users, we need to check if it's equipped with http-bind so that we can use BOSH for XMPP communication.

Edit config file
Make sure your config file has http-bind enabled
>sudo nano /etc/ejabberd/ejabberd.cfg
It should look like this:
{5280, ejabberd_http, [
http_bind,
http_poll,
web_admin
]}


And add the http_bind module
{modules,
[
...
{mod_http_bind, []},
...
]}

Lets restart the server
sudo ejabberdctl restart

Verify it on the webpage
Go to http://localhost:5280/http-bind
You should now see a text which reads something like
ejabberd mod_http_bind v1.2
An implementation of XMPP over BOSH (XEP-0206)
This web page is only informative. To use HTTP-Bind you need a Jabber/XMPP client that supports it.


Great, now everything seems to be working. Now check out the next post to get Strophe.js and Nginx up and running!

Thursday, October 14, 2010

Setting up QTP with Terminal Emulator

This posts shows the settings for connecting QTP to terminal emulators 3270 and AS400. These settings works for us in my current project and hopefully it'll work for you or at least point you in the right direction.

Settings for attachmate
Vendor: Attachment (WRQ)
Emulator: Extra 7.1
Protocol: 3270




Settings for IBM AS400
Vendor: IBM
Emulator: IBM PCom
Protocol: Auto-Detect

Thursday, September 9, 2010

QTP: Error Handling

I added Error handling to DataTable.Import and I would like to show you the result.

Function ImportDataTable(sheetpath)
Dim errorNumber, errorMessage

' Import Data Table
On Error Resume Next
DataTable.Import(sheetpath)
errorNumber = Err.number
On Error GoTo 0

' Error handling
If errorNumber <> 0 Then
errorMessage = "Could not load file. Did you supply a correct path?"
msgbox errorMessage & " Test will Exit"
Reporter.ReportEvent micFail, "Test Stopped", errorMessage
ExitTest
End If

End Function

Monday, August 30, 2010

QTP: Working with Excel Spreadsheets

Example of Code:
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.WorkBooks.Open("J:\My Documents\users.xls")
Set objDriverSheet = objWorkbook.Worksheets("users")

c = objDriverSheet.usedrange.rows.count

'We Start Looking at Number two since first row is column names
For i=2 to c
userId = objDriversheet.cells(i, 1)
If expectedUserId = userId Then
msgbox userId
End If
Next

Set objExcel = Nothing
Set objWorkbook = Nothing
Set objDriverSheet = Nothing

Wednesday, August 18, 2010

QTP: Tips and trix

Here i will gather several lessons that I have learned while working in QTP/QC. Lessons that I want to share but are not complicated enough to warrant their own post. I will continue to add new lessons here as I learn more about QTP/QC.

1) Sync Problems When Uploading With The QCUtil API
When uploading a resource to QC using QCResource.uploadResource the file is uploaded to QC, but it is not synced with the datatable. So if you try to fetch it using DataTable.import or .importSheet you will get a version of that might not match with the one you uploaded.
Workaround: Use QCResource.downloadResource instead of import. That will go straight for the file and you will not suffer any sync problem.

2) "This files is used by somebody else"
If your QTP breaks down while working with a checked out file you might get a message saying something like "This file is checked out by somebody else". And you will get a error message in QC if you try to check in the file, even though QC recognised it is you who checked out the file.
Fix: Open the QC Connection dialoge from QTP. Disconnect and reconnect. This might fix it.

3) Version management in QC from QTP
Check out files with:
Resource.VC.CheckOut ""
And check the back in with
Resource.VC.CheckIn "Comments"
Note: Resource should be a QCResource object

4) Asserts
You can use the Reporter object to report fail and pass in QC/QTP
Reporter.ReportEvent micFail, "name", "detailed comment, e.g. X is not equal Y"
Reporter.ReportEvent micFail, "name", "detailed comment, e.g. everything seems to be in order"

5) New Line/Page Break
Use vbCrLf to make a Page Break and Carrige Return in vbscript
Example:
msgbox "Row one." + vbCrLf + "Rwo two!"

Thursday, August 12, 2010

VBScript: Working with Windows Environmental Variables

Option explicit

'Declare Variables
Dim WshShl, Shell, UserVar

'Set objects
Set WshShl = WScript.CreateObject("WScript.Shell")
Set Shell = WshShl.Environment("User")

'Read variable
UserVar = Shell("jonas123")

'Output value to msgbox
WScript.Echo "Your name is " & UserVar & "!"

Shell("jonas123") = "monkey"

'Cleanup Objects
Set WshShl = Nothing
Set Shell = Nothing

'Exit Script
WScript.Quit()

Wednesday, August 11, 2010

QTP: Read from/Write to Test Resources in QC

Finally found the answer to how to Write to Test Resources. It's possible to use the QC OTA APIs to export it to QC. I made a function for loading and saving test recourses to and from QC.

Update 1
Added code for checking in and out of QC with comment

Update 2
Changed LoadResource function so it uses DownloadResoruce method from the API. Works much better that way.


Option Explicit

Function LoadResource(ResourceName)
Dim Resource, TempFolder

' Setting Temp Folder
TempFolder = environment("SystemTempDir")

' Load Resource
Set Resource = GetResource(ResourceName)

' Download Resource To Temp, The Entire Data Table is Downloaded
Resource.DownloadResource TempFolder, True

DataTable.AddSheet(SheetName)

DataTable.Import TempFolder & "\" & Resource.Filename
End Function

Function SaveResource(ResourceName)
' Dim values
Dim Connection, TempFolder, ResourceFactory, ResourceList, Resource, ItemCount, CurrentItem

' Create a Connection To QC
Set Connection = QCUtil.QCConnection

' Setting Temp Folder
TempFolder = environment("SystemTempDir")

' Create Resource Obejects
Set ResourceFactory = Connection.QCResourceFactory
Set ResourceList = ResourceFactory.NewList("")
Set Resource = Nothing

' Loops through all items and returns the correct one
For ItemCount = 1 To ResourceList.Count
CurrentItem = ResourceList.Item(ItemCount).Name
If UCase(CurrentItem) = UCase(ResourceName) Then
Set Resource = ResourceList.Item(ItemCount)
End If
Next

Set ResourceFactory = Nothing
Set ResourceList = Nothing

Resource.VC.CheckOut ""

' Export Datatable to Temp Directory
Datatable.Export TempFolder & "\" & Resource.Filename

' Upload Datatable in Temp to Resources Folder
Resource.UploadResource TempFolder, True
Resource.VC.CheckIn "Automated check-in from QTP by SaveResource"

Set Resource = Nothing

End Function

QTP: Do things on first and last row

If DataTable.GetCurrentRow = 1 Then
Dim dttable
dttable = "[QualityCenter\Resources] Resources\TestData"
DataTable.Import(dttable)
End If

'Do Stuff

If DataTable.GetCurrentRow = DataTable.GetRowCount Then
Export Stuff
End If

Tuesday, August 10, 2010

QTP: Working with QTP Environment Variables

This posts describes how to Working with QTP Environment Variables in vbscript. Note that this is NOT Windows Environment Variables ( see seperate post on that issue ).

Different Types of Environmental Variables
There are 3 kinds Envrionemental Variables
Built-In ( Read only )
User defined internal ( Read and Write )
User defined external ( Saved in XML on Disc or in QC, Read Only )

Add test variable
For the sake of this post I added a environment variable called "jonas"
In QTP: In File > Settings > Environment > Variable type: User-defined add a internal user varible and give it a value. I gave mine 'apa'

Read
Reading the environment variable is now easy

'Save to local variable
UserVar = environment("jonas")
'Now UserVar contains 'apa'
or
'Show messagebox with environment variable
msgbox environment("jonas")
' "apa" is displayed

Write
Writing is even easier ( Can only be done for internal user variables )
' Save new value to environment variable
environment("jonas") = "monkey"
Note, this is not saved after the test script has finished.

List of Built-In Variables
ActionIteration
ActionName
ControllerHostName
GroupName
LocalHostName
OS
OSVersion
ProductDir
ProductName
ProductVer
ResultDir
ScenarioId
SystemTempDir
TestDir
TestIteration
TestName
UpdatingActiveScreen (true/false)
UpdatingCheckpoints (true/false)
UpdatingTODescriptions (true/false)
UserName
VuserId

Printing all Built-In Environment Variables
Here is code for showing a msgbox with all the built-in variables with names and values.
a =Array("ActionIteration", "ActionName", "ControllerHostName", "GroupName", "LocalHostName", "OS", "OSVersion", "ProductDir", "ProductName", "ProductVer", "ResultDir", "ScenarioId", "SystemTempDir", "TestDir", "TestIteration", "TestName", "UpdatingActiveScreen", "UpdatingCheckpoints", "UpdatingTODescriptions", "UserName", "VuserId")
message =""

for each x in a
message = message & x & ":" & environment(x) & Chr(13) & Chr(10)
next

msgbox(message)

QTP: How to Read or Write Windows Envrionment Variables

It is easy to read and write Windows Environment Variables from QTP using VBScript. Note that this is NOT done using what is called "Environment Variables" in QTP.

Add test variable
For the sake of this post I added a environment variable to windows called "jonas123"
In Xp: In Control Panel > System > Advanced Tab > Environment Variables add a user varible and give it a value. I gave mine 'apa'

Setup
The following code gives you the basic objects for manipulating windows Environment Variables
Option explicit

'Declare Variables
Dim wScript, Shell, UserVar
'Set objects
set wScript = CreateObject("WScript.Shell")
Set Shell = wScript.Environment("User")

Read
Reading the environment variable is now easy

'Save to local variable
UserVar = Shell("jonas123")
'Now UserVar contains 'apa'
or
'Show messagebox with environment variable
msgbox Shell("jonas123")
' "apa" is displayed

Write
Writing is even easier
' Save new value to environment variable
Shell("jonas123") = "monkey"

Adding a variable
Just write to a variable that does not exist
Shell("jonas1234") = "banana"

What about system environment variables?
In your setup code just load "System" Environment instead of "User"
Set Shell = wScript.Environment("System")

Tuesday, June 22, 2010

QTP: Get an attachment from a Test in QC

Function getAttachmentFromQC(attachmentName)
Dim returnValue

Dim attachmentList
Set attachmentList = QCUtil.CurrentTest.Attachments.NewList ("")

For Each Attachment in attachmentList
Attachment.Load True, ""
If InStr(Attachment.FileName, attachmentName) Then
getAttachment = Attachment.FileName
End If
Next

End Function


Usage
This code imports the first sheet from a attached excel sheet
DataTable.ImportSheet getAttachmentFromQC("test_data.xls") ,1 ,1

Edit "Generate Script" Template for Quality Center QT Add-In

In this post I will update the Script that generates a script from manual test steps in QC. It is assumed that you have the "QuickTest Add-in For Quality Center" installed.

Locate Script
YOUR_HP_DIRECTORY\QuickTest Add-in For Quality Center\bin\Templates\Template10\Action1
Or similar

Make Backup
Copy "Scripts.mts" to a file called "Script.mts.backup"

Edit File
Open "Script.mts" in Edit Software, e.g. Notepad
Script looks like this
' This test was created using HP Quality Center[No Page Break]


Update file
Changing file to this
' This test was created using HP Quality Center[Page Break]
Option Explicit[Page Break]
[Page Break]

Close and Save file

Try it out
Start QC
Create a new test and add some steps
Click the "Genereate Script" button, select "QUICKTEST_TEST" and confirm
Select "Test Script" tab
Change to "Expert View"
Check the results

To edit Step template
Goto
YOUR_HP_DIRECTORY\QuickTest Add-in For Quality Center\bin\Templates

Edit ManualTemplate.txt

Monday, June 21, 2010

Add user defined field to test case to Quality Center

Add Custom Field
You need admin right to do this
Tools > Customize
Project Entities > Test > User Fields
Select first ZZTC_Customize_AlfaNum_xx field

Make it visible
Tools > Customize
Groups
Select the group
View
Select Tab Test Cases
Select "Test Cases Data-Hiding Filter"
Select Tab Visible Fields
Mark your new field
Click OK
Close and Save

Now it should be visible

QTP QC integration: QCUtil

There is magic variable thats called QCUtil that gives you instant access to values in QC, if the QTP script was started from QC.

Example of Usage
Set currentTSTest = QCUtil.CurrentTestSetTest
currentTSTest.Field("TC_USER_11") = 4
currentTSTest.Post

Check if connected to Quality Center
If QCUtil.IsConnected Then
...
End If

All methods in QCUtil
CurrentRun - Returns the Quality Center OTA Run object, which represents the current run.
CurrentTest -
CurrentTestSet -
CurrentTestSetTest -
IsConnected -
QCConnection -

QTP: Using a parameter in the DataTable as a global incrementer

I needed to find a way to have a global incrementer to count all iterations that passed or failed during a QTP run.
This is one way of doing it using DataTable

Adding a new Sheet in The DataTable
DataTable.AddSheet("Temp")

Adding a Parameter to the Sheet ( Default value 0 )
DataTable.GetSheet("Temp").AddParameter "Counter","0"

Increment Value
DataTable.GetSheet("Temp").GetParameter("Counter").ValueByRow(1) = DataTable.GetSheet("Temp").GetParameter("Counter").ValueByRow(1) + 1

Updating a Custom TestSet Parameter
Set currentTSTest = QCUtil.CurrentTestSetTest
currentTSTest.Field("TC_USER_11") = DataTable.GetSheet("Temp").GetParameter("Counter").ValueByRow(1)
currentTSTest.Post