<
FONT
color=#0000ff
size
=
2
face
=
"courier new"
>
<
P
>If </
FONT
><
FONT
size
=
2
face
=
"courier new"
>Data(</
FONT
><
FONT
color=#800000
size
=
2
face
=
"courier new"
>"EffectiveDate"</
FONT
><
FONT
size
=
2
face
=
"courier new"
>).ToString() = BC_PolEffectiveDate </
FONT
>Then </
P
>
<
P
> <
FONT
size
=
2
face
=
"courier new"
>Log.WriteLine(</
FONT
><
FONT
color=#800000
size
=
2
face
=
"courier new"
>"AQS Policy Effective Date matches
Billing Center Policy Effective Date"</
FONT
>) </
P
>
<
P
> <
FONT
color=#008000
size
=
2
face
=
"courier new"
>Else</
P
>
<
P
> Log.WriteLine("AQS Policy Effective Date does not match Billing Center
Policy Effective Date")</
P
></
FONT
><
FONT
color=#0000ff
size
=
2
face
=
"courier new"
>
<
P
>End If</
P
></
FONT
>
I can see from the log when these two values do not match but when i run the script on a schedule, Test Studio returns just a pass or fail info and the test passes either by going into the IF or ELSE condition. I need to fail the test when the script goes into the ELSE condition. How can i handle that? Is there a custom code that i can use to change the status of the test when i encounter certain conditions?
//Get the data grid.
SilverlightApp app = ActiveBrowser.SilverlightApps()[0];
DataGrid grid = app.Find.ByAutomationId<DataGrid>("RelatedCommentsDataGrid");
int r = grid.Rows.Count;
List<string> list = new List<string>();
//Place the TextBlock content of the comment subject cell from each row into the string list.
for (int i = 0; i < r; i++)
{
DataGridRow row = grid.Rows[i];
DataGridCell cell = row.Cells[2];
list.Add(cell.TextBlockContent);
Log.WriteLine(cell.TextBlockContent);
}
//Get the created comment subject
object createdComment = GetExtractedValue("CommentSubject");
//Compare the created comment subject to the list and determine if it created successfully.
for (int j = 0; j < list.Count; j++)
{
if (j+1 == list.Count)
{
break;
}
else
{
if (createdComment.Equals(list[j])){
Log.WriteLine(createdComment+"is created successfully");
}
else{
Log.WriteLine(createdComment+"fails to created" );
}
}
}
<?
xml
version
=
"1.0"
encoding
=
"iso-8859-1"
?><
event
><
item
><
title
>PROD-1464</
title
><
date
>Thursday, April 26, 2012</
date
><
time
/><
enddate
>Saturday, May 26, 2012</
enddate
><
description
/><
location
>Centerville Room 5</
location
><
library
>Centerville Library</
library
><
link
></
link
></
item
><
item
><
title
>Ongoing Event</
title
><
date
>Wednesday, May 09, 2012</
date
><
time
/><
enddate
>Thursday, May 31, 2012</
enddate
><
description
/><
location
>Centerville Room 5</
location
><
library
>Centerville Library</
library
><
link
></
link
></
item
><
item
><
title
>Automation Weekly Recurring Event</
title
><
date
>Tuesday, May 15, 2012</
date
><
time
>1:00 PM</
time
><
enddate
/><
description
/><
location
>Centerville Room 4</
location
><
library
>Centerville Library</
library
><
link
></
link
></
item
></
event
>
Target '[Element: 'iframe:0'' is not a supported element to set text to. at ArtOfTest.WebAii.Core.Actions.SetText(Element targetElement, String text) at ArtOfTest.WebAii.Design.IntrinsicTranslators.Descriptors.SetTextActionDescriptor.Execute(Browser browser) at ArtOfTest.WebAii.Design.Extensibility.HtmlActionDescriptor.Execute(IAutomationHost autoHost) at ArtOfTest.WebAii.Design.Execution.ExecutionEngine.ExecuteStep(Int32 order)
What could be the reason?