Skip to content

Commit

Permalink
Allow core tests to have speed set
Browse files Browse the repository at this point in the history
  • Loading branch information
shs96c committed Jul 26, 2016
1 parent 9c84654 commit 40f3ada
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public void run(Results results, WebDriver driver, Selenium selenium) {
} else {
stepResults.add(new StepResult(step, null));
}
state.sleepTight();
}

results.addTest(rawSource, stepResults);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,26 @@
import static java.util.regex.Pattern.MULTILINE;

import com.google.common.base.Preconditions;
import com.google.common.base.Throwables;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

class TestState {
private static Map<String, Object> storedValues = new HashMap<>();
private long commandTimeOut = TimeUnit.SECONDS.toMillis(30);
private long speed = 0;

public void sleepTight() {
try {
Thread.sleep(speed);
} catch (InterruptedException e) {
throw new RuntimeException("Unlikely: " + Throwables.getStackTraceAsString(e));
}
}

public void store(String key, Object value) {
storedValues.put(key, value);
Expand Down Expand Up @@ -63,8 +75,6 @@ public String expand(String toExpand) {
}
return stringResult;
};
*/
Pattern toMatch = Pattern.compile("\\$\\{(\\w+)\\}", MULTILINE);
Matcher matcher = toMatch.matcher(toExpand);
Expand Down

0 comments on commit 40f3ada

Please sign in to comment.