Thursday, August 14, 2014

UFT - Start Uninstal Wizard from Control Panel

I had a little trouble with this, but here is how it worked for me:

Parameter("ProductName") = "The name of Product from Control Panel"


Dim sApp
Set sApp= CreateObject("Shell.Application")
sApp.ControlPanelItem cstr("appwiz.cpl"'see list here http://www.sqablogs.com/qtp/1105/To+access+control+panel+items.html
set sApp = nothing

Dim i
For i = 0 To Window("Programs and Features").WinListView("WinListView").GetItemsCount-1 Step 1
    If Window("Programs and Features").WinListView("WinListView").GetItem(i) = Parameter("ProductName"Then
        Window("Programs and Features").WinListView("WinListView").Activate(i)  'Activate Doubleclicks on object
        Exit For
    End If
Next

Source: http://www.sqablogs.com/qtp/1105/To+access+control+panel+items.html 

Tuesday, July 15, 2014

Ninja Testers - Our SWTC story

We had a team at this year's Software Testing World Cup (SWTC) Europe.
We were the Ninja Testers!

It all started one day when someone in our local tester community (http://www.meetup.com/Tabara-de-Testare-Timisoara/ ) sent a message about SWTC. As soon as the word got out many teams from Romania registered, from many cities. And that was really nice.

So, we registered 3 months before the competition and started preparing :)
First we voted the team name, then we set up recurrent meetings to prepare. We mostly looked into the following:
- what happened last year
- Performance Testing (we looked at several tools: Jmeter, HP Performance Center, Web Performance from Visual Studio, LoadUI)
- Security Testing
- Test Reports
- Bug Reports
- Risk
- things that would make us different from other teams (we tried to be innovative)


And then, the day of the event was here, Friday, June 13, 2014.
We made a stash with supplies (pizza and Cola), because we thought we will be hungry during the 3 hours.
At 19:00 (7 PM), our time, the competition started, and we started testing right away :D !

To be honest, it was not at all as we expected.

We had to test just one software product (unlike last year), also no Performance or Security testing was on Scope.
Then we had to use a tool from HP (Agile Manager) for the bugs and we each had a user to submit bugs. Also we each had a user for the SUT(an online application for sales people) .

We started testing and we submitted everything we found. We read the specifications over and over to make sure we stay on scope. From time to time we shared what we thought it was important.

It was difficult to listen to the Youtube Chanel and think at the same time, so we kinda gave up that part. We just asked few things and looked at the responses occasionally. The input there was overwhelming...

Our strategy was simple:
- stay on scope
- test primary concerns: email function and test on as many devices as possible (fortunately we had some devices available + our personal phones)
- be innovative and find nasty bugs

We had many challenges:
- think what things might go wrong in such an application
- see that somebody else in the team did not file the same bug
- fight the stress (because everything happen reaaally fast )
- send a good Test Report

The Agile Manager was ok and easy to use.
Things we liked:
- nice UI
- easy to use
- option to generate Bug report in Excel
Things we did not like:
- very few options for the Bug report (although we were able to file bugs faster, because there were not many fields to enter)
- you could not right click on the bug and get a link that you could send to anyone in an email (this is something that was available in previous versions HP QC, ALM).
- other options for the bug report would have been nice (PDF, HTML page)

For the Test Report we thought to use a collaborative tool. So that everyone could see it.
We created accounts for us and even created an account on gmail for the judges to look at.
The initial plan was to send the Test Report at the beginning and say: "Hey, this is our Test Report! You can see it as it grows.", but the specifications said to send it at the end, so we did that. (We hope the idea, at least will be appreciated).

So the 3 hours passed like 3 minutes..
We finally got to the cold pizza and Cola. Exhausted from the work day + competition, but really happy we were part of this :)

No matter the result this year, we will participate next year too. We totally recommend it!


Regards,
    Team Ninja Testers













Dual Monitor - See Taskbar on both monitors

If you want to see Windows Taskbar on both monitors, here is what you can do:

1. Install Dual Monitor from here:
http://sourceforge.net/projects/dualmonitortb/files/

2. Start Dual Monitor and move your open windows from one monitor to the other.
The windows will appear in the Taskbar on the corresponding monitor.

UFT API - control VCloud machines from UFT

You can control VCloud with an API test in UFT. Here is How.


1. Create a new API test.
2. Let's say we want to Revert to Snapshot a machine:
Add a HTTP Request and add following properties:

URL: https://vcloud.example.com/api/vApp/{vapp-id}/action/revertToCurrentSnapshot
HTTP Method: POST
Request headers:
Accept: application/*+xml;version=5.1
Authorization: Basic + (User + Pass in Base64)


3. Run the test and the machine will be reverted.

Here is a list with a lot more useful commands:
http://pubs.vmware.com/vchs/index.jsp#doc/landing-user_operations.html

Also use Postman - Rest Client Addin from Google Chrome to test your requests:
https://chrome.google.com/webstore/search/postman%20rest%20client?utm_source=chrome-ntp-icon


Friday, July 11, 2014

UFT - Map Network Drive

If you want to map a network drive:


User = "domain\username"   ' the user name you want to use for mapping the network drive
    Password = "Password123"     'the password for the above user


    LocalDrive = "S:"        
    RemoteShare = "\\servername\FolderName"

    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objNetwork = CreateObject("WScript.Network")

    'Unmap the drive (optional)
    If(ObjFSO.DriveExists(
LocalDrive)) Then
        objNetwork.RemoveNetworkDrive LocalDrive, TrueTrue
    End If

    'Map the drive command
    objNetwork.MapNetworkDrive LocalDrive, RemoteShare, True, User, Password

    Set objNetwork = Nothing
    Set objFSO = Nothing





Thursday, July 3, 2014

VBScript - find difference between similar strings

' Presume input strings named s1 and s2
' Assume Len(s1) = Len(s2)
Dim i

For i = 1 to Len(s1)
   If Asc(Mid(s1, i, 1)) <> Asc(Mid(s2, i, 1)) Then
        Msgbox "Strings differ at character " & i
    End If
Next 'i

Tuesday, March 25, 2014

VBScript - Change Date Format

Use case:
For the following Calendar, set second date 2 days later that first date:
'parse initia date and change the format from 25.03.14 to 25/03/14
Dim fromDate, toDate, parsedDate, i, fromDay, fromMonth, fromYear
parsedDate = Split(Browser("Browser_Local").WebEdit("From").GetROProperty("value"),".")
fromDay = parsedDate(0)
fromMonth = parsedDate(1)
fromYear = parsedDate(2)
fromDate =    fromMonth & "/" & fromDay & "/" & fromYear
fromDate =    CDate(fromDate)
'set the second date 2 days after 03/25/14 => 03/27/14
toDate = DateAdd("d","2",fromDate)
'set the second date in the desired format => 27.03.14
Dim strDate
strDate = Right("0" & DatePart("d",toDate)2) & "." & Right("0" & DatePart("m",toDate)2) & "." & Right(DatePart("yyyy",toDate),2)
'enter the value for the second date Browser("Browser_Local").Page("Ihr Seminar, Kurs, Coaching").RunScript("$('#Hotel_overnight_to_1').val('"& strDate &"')") 
'following is optional. in my case these elements needed to have values also
Dim oPage
Set oPage=Browser("Browser_Local").Page("Ihr Seminar, Kurs, Coaching")
Dim bisDay, bisMonth, bisYear
Set bisDay=oPage.RunScript("document.getElementsByName('hotel[overnight_to][1][day]')(0);")
bisDay.Value=Right("0" & DatePart("d",toDate)2)
Set bisMonth=oPage.RunScript("document.getElementsByName('hotel[overnight_to][1][month]')(0);")
bisMonth.Value=Right("0" & DatePart("m",toDate)2)
Set bisYear=oPage.RunScript("document.getElementsByName('hotel[overnight_to][1][year]')(0);")
bisYear.Value=DatePart("yyyy",toDate)    

Run Javascript in UFT (QTP)

 Browser("Browser_Local").Page("MyPage").RunScript("$('#Hotel_overnight_to_1').val('25.03.14')"
   
    Dim oPage
    Set oPage=Browser("Browser_Local").Page("MyPage"
      Dim bisDay, bisMonth, bisYear
     
    Set bisDay=oPage.RunScript("document.getElementsByName('hotel[overnight_to][1][day]')(0);"
    bisDay.Value="25"
   
    Set bisMonth=oPage.RunScript("document.getElementsByName('hotel[overnight_to][1][month]')(0);"
    bisMonth.Value="03"
   
    Set bisYear=oPage.RunScript("document.getElementsByName('hotel[overnight_to][1][year]')(0);"
    bisYear.Value="2014"

Source:
http://qtpcodes.blogspot.de/2011/10/running-javascript-in-qtp.html

Monday, March 24, 2014

Uninstall ALM-Client

1. Delete all files under following locations:
    %ALLUSERSPROFILE%\HP\ALM-Client
    %UserProfile%\AppData\Local\HP\ALM-Client
    %LocalAppData%\HP\ALM-Client
    %ALLUSERSPROFILE%\Application Data\HP\ALM-Client
    %UserProfile%\Local Settings\Application Data\HP\ALM-Client
    %temp%/td_80

2. Reopen ALM.

Source:
http://h30499.www3.hp.com/t5/Quality-Center-Support-and-News/How-do-I-uninstall-the-ALM-QC-v11-client/td-p/5616791#.UzAebvmSxlT 

Open ALM Client outside IE

If you need to open ALM-Client outside Internet Explorer you can open in IE following link:

http://ServerName/qcbin/start_a.jsp?embedclient=false

This will open ALM-Client.


Monday, March 17, 2014

UFT - Wait until Loading Icon is no longer displayed

I had something like this:

Search for something -> loading icon displayed until search is done -> results are displayed.
Here is the solution using XPath:

While Browser("Browser_Local").WebElement("xpath:=//div[contains(@class,'hitsArea')]/descendant::td[contains(@class,'cell-loadingIcon') and not(contains(@style,'display: none'))]").Exist = False
    wait 2
Wend

- It looks for the div, that contains a class named "hitsArea"
- finds between its descendants, one that contacins a class named "cell-loadingIcon"
- and it is not hidden: not(contains(@style,'display: none'))


Friday, February 14, 2014

Record what you do with Windows Problem Steps Recorder

Here is a simple way to record the steps to reproduce a problem:

1. Start -> Run -> psr.exe
    Following program opens:







2. Start record.
3. Perform your scenario.
4. Stop Record and save the file.

=> You will get a report with HD screenshots of everything you did. I was expecting a movie, but considering it's free and easy to use, I'm happy.

Source:
http://www.youtube.com/watch?v=70lmYJaUWJ8

Thursday, February 13, 2014

QTP / UFT - Object identification using XPath

Did you experience a situation where you had a WeElement that was visible only at mouse over, and UFT would not recognize it even if you pay for that?

Here is something to try:

1. Open site in Chrome browser.
2. Press F12 to see DevTools.
3. Go to the desired element, Right-click on it and select "Inspect Element".
4. The element will bie highlighted in the DevTools zone:
\
5. Copy XPath, and paste somewhere to use it, you should have something like this:

//*[@id="highcharts-0"]/svg

6. Enter the code in UFT. Should be something like:

 Browser("Browser_Local").Page("MyPage").WebElement("xpath:="//*[@id='highcharts-0']/svg"").Click

Hope this helps!

Note: Special thanks to my colleague Mihai, who pointed this out.

Monday, January 13, 2014

Windows 7 Keyboard Shortcuts

I needed a shortcut to change language on a virtual machine today,
and I found this interesting link:

http://www.shortcutworld.com/en/win/Windows_7.html

Have fun!

Thursday, January 9, 2014

Add Testing Host in ALM

1. Open ALM in Remote Machine.
2. Go to Help -> ALM Tools -> HP ALM Lab Service > Download HP ALM Lab Service for corresponding operating system.
3. Follow the wizard, Install Auto Login:

4. Continue the installation.
5. Enter Server Settings and Host Settings.

6. In ALM, go to Lab Resources -> Testing Hosts -> New Testing Host.
Important! Make sure you set the New Testing Host Name the same as the machine name!

7. Click Register Host.
8. When prompted to start the service host, select Yes -> Finish.
9. Restart machine.
10. In ALM, go to Lab Resources -> Testing Hosts, right click on the new Testing Host and select Check Host.

Wednesday, January 8, 2014

UFT - Enter text in Frame

I had a form where the text fields were not identified as WebEdit. When using the Object Spy the object was identified as a Frame or WebElement inside a Frame.

Here is the solution I have found:
Set oEdit = Browser("").Page("").Frame("Frame").WebElement("")
oEdit.object.innerText = "This is a plain text"

Source:
http://www.knowledgeinbox.com/articles/qtp/how-to/web/how-to-set-text-in-a-webelement-or-frame/

Tuesday, January 7, 2014

Check syntax in UFT

If you need to check syntax is correct for code in HP UFT you have 2 options:

1. Go to Design -> Check Syntax.

2. Ctrl + F7.

Have fun!