Telerik Forums
Test Studio Forum
2 answers
297 views
Hi,

I am recording a scenario for an intranet application which uses the windows authentication and doesn't have login page. When I record for the regular user role scenario and then separately record for his/her supervisor role, the tests record and execute as expected.
But if I try to record complete scenario into one test of opening the browser with regular user and performing certain actions and then closing the browser to login as supervisor, doesn't work, as TS understands the close of browser as end of test and doesn't take recordings for Supervisor role.
So, I recorded them separately and then copy+pasted them to one single test. Now, executing would not close the browser after first login and fails while trying to key in the credentials of the supervisor.
Hand coding to add  ActiveBrowser.Close(); helped in closing the browser forcibly, but not able to manage how to open the browser for next login.

Any straight settings or work-arounds?

Thanks,
Ravi
Ravi Prakash
Top achievements
Rank 1
 answered on 11 Apr 2012
1 answer
367 views
How could I return some parameter from 1 method and use it as input parameter in another method?

I have 2 methods and need to communicate between them
    [CodedStep("Copy and convert Contact URL")]
    public string Copy_ContactURL()
    {
      // Copy URL of current Contact
      string contactURL = ActiveBrowser.Url.ToString();
 
      // Convert URL     
      var nameValueCollection = HttpUtility.ParseQueryString(contactURL);
 
      string[] paramArray = { "preloadcache", "pagemode", "rof", "extraqs" };
 
      for (int i = 0; i < paramArray.Length; i++)
      {
        nameValueCollection.Remove(paramArray[i]);
      }
      contactURL = HttpUtility.UrlDecode(nameValueCollection.ToString());
 
      return contactURL;
    }
 
......
    [CodedStep("Open Contact")]
    public void OpenContact(string contactURL)
    {
      ActiveBrowser.NavigateTo(contactURL);
    }
Stoich
Telerik team
 answered on 11 Apr 2012
5 answers
207 views
I am following the instructions from this thread to validate a hyperlink exists on a web page of search results, however the object being returned is null.  I do not need to click on the link, just verify that there is one link on the page that contains the string from 'WorkItem'.

Am I using the code correctly or is it not designed to find the string among characters (like Substr or Mid)... :|

Any other tips would be great.  Thanks much!
HtmlAnchor a = ActiveBrowser.Find.ByContent<HtmlAnchor>(Data["WorkItem"].ToString());
if (a != null)
{
    Log.WriteLine("Found - " + a);
}
else
{
    Log.WriteLine("Not found");
}
Alan
Top achievements
Rank 2
 answered on 10 Apr 2012
2 answers
116 views
Hi,

I have an issue with Test Lists. I am running Test Studio version 2011.2.1413.0

I have a script that iterates through 7 rows of data in a data file. When I run the script directly from the Record tab everything works perfectly. When I run the script from a Test List the script fails at the first iteration. There is no error reported from the Test List.

The faiure happens at the first IF...ELSE statement in the script. The IF statement test is:
IF (Verify 'InnerText' 'StartsWith' 'Showing 0' on 'TableUsersInfoDiv') THEN

On the first pass the IF clause should report TRUE, and it does do that when the script is run from the Record window. Below is an extract from the (verbose) log generated by the Test List execution (and please note that all conditions prior to execution through the Reporting screen and the Test List are identical in every instance):

Trace] : Wait for 'InnerText' 'StartsWith' 'User List' on 'HtmlTag'
[Trace] : Click 'AllRadio'
[Trace] : Click:([Element: 'input:3' (id=all)])
[Trace] : Enter text 'test' in 'Text' - DataDriven: [$(UserName)]
[Trace] : SetText:([Element: 'input:1']) - Text:
[Trace] : ScrollToVisible:([Element: 'input:1']) - ElementTopAtWindowTop
[Trace] : MouseClick:LeftDown (1108,454)
[Trace] : MouseClick:LeftUp (1108,454)
[Trace] : MouseClick:LeftClick (1108,454)
[Trace] : IF (Verify 'InnerText' 'StartsWith' 'Showing 0' on 'TableUsersInfoDiv') THEN
[Trace] : Comment: User ID already exists so just logout
[Trace] : Execute test 'g_Logout'
[Trace] : Comment: Script: g_GenericLogout; Author: Nigel Edwards; date: 02/03/12
[Trace] : Execute test 'g_LogoutWaitForButton'
[Trace] : Comment: Script: g_WaitForLogoutButton; Author: Nigel Edwards; date: 02/03/12

