Comments (13)
I think I had this very same problem when the emulator didn't have write permissions for the sdcard or there was a major problem running tests (some sort of crash). Try deleting and creating the emulator again and see how it goes. Another thing to watch here is the facebook's dependency version.
You can find a working project here: https://github.com/Karumi/KataScreenshotKotlin. Try cloning the repo and executing ./gradlew executeScreenshotTests -Precord
to see if it's a problem with the emulator or the library.
from shot.
@Serchinastico If its a permission issue ? then how the entire test suite will run but not for it's very first test class.
I tried with Real Device too.. got the same problem
For my project too, its running perfect with ./gradlew executeScreenshotTests -Precord but not for the particular test method or class
Thanks for the immediate Reply
from shot.
I meant write permissions as in the file system permissions, not in the AndroidManifest declaration way. Anyways it was just a wild guess as I'm lacking some context here. If I'm understanding your problem right it's that running a single test class fails with the "no such file..." error message, isn't it? Are you sure you are running the command with the whole package name + class name? As in
./gradlew clean executeScreenshotTests -Pandroid.testInstrumentationRunnerArguments.class=com.karumi.ui.view.MainActivityTest
Try running that on the sample project (https://github.com/Karumi/KataScreenshotKotlin) and see if it works. Once you run it we will know if the issue is in the emulator, in your project's configuration or the library itself.
from shot.
Sample Project working fine. Even for my project test is running perfectly getting error in report generation part alone that too on running a particular class or method
Logcat trace :
Task :app:downloadScreenshots
?? Pulling screenshots from your connected device!
Task :app:executeScreenshotTests FAILED
? Comparing screenshots with previous ones.
FAILURE: Build failed with an exception.
- What went wrong:
Execution failed for task ':app:executeScreenshotTests'.
java.io.FileNotFoundException: /Users/..../app/screenshots/screenshots-default/metadata.xml (No such file or directory)
-
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. -
Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.10.1/userguide/command_line_interface.html#sec:command_line_warnings
from shot.
If the project I linked you is working try comparing its dependencies and project configuration. More specifically, see if there is any difference in the 'com.facebook.testing.screenshot:core'
version. Apart from that, I'm kind of lost here without more context. Can you send us a minimal project where the lib is not working so that we can see what's happening?
from shot.
@Serchinastico can you share your mail ID where I can send those fails in private for detail ?
from shot.
I'm afraid not, we try to offer support for the library, not your specific project. If you can create an open source minimal project replicating the issue we will be glad to help you and it will be way easier for us to spot the issue.
from shot.
I am having a test class under
/app/src/androidTest/java/testcases/TestClass
Build Gradle File Dependency
androidTestImplementation 'com.android.support.test.uiautomator:uiautomator-v18:2.1.3'
// androidTestImplementation 'com.android.support:support-annotations:28.0.0'
androidTestImplementation 'com.android.support.test.espresso:espresso-web:3.0.2'
androidTestImplementation 'com.android.support.test:rules:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-idling-resource:3.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-contrib:3.0.0'
androidTestImplementation 'org.assertj:assertj-core:2.0.0'
androidTestImplementation 'com.android.support.test
//spoon - report generator - automations
androidTestImplementation 'com.squareup.spoon:spoon-client:1.6.4'
// facebook
androidTestImplementation('com.facebook.testing.screenshot:core:0.4.2') {
exclude group: 'com.crittercism.dexmaker', module: 'dexmaker'
exclude group: 'com.crittercism.dexmaker', module: 'dexmaker-dx'
}
}
shot {
appId = "app Id*'
instrumentationTestTask = 'connectedPhoneDebugLocalAndroidTest'
packageTestApkTask = 'packagePhoneDebugLocalAndroidTest'
}
spoon{
singleInstrumentationCall = true
}
On running this command
./gradlew executeScreenshotTests -Pandroid.testInstrumentationRunnerArguments.class=testcases.TesClass -Precord
test is running fine and everthing works fine but for report generation I am getting
Task :app:downloadScreenshots
?? Pulling screenshots from your connected device!
Task :app:executeScreenshotTests FAILED
? Comparing screenshots with previous ones.
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:executeScreenshotTests'.
java.io.FileNotFoundException: /Users/..../app/screenshots/screenshots-default/metadata.xml (No such file or directory)
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.10.1/userguide/command_line_interface.html#sec:command_line_warnings
from shot.
@Serchinastico what more info should I have to provide ? If I run the whole test suite its working fine but getting while running a particular class or method
from shot.
@Serchinastico any update on this
from shot.
@arjungovindgv why are you using androidTestImplementation('com.facebook.testing.screenshot:core:0.4.2')
? This might be the issue. Could you try removing this dependency?
On the other hand, could you check the test you are executing passes just running it from Android Studio? If the issue is not related to the lib version it has to be related with how the library is saving the screenshots and we'd need to know if the test pass from Android Studio.
from shot.
Finally after removing the dependency, it got worked.
Thank you so much @pedrovgs @Serchinastico
from shot.
You are welcome @arjungovindgv Thanks for using shot, we love seeing people writing tests!!!
from shot.
Related Issues (20)
- View screenshots dont work in sample app. HOT 3
- cannot record spinner when expand
- Confusion about folder structure when using -PrunInstrumentation=false HOT 1
- Can't record very large view inside ScrollView
- Problem: is there a way to capture bottom sheet while its open?
- Aggregate all modules report together to a root report
- "Unresolved reference: shot" HOT 6
- `ManagedVirtualDevice` support HOT 2
- Snapshot on multipe devices only saving last screenshot HOT 1
- How to compare screens with dynamic content
- Screenshots get deleted after being recorded.
- XML report not showing failing tests HOT 1
- Failed to grant permissions HOT 2
- Waiting for remote image fetch HOT 1
- Generated diff image does not show all differences
- Removing the Toolbar shadow (elevation) HOT 1
- Is it possble to test screenshots for gif animated image?
- Feature Request / Question - Record Screenshots at Runtime HOT 2
- Failing to record screenshots HOT 8
- compareScreenshot to capture and verify full screen
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from shot.