mosil / robotium

Automatically exported from code.google.com/p/robotium
0 stars 0 forks source link

In RobotiumUtils.java , Matcher.find() maybe invoked twice and lead to get uncorrect result #549

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.when we wait for a text or click on a text

What is the expected output? What do you see instead?
We expect to get the text we want and it truely there,but we get a null

What version of the product are you using? On what operating system?
Version 4.3 on windows7 x64

Please provide any additional information below.
I have try to modify the robotium source code to make it correct as below, and 
it finally works fine.

boolean isMatcher = matcher.find();

if(!isMatcher){
     // Here why we need to do it again, not understand very carefully
     regex = regex.replaceAll("[\n\r]", " ");
     matcher = Pattern.compile(regex).matcher(viewText);
     isMatcher = matcher.find();
}

// If we do not use a bool var, we can call method below between invoke 
matcher.find() twice.
// matcher.reset();

if (isMatcher){
   uniqueTextViews.add(view);
}

Original issue reported on code.google.com by songguan...@gmail.com on 1 Nov 2013 at 12:54

GoogleCodeExporter commented 9 years ago
Thanks for reporting this. Does this happen with Robotium 4.3 that is 
downloadable from the website?

Original comment by renasr...@gmail.com on 1 Nov 2013 at 1:07

GoogleCodeExporter commented 9 years ago
Thanks again for reporting this. It has been fixed in 4.3.1.

Original comment by renasr...@gmail.com on 4 Nov 2013 at 4:33