The COMMENT line reported above is actually within the ELSE clause. This shows that a swathe of code (over 30 lines) within the IF statement is not being executed when run from the Test List. In fact the 'InnerText' does start with 'Showing 0'. I've attached the full test script to this posting, but in brief, what should happen after the IF test is a further verification line immediately followed by a button-click. Instead the Test List version skips to the ELSE clause, which is a Logout command.
As I say, the script functions 100% correctly when run directly from the Record window.

A little bit more information for you, here is the .aiilist file from the last time I tried to execute my script through a Test List:

< TestList Type="ArtOfTest.WebAii.Design.Execution.TestList" Version="2011.2.1413.0">
<ID Type="System.String">2ac18a53-d0af-4a41-8ed9-d9dee6f17704</ID>
<TestListName Type="System.String">temp list</TestListName>
<Date Type="System.DateTime">2012-03-26 12:38:16Z</Date>
<Settings Type="ArtOfTest.WebAii.Core.Settings" Version="2011.2.1413.0">
<WebSettings Type="ArtOfTest.WebAii.Core.Settings+WebSettings" Version="2011.2.1413.0">
<DefaultBrowser Type="ArtOfTest.WebAii.Core.BrowserType">InternetExplorer</DefaultBrowser>
<WebAppPhysicalPath Type="System.String">
</WebAppPhysicalPath>
<EnableScriptLogging Type="System.Boolean">True</EnableScriptLogging>
<EnableUILessRequestViewing Type="System.Boolean">False</EnableUILessRequestViewing>
<LocalWebServer Type="ArtOfTest.WebAii.Core.LocalWebServerType">None</LocalWebServer>
<BaseUrl Type="System.String">
</BaseUrl>
<AspNetDevServerPort Type="System.Int32">-1</AspNetDevServerPort>
<KillBrowserProcessOnClose Type="System.Boolean">False</KillBrowserProcessOnClose>
<RecycleBrowser Type="System.Boolean">True</RecycleBrowser>
<UseHttpProxy Type="System.Boolean">False</UseHttpProxy>
<EnableSilverlight Type="System.Boolean">False</EnableSilverlight>
<VerboseHttpProxy Type="System.Boolean">False</VerboseHttpProxy>
<SilverlightConnectTimeout Type="System.Int32">30000</SilverlightConnectTimeout>
<MultiBrowsersExecution />
<UseMultiBrowsers Type="System.Boolean">False</UseMultiBrowsers>
<IsProfilingExecution Type="System.Boolean">False</IsProfilingExecution>
<ProfilerConfigurations />
</WebSettings>
<WpfSettings Type="ArtOfTest.WebAii.Core.Settings+WpfSettings" Version="2011.2.1413.0" />
<ClientReadyTimeout Type="System.Int32">30000</ClientReadyTimeout>
<ExecuteCommandTimeout Type="System.Int32">20000</ExecuteCommandTimeout>
<LogLocation Type="System.String">C:\WebAiiLog\</LogLocation>
<QueryEventLogErrorsOnExit Type="System.Boolean">False</QueryEventLogErrorsOnExit>
<ExecutionDelay Type="System.Int32">0</ExecutionDelay>
<AnnotateExecution Type="System.Boolean">True</AnnotateExecution>
<SimulatedMouseMoveSpeed Type="System.Single">0.3</SimulatedMouseMoveSpeed>
<WaitCheckInterval Type="System.Int32">500</WaitCheckInterval>
<AnnotationMode Type="ArtOfTest.WebAii.Core.AnnotationMode">All</AnnotationMode>
<LogAnnotations Type="System.Boolean">True</LogAnnotations>
<IsStressRecordingMode Type="System.Boolean">False</IsStressRecordingMode>
<IsUserInteractiveMode Type="System.Boolean">False</IsUserInteractiveMode>
<CreateLogFile Type="System.Boolean">True</CreateLogFile>
<XMultiMgr Type="System.Boolean">True</XMultiMgr>
<UnexpectedDialogAction Type="ArtOfTest.WebAii.Core.UnexpectedDialogAction">HandleAndFailTest</UnexpectedDialogAction>
<ElementWaitTimeout Type="System.Int32">10000</ElementWaitTimeout>
<DisableDialogMonitoring Type="System.Boolean">False</DisableDialogMonitoring>
</Settings>
<Tests>
<Item Type="ArtOfTest.WebAii.Design.Execution.TestInfo" Version="2011.2.1413.0">
<ID Type="System.String">a4ece2e6-629e-4997-b575-5abf386e7ed7</ID>
<Path Type="System.String">SystemAdmin\Users\sa_UsersSetupAllRequired.tstest</Path>
</Item>
</Tests>
<Filter Type="ArtOfTest.WebAii.Design.Execution.Filter" Version="2011.2.1413.0">
<Keys />
<Comparisons />
<Values />
</Filter>
<TestListType Type="ArtOfTest.WebAii.Design.TestListType">Automated</TestListType>
< /TestList>

