compare two values in ranorex

霸气de小男生 提交于 2019-12-11 09:41:29

问题


We are using Ranorex 5.02 We need to compare values (numbers) in website UI and generated pdf file these values always are the same. Each time the system will generate new values for UI and pdf file. We need to check that the new generated values are correct. Adding validation methods not really help because the system recorded actual number and after running test script again validation is failed. We tried to create variables in validations the system displays unbounded variable message.

Any help is greatly appreciated.


回答1:


You can use the "Get Value" action in order to store the values into a variable. After that you can compare the values using the "Equals" method from the String class in .NET.

 public void CompareText(string webText, string pdfText)
    {
        if(webText.Equals(pdfText))
        {
            Report.Info("Text is equal!");
        }
        else
        {
            Report.Info("Text is NOT equal!");
        }
    }


来源:https://stackoverflow.com/questions/23410655/compare-two-values-in-ranorex

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!