how do I run Android test project from another android application - android

I created an Android test project using instrumentation and it works find with eclipse running as Android Junit test. It also generated apk file.
My question is how do I run this test from another android application instead of from eclipse. For example, if the test project is named T and I have another Android application named A. Then I would like to open up T from A.
Thanks in advance..

I think it will be good if you try to call the appropriate intent on a button click or on whatever you want to start the program. For example:
startActivity(new Intent("com.yourprogram.T") I'm not sure but i think it will works.

Why do you need to open Test project from an app on Device. I dont think you can do it because Android does not allow any app to inject action or call functions from other apps.

Related

How to start developing app for Google Glass?

I am working on a Google glass Android app. I have installed the glass development kit (GDK) in Android SDK. Now I created a glass project using Android Studio (Version 3.3.2). The newly created project is showing an error "Default Activity not found" in run->edit configuration.
Please refer the screenshot for the error.
1.
And 2. By clicking run->Edit Configuration in menu.
I have searched a lot on Google and found many articles regarding the same. All are suggested to set the edit configurations option like below.
Module: app
Package: Deploy default APK
Activity: Launch default Activity
Target Device: USB Device
I did the same, but no one is working for me. After spending the whole day to make it work, I came here. This error is due to the Launcher activity, because there is no launcher activity in Google glass project instead it uses Voice Trigger intent filter. It is similar to wearable apps they also don't have the launcher activity.
Android Studio won't let you use a standard run configuration without specifying a launcher in the manifest.
You could try using the gradle command line instead:
./gradlew installDebug
In case you haven't resolved the issue. I came across similar issue before, two ways worked for me:
Choose "Nothing" as the option. You will be able to run the app manually on the Glass, but your debugger won't work straight away. You have to manually attach the debugger to the process. You may also have to use logcat if there is a bug in the launching process.
Specify an activity (whichever is associated with voice trigger).
Also, I noticed that you created the app using Kotlin. Kotlin activity didn't work in my case, throwing exceptions associated with nullable var when resuming the activity. Non-activity classes worked fine. Please let me know if Kotlin activity worked in your case.

Create and launch Espresso test

Is there a way to create an espresso test file from a class like does Command / Control+Shift+T?
Same for launch the current test with espresso into the device?
It's very annoying to create/launch every test manually through the whole process of going to the file's hierarchy and then create the launch configuration of it. Neither an option is hidden in options?
If I remember well, these functionalities were available on Android Studio 2.3, I noticed the lack of them from AS3.0. Where did they go?
As today, Android Studio 3.1.1 comes with the functionality just as before

How to create batch command for : compile + sign + install + run

Background
As it turns out, it's quite an annoyance to test out in-app-billing (i've written about it here) . Each time you find a bug and need to test your app, you must have the following steps:
compile the app , preferably with the debuggable="true" flag on the manifest
sign the app with your real key you've created for the play store.
install the app on your device
run the app on your device, preferably debugging it via eclipse.
If you'd use a batch operation instead of doing all of those by yourself, it should make things easier to test such apps, and might also be useful for other apps as well.
The question
Is there any way to make the whole process fully automatic, so that with a single click of a button, it will do all of the above?
I know how to achieve 3+4 (using "adb.exe install -r *.apk" and "adb.exe shell am start -n FULL_ACTIVITY_PATH" ), but I don't know how to achieve the others.
If there is a solution that doesn't involve a third party app or plugin (like maven or Ant), it could be very nice. Of course, if that's what is available, I would like to know if it's possible to achieve via a batch file that will use them somehow.
Is there maybe a way to mimic how Eclipse does things in this regard, without being so specific on the project (maybe just the path of the project and that's it)?
Maybe you can package app by ant . You can do every thing you what int the ant code of packaging ,causing the core code is to make property configs in your app and referenced lib, such as build.xml,local.properties...,and replace channel in AndroidMainfest.xml ,so you can also replace any code in your android app,just as you want ,to change the flag of debug , because all the operation just handle local file before packaging your app,you can copy or modify any file in your app. After above process ,you get a app,then you can run other code to install the app. Recently ,I have been using the batch package method to get a lot of app for different channel .so hope it helps.

Create Android APK Test Application

I have an app to be tested, called app A.
I also have a test project for automated testing of this app.
I want to have a second app which includes these test cases, so that I can run all test cases for app A by starting another, app B.
I don't want to start tests in Eclipse, I want to start them directly from the phone where the app should be tested
Someone knows a solution?
BR
I guess you want to run the tests from your code, in such case this post, presenting a solution to run instrumentation from code, will be of help.
Maybe i didnt' understand... You want to start an activity from MainActivity but the 2nd activity has to be hidden from launcher?

Is it possible to configure an Android install to run a single app?

Is it possible to configure the Android OS to run only a single app?
Basically what I want to do is customize an Android device so that it boots up and runs one application only, and for that application to be switched to the front of the screen automatically. Also, when it gets closed, to be started up and switched to again. Any ideas?
Thanks,
-David
One method is to get the source of Android and write your own custom ROM of Android as Octavian wrote.
Another alternative would be to write a custom home app that, well, isn't really a home app (but replaces the default home app intent). See SlideScreen as an example of a non-traditional "home" app.
Yes it is possible. You have to fetch yourself the source codes for Android and basically create a custom ROM. After applying all desired modifications you bake your ROM and install it to your device.
Pretty much all you need to know about the source and the process of compiling the sources are located at Android Sources. You can view the source codes from your browser by following this link.
Hope it helps you a bit. Good luck.

Categories

Resources