Giter Club home page Giter Club logo

Comments (13)

Serchinastico avatar Serchinastico commented on May 20, 2024

Hi @arjungovindgv

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.

arjungovindgv avatar arjungovindgv commented on May 20, 2024

@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.

Serchinastico avatar Serchinastico commented on May 20, 2024

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.

arjungovindgv avatar arjungovindgv commented on May 20, 2024

Hi @Serchinastico

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.

Serchinastico avatar Serchinastico commented on May 20, 2024

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.

arjungovindgv avatar arjungovindgv commented on May 20, 2024

@Serchinastico can you share your mail ID where I can send those fails in private for detail ?

from shot.

Serchinastico avatar Serchinastico commented on May 20, 2024

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.

arjungovindgv avatar arjungovindgv commented on May 20, 2024

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🏃1.0.2'

//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.

arjungovindgv avatar arjungovindgv commented on May 20, 2024

@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.

arjungovindgv avatar arjungovindgv commented on May 20, 2024

@Serchinastico any update on this

from shot.

pedrovgs avatar pedrovgs commented on May 20, 2024

@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.

arjungovindgv avatar arjungovindgv commented on May 20, 2024

Finally after removing the dependency, it got worked.
Thank you so much @pedrovgs @Serchinastico

from shot.

pedrovgs avatar pedrovgs commented on May 20, 2024

You are welcome @arjungovindgv Thanks for using shot, we love seeing people writing tests!!!

from shot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.