...also, I have created a stripped down script that also fails in exactly the same way, so it is not just one script. Here's the Test List execution log:

[Trace] : Execute test 'g_NavigateToURL'
[Trace] : Comment: Script: g_NavigateToURL; Author: Nigel Edwards; Date: 02/03/12
[Trace] : Comment: To consistently navigate to the URL and open the LogOn screen
[Trace] : Comment: Script uses Local Data
[Trace] : Navigate to Project - DataDriven: [$(URL)]
[Trace] : NavigateTo: http://vs-demo/BaseProjectQA
[Trace] : Wait for 'InnerText' 'StartsWith' 'Base Project - Log On' on 'HtmlTag' - DataDriven: [$(LogonScreenTitle)]
[Trace] : Extract 'TextContent' on 'VersionTagDiv' into DataBindVariable $(VersionNumber)
[Trace] : *** Version Number is: v 1.9.0.11 ***
[Trace] : Comment: * End of g_NavigateToURL test script *
[Trace] : Enter text 'user' in 'TextBoxUserIdText'
[Trace] : SetText:([Element: 'input:0' (id=textBoxUserId)]) - Text:user
[Trace] : Enter text 'password' in 'PasswordPassword'
[Trace] : SetText:([Element: 'input:1' (id=Password)]) - Text:password
[Trace] : Click 'ButtonLogOnSubmit'
[Trace] : Click:([Element: 'input:2' (id=ButtonLogOn)])
[Trace] : Click 'SystemAdminLinkLink'
[Trace] : Click:([Element: 'a:7' (id=SystemAdminLink)])
[Trace] : Click 'UsersSpan'
[Trace] : Click:([Element: 'span:34'])
[Trace] : Wait for Exists 'CreateNewSpan'
[Trace] : Enter text 'abc' in 'Text'
[Trace] : SetText:([Element: 'input:1']) - Text:
[Trace] : ScrollToVisible:([Element: 'input:1']) - ElementTopAtWindowTop
[Trace] : MouseClick:LeftDown (1083,394)
[Trace] : MouseClick:LeftUp (1083,394)
[Trace] : MouseClick:LeftClick (1083,394)
[Trace] : IF (Verify 'InnerText' 'StartsWith' 'Showing 0' on 'TableUsersInfoDiv') THEN
[Trace] : Comment: else do nothing
[Trace] : Closing Window


Thanks,
Nigel Edwards, Transition Computing.

PS - this thread was originally posted as http://www.telerik.com/automated-testing-tools/community/forums/test-studio/general-discussions/test-list-skips-over-execution-code.aspx, but it failed to be searchable, so is reposted here.
Nigel
Top achievements
Rank 2
 answered on 10 Apr 2012
4 answers
124 views
Hi,

Yesterday I posted "Test List 'skips over' execution code" to the forum.  The link is:
http://www.telerik.com/automated-testing-tools/community/forums/test-studio/general-discussions/test-list-skips-over-execution-code.aspx

If I search for 'nigel edwards' all my posts except the above are found.  Why not this one?

I can click on the link and find the post, but searching for the post doesn't locate it.  Any ideas?

Thanks,
Nigel Edwards, Transition Computing
Nigel
Top achievements
Rank 2
 answered on 10 Apr 2012
5 answers
64 views
I have following object on my page:
http://screencast.com/t/z66xIoROx
If I run test with step "click" this object and "Toggle Annotation" is on - test performs successfully.
If "Toggle Annotation" is off - click on this object works incorrectly - adjacent button is clicked and test failed.
Ivaylo
Telerik team
 answered on 09 Apr 2012
1 answer
193 views
I want to extract some coded steps from my test to use it by different tests. These coded steps work with variables defined in test and these variables are different in different test.
// define variable
public static string accountEmailDomain = DateTime.Now.ToString("yyMMddHHmmss") + ".com";
 
 
// use it in code
[CodedStep("Enter text in 'Account_EmailDomain'")]
public void Fill_AccountEmailDomain1()
{
  Pages.AccountWindow.FrameContentIFrame.Account_Emaildomain.MouseClick();
  Manager.Desktop.KeyBoard.TypeText(accountEmailDomain, 50, 100);
}
I want to extract CodedStep to separate test, but how I could pass variable 'accountEmailDomain' from current running test?
I only guess to do it like
// use it in separate test
[CodedStep("Enter text in 'Account_EmailDomain'")]
public void Fill_AccountEmailDomain1()
{
  Pages.AccountWindow.FrameContentIFrame.Account_Emaildomain.MouseClick();
  Manager.Desktop.KeyBoard.TypeText(Test1.accountEmailDomain, 50, 100);
}
but I need to pass testname to this separate test.

