Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Automate Spiratest mgt tool to add testcases
#1
Solved: 11 Years, 4 Months ago
I am required to add 5000+ testcases into Spiratest mangement tool.
All though I tried using the Excel sheet importer provided by Inflectra to import test cases into SpiraTest, it did not help much since the testcases need to be in the required format. After requesting the team members to enter the testcases into the tool, it was seen that hardly 100 testcases could be entered into the tool a day.

Now, I got the Idea to automate the Spira test, so that it would enter the testcase name, testcase steps and expected result and add a new testcase automatically.

I see the problem where the QTP fails to recognize the WebElement inside the Frame on the page to enter the tescase steps and expected result. The problem I am facing is when the mouse is already in the steps WebElement then the script recognizes the frame and the webelement inside it, else it fails to recognize the frame and the webelement inside.

The script runs first time and fails for the second loop onwards.
Please help...

Following is the code:
Code:
For i=4 to 6

datatable.SetCurrentRow(i)
tcname=datatable("testname",dtGlobalsheet)
row1=datatable("steps",dtGlobalsheet)
expres=datatable("expected",dtGlobalsheet)
blank=""
'msgbox(row1)
If Browser("name:=SpiraTest.*").Page("title:=SpiraTest.*").WebEdit("html id:=ctl00_cplMainContent_txtName").Exist Then
    msgbox("testcase name field exists")
    Reporter.ReportEvent micPass,"webedit Check", "webedit Exists"
    Browser("name:=SpiraTest.*").Page("title:=SpiraTest.*").WebEdit("html id:=ctl00_cplMainContent_txtName").Set blank
    wait 2
    Browser("name:=SpiraTest.*").Page("title:=SpiraTest.*").WebEdit("html id:=ctl00_cplMainContent_txtName").Set tcname
    wait 1
    Else
    Reporter.ReportEvent micFail,"webedit Check", "webedit does Not Exist"
End If
wait 1

browser("SpiraTest | Test Case").Page("SpiraTest | Test Case_2").Frame("Frame").WebElement("WebElement").FireEvent  "onmouseover"
browser("SpiraTest | Test Case").Page("SpiraTest | Test Case_2").Frame("Frame").WebElement("WebElement").FireEvent "onclick"
If browser("SpiraTest | Test Case").Page("SpiraTest | Test Case_2").Frame("Frame").WebElement("WebElement").Exist Then
wait 1
'msgbox("in here")
browser("SpiraTest | Test Case").Page("SpiraTest | Test Case_2").Frame("Frame").WebElement("WebElement").FireEvent "onclick"

hWnd = browser ("SpiraTest | Test Case").GetROProperty("hwnd")
'Down Arrow
Window("hwnd:=" & hWnd).Type micDown
Window("hwnd:=" & hWnd).Type micDown

wait 2
'msgbox(row1)
Set oEdit=browser("SpiraTest | Test Case").Page("SpiraTest | Test Case_2").Frame("Frame").WebElement("WebElement")
oEdit.object.innertext = row1
wait 3
else
msgbox("webelement not exist")

End If
'browser("SpiraTest | Test Case").Page("SpiraTest | Test Case").Image("Save and create a new").Click
wait 8
DataTable.SetNextRow
Next

'SaveAndNewIconSelected.gif
'If browser("SpiraTest | Test Case").Page("SpiraTest | Test Case").WebElement("WebElement_2").Exist Then
'
'browser("SpiraTest | Test Case").Page("SpiraTest | Test Case").WebElement("WebElement_2").Click
'wait 1
'Set oEdit1=browser("SpiraTest | Test Case").Page("SpiraTest | Test Case").WebElement("WebElement_2")
'oEdit1.object.innertext = expres
'else
'msgbox("webelement not exist")
'End If
Thanks,
Malini
Reply
#2
Solved: 11 Years, 4 Months ago
Are you getting any error message? at which line?
also I would to get clear on these following statements , I am not able to understand that changing the property of web element makes any effect permanently to AUT, if not, is this really required. I doubt this is causing the issue.

Code:
Set oEdit=browser("SpiraTest | Test Case").Page("SpiraTest | Test Case_2").Frame("Frame").WebElement("WebElement")
oEdit.object.innertext = row1

