I am using UFT12.00

 

I would like to know when the input properties are optional. Like example 
below

 

recipient                group     read

"[email protected]"        abc         TRUE

"[email protected]"

"[email protected]"        bcd

 

where the input "group" and "read" could be excluded. If I just link them 
to the data source, when executing the second iteration, the error message 
*"XML 
validation error for input schema:XML validation error: cvc-pattern-valid: 
Value '' is not facet-valid with respect to pattern 
'[\n\s]*[^\s]+([\n\s]*.*[\n\s]*.*)*' for type 'notEmptyStringType'.*
*cvc-type.3.1.3: The value '' of element 'group' is not valid." *appears. 
How could I prevent this?

 

Also, for checkpoint properties. Sometimes there are 1 array or more. Like 
example below

 

1st iteration

<group>

<group-id>A</group-id>
<alert-number>0</alert-number>

</group>

 

<group>

<group-id>B</group-id>
<alert-number>0</alert-number>

</group>

 

2nd iteration

<group>

<group-id>A</group-id>
<alert-number>0</alert-number>

</group>

 

How could I handle this in the script or using XML?

 

Also, I would like to know if I could export the excel file in xlsx format.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Here is the event code. Could anyone have a check? Thank you very much.

 

DateTime before, after;
TimeSpan diff;
double timediff = 0;

int rowcount = 0;
string rowcontent = null;

public void HTTPActivity5_OnBeforeExecuteStepEvent(object sender, 
STActivityBaseEventArgs args)
{
GetDataSource("api!Result").ImportFromExcelFile(@"C:\Users\uft\Desktop\api.xls",
 
"Result", true);
rowcontent = GetDataSource("api!Result").GetValue(rowcount, 
"recipient").ToString();
while (String.IsNullOrWhiteSpace(rowcontent) == false)
   {
   rowcount++;
   rowcontent = GetDataSource("api!Result").GetValue(rowcount, 
"recipient").ToString();
   }
before = DateTime.UtcNow;
}

 

public void HTTPActivity5_OnCodeCheckPointEvent(object sender, 
CheckpointEventArgs args)
{
if (this.HTTPActivity5.StatusCode == 200)
GetDataSource("api!Result").SetValue(rowcount, "checkpoint", "TRUE");
else
GetDataSource("api!Result").SetValue(rowcount, "checkpoint", "FALSE");
}

public void HTTPActivity5_OnAfterExecuteStepEvent(object sender, 
STActivityBaseEventArgs args)
{
after = DateTime.UtcNow;
diff = after.Subtract(before);
timediff = diff.TotalMilliseconds;
this.HTTPActivity5.Report("timediff", timediff.ToString());
this.HTTPActivity5.Report("before", before.ToString("MM/dd/yyyy HH:mm:ss"));

GetDataSource("api!Result").SetValue(rowcount, "date", 
before.ToString("MM/dd/yyyy"));
GetDataSource("api!Result").SetValue(rowcount, "time", 
before.ToString("HH:mm:ss"));
GetDataSource("api!Result").SetValue(rowcount, "login_transaction", 
timediff.ToString());

GetDataSource("api!Result").ExportToExcelFile(@"C:\Users\uft\Desktop\api.xls");
}

-- 
-- 
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en

--- 
You received this message because you are subscribed to the Google Groups "QTP 
- HP Quick Test Professional - Automated Software Testing" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to