Please suggest.
Stoich
Telerik team
 answered on 06 Apr 2012
2 answers
135 views
I have following data grid with many rows in it which are like following
<tr class="ms-crm-List-Row" otype="9005" oid="{EF80BD25-B979-E111-8FE2-00155D282904}" statecode="Completed" operationtype="10">
<TD class=ms-crm-List-DataCell align=center><INPUT id=checkBox_{EF80BD25-B979-E111-8FE2-00155D282904} class=ms-crm-RowCheckBox title="Cell_1" tabIndex=0 value="" type=checkbox></TD>
<TD class=ms-crm-List-DataCell align=center><IMG alt="" src="/_imgs/ico_16_9005.gif?ver=1339846006"></TD>
<TD class=ms-crm-List-DataCell><NOBR title="Cell_2"><A id=gridBodyTable_primaryField_{EF80BD25-B979-E111-8FE2-00155D282904}_0 class=ms-crm-List-Link title="Cell_2" tabIndex=0 href="#" target=_self>Cell_2</A></NOBR></TD>
<TD class=ms-crm-List-DataCell><NOBR>
<LI style="DISPLAY: inline"><SPAN class=gridLui title=Cell_3 ondblclick=clearTimer() contentEditable=false onclick=handleGridClick() otype="2" oid="{0EF8471E-B979-E111-8FE2-00155D282904}"><IMG id=ico_16_2 class="ms-crm-ImageStrip-ico_16_2 ms-crm-Lookup-Item" alt="" src="/_imgs/imagestrips/transparent_spacer.gif">Cell_3</SPAN></NOBR></LI></TD>
<TD class=ms-crm-List-DataCell><NOBR>Cell_4</NOBR></TD>
<TD class=ms-crm-List-DataCell><NOBR><A style="CURSOR: hand" id=gridBodyTable_lookup_{EF80BD25-B979-E111-8FE2-00155D282904}_0 class=ms-crm-List-Link title="Cell_5" tabIndex=0 onclick=handleLookupAnchorClick() href="#" target=_self>
<LI style="DISPLAY: inline"><SPAN class=gridLui title="Cell_6" ondblclick=clearTimer() contentEditable=false onclick=handleGridClick() otype="8" oid="{36D460BF-1940-E111-A0D7-00155D282904}">Cell_6</SPAN></A></NOBR></LI></TD>
<TD class="ms-crm-List-DataCell ms-crm-NumbersAndDates"><NOBR>Cell_7</NOBR></TD>
<TD class="ms-crm-List-DataCell ms-crm-NumbersAndDates">Cell_8</NOBR></TD>
<TD class=ms-crm-List-DataCell> </TD>
To handle it I should click on cell with title "Cell2"(but this ID have all rows in table).
Rows differ each other by value in Cell_3.

Please suggest how I could define row with proper 'Cell_3' value and click call with Cell_2 value?
algot
Top achievements
Rank 1
 answered on 05 Apr 2012
2 answers
136 views
Hi

I have a datagrid/table where for each row (except the header) there are some hidden values, some showng info and a button.

What I'm wanting to do is loop through the rows and find in the first column the values in 2 hidden fields.  If hidden1 and hidden2 match datavalue1 and datavalue2 then I can find the correct rowindex and therefore find the correct button to click.

I can successfully loop through the rows of the table, but i'm not sure how to find the value of the hidden fields for EACH row as I loop through.

I can find it on the page using

Dim cpolicy As HtmlInputHidden = Pages.TravelInsuranceSalesSystem1.Get(Of HtmlInputHidden)("id=ctl00_ContentPlaceHolder1_TestGrid_ctl02_cpolicy")


but not for each cell as I'm unsure how to refer to a partial ID for a hidden field.

This is what I have so far, the htmlinputhidden is incorrect:

For Each r As HtmlTableRow In Pages.TravelInsuranceSalesSystem1.ContentPlaceHolder1TestGridTable.AllRows
               if r.RowIndex <> 0 then
       'ignore the header row
                   For Each c As HtmlTableCell In r.Cells
                        
                           if c.CellIndex = 0 then
                           'column 1 only
                                    
                               Dim cpolicy As HtmlInputHidden = c.Get(Of HtmlInputHidden)("id=~cpolicy")
                                
                               if cpolicy.Equals("TI") then
                                   Log.WriteLine("cpolicy:" & cpolicy.Value )
                               end if
                           end if
                   Next
               end if
           Next
Anthony
Telerik team
 answered on 04 Apr 2012
3 answers
865 views
Hi, 

Is it possible that I single step through my coded step?

thx

Anthony
Telerik team
 answered on 04 Apr 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?