Reply
#3
Solved: 11 Years, 4 Months ago
Malini -
Excellent Post !! I appreciate your time and patience to explain the situation to the best. Here is a solution what i can offer,

I believe this is caused due to the firing of the mouseevents through the browser. Try this,
Just before the webelement where the focus of the mouse is being set place this piece of code like this,

Code:
Setting.WebPackage("ReplayType") = 2
.Webelement().click or whatever...
Setting.WebPackage("ReplayType") = 1

Let me know if it works.
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply
#4
Solved: 11 Years, 4 Months ago
Hi Basanth,
Thanks for the kind help.
I will surely this the above method...

At the same time I have just seen that there are N number of frames inside the page.
the Web Edit which is used for the test case name entry is recognized at the run time.

Current Issue:
1. left webelement-:to enter the tc steps
2. 2nd webelement-:to enter the expected result.

Now, what happens exactly at the run time is as follows:
1.During the run time, since the webelements are inside frames, they are not recognized.
2. Actually following is happening:
When the user clicks on the webelement then the frame is captured, else when the user does not click on the webelement the frame is not captured, which means that:

When the click occurs in the webelement, then the selection is done where we can see the blue line around the box.
In case not selected then there no blue line around the webelement which means, that the webelement is not selected.
So, that means before the clicking of the webelement the obj property is different and after clicking into the webelement its property is different.

Please also note that before clicking the frame is not recognized, once the clicking is done then the frame is recognized.

Thanks,
Malini
Can you please let me know how I can attach the screen shots or even the webex recording for better clarity for the above problem.

Thanks,
Malini
Reply
#5
Solved: 11 Years, 4 Months ago
Does Attachment not work ?? When you reply, look for the button at the left most called "Choose File". You can upload attachments using that.
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply
#6
Solved: 11 Years, 4 Months ago
Thanks a ton...Smile
Please find the attachement..

Thanks,
Malini


Attached Files
.doc   Spira Test Mgt tool.doc (Size: 338 KB / Downloads: 91)
Reply
#7
Solved: 11 Years, 4 Months ago
Why arent you capturing the Weblement After the click on the box ? Is there a necessity of difference to recognize it without the selection or with the selection ?
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply
#8
Solved: 11 Years, 4 Months ago
Hi Basanth,

Actaully, today I realized that before the clicking on the webelement, the obj recognization and proeprties are different(before clicking the parent frame is not at all recog). After clicking, the webelement is recognized as its under the frame, as in the screen shot.
the code that I wrote was for the event to occur after clicking,
so now we have to do two things,
1. locate the webelement before clicking
2. click on the webelement
3. then enter steps into the webelement.

Thanks,
Malini
Reply
#9
Solved: 11 Years, 4 Months ago
Malini -
Actually 3 things Wink

Okay, Do me a favour and try the virtual object schema. Associate the webelement to a Webedit and then try to Set. Lets see if that works instead of modifying the innertext. [ Yes, I do understand the hierachy of recognition wherein you have issues with the object's before and after recoginition, Would you mind pointing out the error message it throws ? ]
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply
#10
Solved: 11 Years, 4 Months ago
Hi Basanth,
I have created the virtual objects as you suggested..can you please let me know how I can associate to a webedit. and how to call the virtual objects in the script.I have not worked with virtal objects earlier...and this is the first time...Wink
Please refer the screen shot attached in the word file.
Thanks,
Malini


Attached Files
.doc   how to call the virtual objects.doc (Size: 107.5 KB / Downloads: 80)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  tool srikanth.gnr 0 1,917 01-05-2012, 12:31 PM
Last Post: srikanth.gnr
  what add-ins should i add... Venkat 1 3,414 03-07-2011, 12:38 AM
Last Post: akbarsharifmd
  Which Add In manager i need to use to automate Eclipse based IDE? laxman_nsn 1 2,868 04-14-2010, 03:55 AM
Last Post: Tarik Sheth
  is webservice add in is different from web add in in qtp? hikpvasanth 1 3,325 10-07-2008, 07:23 PM
Last Post: niranjan
  Whether QTP can be used as the tool to automate Oracle Forms dowloaded via JRE/Jiniti Pradyuman 1 5,598 02-12-2008, 11:44 PM
Last Post: Ankur

Forum Jump:


Users browsing this thread: 5 Guest(s)