Coder Social home page Coder Social logo

Cannot run Fork about fork HOT 22 CLOSED

shazam avatar shazam commented on July 29, 2024
Cannot run Fork

from fork.

Comments (22)

iordanis avatar iordanis commented on July 29, 2024 1

What does the output of the command "adb devices" say?

Sometimes I've found that stopping all gradle daemons fixes that. Try "./gradlew --stop" to do that. I haven't dug deeper about that issue.

from fork.

emmano avatar emmano commented on July 29, 2024

adb devices returns device ids for both of my emulators. I will try stopping the daemons. Also, there is no 1.2.0-SNAPSHOT in maven.

from fork.

iordanis avatar iordanis commented on July 29, 2024

There is on the snapshot repo: https://oss.sonatype.org/content/repositories/snapshots/com/shazam/fork/fork/1.2.0-SNAPSHOT/

from fork.

emmano avatar emmano commented on July 29, 2024

Thanks for clarifying. ./gradlew --stop did not work.

from fork.

emmano avatar emmano commented on July 29, 2024

I am getting this error now:

Error when trying to scan for test classes
com.shazam.fork.suite.NoTestClassesFoundException: No tests classes were found in the dex files.

./gradlew --stop seems to remove the "No devices found" error.

from fork.

iordanis avatar iordanis commented on July 29, 2024

That has to do with where Fork scans for tests.

By default it will scan in a package that is the same with your instrumentation APK's package ID. If you haven't specified that in your test AndroidManifest.xml, it will be the same as the app's package ID with the suffix '.test'.

Also, if your instrumentation package ID is something like com.example.test but your tests are in a package that doesn't follow the convention, say com.example.instrumentationtests you need to tell Fork that with the setting:

fork {
testPackage "com.example.instrumentationtests"
}

Please, feel free to add to the doc if you think this is not covered enough (which is probably the case).

Closing this issue for now, I'll raise a separate one to address the No devices found.

from fork.

emmano avatar emmano commented on July 29, 2024

I thought it might be related to the package name, so I tried using the DSL to give it the right package name. I still get the same error.

from fork.

iordanis avatar iordanis commented on July 29, 2024

If you run the grafle command with --debug, you can check what package fork is looking into.

from fork.

emmano avatar emmano commented on July 29, 2024

It seems to be looking at the right test package. Interestingly the logs say that assembleDebugAndroidTest has no actions:

09:02:32.190 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Starting to execute task ':app:assembleDebugAndroidTest'
09:02:32.190 [INFO] [org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter] Skipping task ':app:assembleDebugAndroidTest' as it has no actions.
09:02:32.191 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':app:assembleDebugAndroidTest'
09:02:32.191 [INFO] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] :app:assembleDebugAndroidTest (Thread[Daemon worker,5,main]) completed. Took 0.001 secs

These are Robotium tests that are located in an androidTestRobotium folder instead of the regular androidTest folder. Would this cause issues?

from fork.

iordanis avatar iordanis commented on July 29, 2024

What task are you running?

from fork.

emmano avatar emmano commented on July 29, 2024

./gradlew forkDebug. When I do ./gradlew tasks | grep fork I get fork and forkDebug.

from fork.

iordanis avatar iordanis commented on July 29, 2024

Curious: which connected*Test task were you running before applying Fork? I'm not sure how the "Robotium" folder will be picked up if you haven't declared a flavour for it. Any reason you haven't tried androidTest instead ?

from fork.

emmano avatar emmano commented on July 29, 2024

I also tried with a simpler project and it didn't work. What would be the process? Do I need to run a task before running fork?

from fork.

iordanis avatar iordanis commented on July 29, 2024

If you don't mind sharing the simple project where this is broken, I could have a look.

from fork.

emmano avatar emmano commented on July 29, 2024

I can when I get home today. I think it would be beneficial if you guys could add a sample project to this repo with fork configured as it should.

from fork.

emmano avatar emmano commented on July 29, 2024

Sorry for the delay. I created a new Android Studio project that has the default Application Instrumentation test. I still get the same error. You can find the repo here.

from fork.

emmano avatar emmano commented on July 29, 2024

@iordanis Thanks a lot for all your help. Sorry, I did not pick up what you were saying earlier. I thought that Fork would be set up to run out of the box with a new Android Studio project and did not realize that the BlankActivity template does not put tests inside a test package.

One last question. If I want to run my UATs in two emulators at the same time, but not the whole test suite in both (basically 50% of the tests in one emulator and the other 50% in the other) I need to use the fork.pool.POOL_NAME=(Serial','?) option, correct? Namely I want to have both emulators in the same pool, right?

Once again, thanks a lot for your patience.

from fork.

iordanis avatar iordanis commented on July 29, 2024

No problem.

That's probably a good idea, if that's the default AS behaviour. I have to admit I haven't used the wizard recently.

For splitting tests even easier use ./gradle forkDebug -Dfork.computed.sw=all=0. That will create one pool of all connected devices and split the tests in there. You can use the one you suggested, but if the serial numbers change (say you connected one more device or disconnected another), you have to change the command accordingly, which is more effort.

from fork.

emmano avatar emmano commented on July 29, 2024

Thanks a lot. This library is going to be of great use for us. We have around 500 Robotium UATs that currently take 1.5hrs to run.

from fork.

iordanis avatar iordanis commented on July 29, 2024

That's why we started with this, too. With our current setup they take 4 minutes, so it works well :)

from fork.

iordanis avatar iordanis commented on July 29, 2024

Oh and if you use Jenkins as CI, let me know if you can run the Flakiness reporter. That's been also pretty useful. Also, would be easy to migrate to your CI system if it's not Jenkins.

For your reference, I've raised another issue for the default package: #63

from fork.

emmano avatar emmano commented on July 29, 2024

I will try the Reporter next. I will let you know how it goes. We do use Jenkins.

from fork.

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.