Read golden images from src directly (#159)

This PR prevents Gradle from copying the golden images
to build/resources/test, so the screenshot test would
read golden images from src/test/resources directly and
display the path in test log if the test fails. Because
the path pointing to the actual file in src/ folder,
the engineer can easily find it.
This commit is contained in:
Shicong Huang 2019-07-09 10:49:20 -04:00 committed by GitHub
parent 730f108e13
commit 8dd6797614
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 1 deletions

View file

@ -97,6 +97,10 @@ sourceSets {
}
}
processTestResources {
exclude '**/webdriver/*'
}
configurations {
css
jaxb
@ -140,6 +144,8 @@ dependencies {
"${rootDir}/third_party/objectify/v4_1/objectify-4.1.3.jar")
testImplementation project(':third_party')
testRuntime files(sourceSets.test.resources.srcDirs)
compile deps['com.beust:jcommander']
compile deps['com.google.api-client:google-api-client']
maybeRuntime deps['com.google.api-client:google-api-client-appengine']

View file

@ -141,7 +141,15 @@ public class RepeatableRunner extends BlockJUnit4ClassRunner {
int numSuccess = 0, numFailure = 0;
Throwable lastException = null;
for (int attempt = 1; attempt <= MAX_ATTEMPTS; attempt++) {
attemptNumber.set(attempt);
// attemptNumber would be null if any exception happens during the
// instantiation of test class object(including test rules). However,
// those exceptions would not be actually thrown until statement.evaluate()
// is invoked. So, we should just skip the setter and let the statement
// be evaluated. Then we should be able to find the stack trace of
// root cause in the test reports.
if (attemptNumber != null) {
attemptNumber.set(attempt);
}
try {
statement.evaluate();
numSuccess++;