This is a migrated thread and some comments may be shown as answers.

Coding a numeric value comparison

1 Answer 50 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Fletch
Top achievements
Rank 1
Veteran
Fletch asked on 22 May 2020, 02:36 AM
Am I close?  I'm using Extract to pull the string from a field and storing that in Contact1. 


[CodedStep(@"Compare expected Contacts")]
public void Infu_CodedStep()
{
var cval = GetExtractedValue(Contact1);
Assert.IsTrue(cval > 50000);
}

But, once I completed adding the code block, the test will not run.  All others still do, but the new one just stares at me and doesn't respond in ANY way when I attempt to Run or Run to here.

1 Answer, 1 is accepted

Sort by
0
Plamen Mitrev
Telerik team
answered on 22 May 2020, 07:45 AM

Hello,

Thank you for sharing you code for me to analyze. I will share some additional details about the extract step and a sample test that covers this test scenario.

I assume that the you have taken the extracted value name from the DataBindVariableName in the extract step - "Contact1". Since the method GetExtractedValue() expects a string as parameter, you need to surround it with quotes. That will return an object that you then need to convert to integer for the follow up comparison. Please check the sample code for one way to convert it and make the validation.

I hope the above suggestions and details help you fix the compilation errors and automate this test scenario. Please do not hesitate to contact us again, if you need further assistance and share details about the current state of your code.

Regards,
Plamen Mitrev
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
General Discussions
Asked by
Fletch
Top achievements
Rank 1
Veteran
Answers by
Plamen Mitrev
Telerik team
Share this question
or