Showing posts with label Mobile Automation. Show all posts
Showing posts with label Mobile Automation. Show all posts

Saturday, November 25, 2017

Android : How to get the package name of Android application

How to get the package name of Android application


There are multiple ways in which we can obtain the package name of Android .apk file. 
Here are the some quick ways to get the package name.


Step 1 : If its public app and available in https://play.google.com/store/apps , then search the app name and click on that particular app. you will get the package name as shown in below screenshot.



















Demo of Step 1 :






Step 2 : Install the app on your device and run the below command to get the list of packages and search for your app. 
 *(Make sure ADB configured in your path variable, click here to know how to configure adb on Windows , For Mac - you can click here )

-> adb shell pm list packages 












Demo of Step 2 :




Step 3 : Again using the Android command , you can get the details of app , package name

-> aapt dump badging <path of apk> | grep <any_relevant_search_text>

for example :
-> aapt dump badging D:\facebook.app | grep package









   ** aapt stands for Android Asset Packaging Tool .


Demo of Step 3 :




Step 4 : [This step is now obsolete, as Appium UI has changed , if you have OLD Appium setup , you can still use it ] If you have Appium installed and locate the .apk file and it will list the package name as shown in below screenshot.
























You can choose any above mentioned steps to get the package name of your app. Some other ways are also present to get the app name.But here i listed few easy way to get the package name. 

If you like this, please subscribe my Youtube channel,like ,comments & share.

Saturday, November 18, 2017

Mac OS : How to configure Java Home , Maven & Android Home


Mac OS : How to configure JAVA Home ,Maven & Android Home


Recently I have started using Mac OS  and I had to configure my Development environment for automation . To get started with the basic needs i.e basic program to run , my system should have been configured with JAVA_HOME , ANDROID_HOME and Maven(M2_HOME).
I learnt the way how to configure all these settings, so I am sharing my knowledge in a best possible way which can be understood easily. Also watch out my Youtube Channel for videos related to this (link is given below)

Make sure you have all these binaries installed or are downloaded and kept it in some location.

Download location :
JAVA can be downloaded from (based on bitness of OS) :  click here to download

Android SDK can be downloaded from(download Android studio, it will download the sdk) : click here to download

Maven can be downloaded from(download Binary tar.gz) : click here to download

Let’s get started with configuring these settings in OS path.

You can watch a Youtube video OR follow the step by step procedure below 

Part 1


Part 2





Step 1 : Open Terminal on your Mac.
Step 2 : Type   cd ~/
Step 3 : Check whether you have .bash_profile present, type command
$ ls –al
Step 4 : If it is not present , let’s create it using command
$ touch .bash_profile

(** touch is a standard Unix command-line interface program in its default usage, it is equivalent of creating or opening a file and saving it without any change to the file contents.)

Step 5 : Hit command ls –al again to verify its presence
Step 6 : Now open .bash_profile file which is just created. And to open you can use either of the commands.
$ open –e .bash_profile

**     -e   Opens with TextEdit.
          -t    Opens with default text editor. )

   OR
$ nano .bash_profile

(** GNU nano is a popular command line text editor used on many operating systems.)

 Above steps are common steps for configuring anything in PATH

Step 7 : How to configure JAVA_HOME
(You are required to give bin and jre path . Make sure to replace wth your path)

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home
export PATH=$PATH:$JAVA_HOME/bin
export PATH=$PATH:$JAVA_HOME/jre

Step 8 : How to configure ANDROID_HOME
(You are required to give platform-tools ,build-tools and tools folder path. Make sure to replace wth your path)

export ANDROID_HOME=/Users/shakti/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/platform-tools
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/build-tools

Step 9 : How to configure MAVEN i.e M2_HOME
(You are required to give bin folder path. Make sure to replace wth your path) 

export M2_HOME=/Users/shakti/allmywork/tools/maven-3.5.2
export PATH=$PATH:$M2_HOME/bin

Step 10 : Save and close the .bash_profile

Step 11 : To refresh the file or reload the file, type below command
            $ source .bash_profile

Step 12 : Check whether all of these JAVA , MAVEN or ANDROID  configured properly or not by typing these multiple commands
-----------------------------------Java-------------------------------------------

$ echo $JAVA_HOME
 $ javac
 $ java --version

-----------------------------------Maven-------------------------------------------
$ echo $M2_HOME
$ mvn --version
$ mvn

-----------------------------------Android-------------------------------------------

$ echo $ANDROID_HOME
$ adb
$ adb devices

Hope this helps you a bit in understanding how to configure these in path in Mac OS.
If you like this, please subscribe my Youtube channel,like ,comments & share.

That’s it !!      

Sunday, September 17, 2017

Maven : How to configure Maven into your Windows Machine

Maven is a powerful tool that is used for projects build and dependency management. 
Let see how you can configure Maven into you Windows machine.

Step1 : Download the Maven binary from you offical site. 



Step2 : Extract the binary and save it in some location.
        Let say c:\users\qahumor\maven

Step3 : Now we have to set Environment Variable for Maven.
        Right-click on My Computer ->Properties -> Advanced System Settings.
        Under Advanced Tab -> Click on "Environment Variables".


Step4 : Then click on New in System Variables.

Step5: Provide Variable name = M2_Home and Variable value = path where you saved &
       extract the maven binary ,in this case c:\users\qahumor\maven
Step6 : Select Path variable in System Variables and click on Edit 
        (be careful while changing anything).

Step7 : Go to the end and enter value like - ;%M2_Home%\bin
        (make sure to put semi-colon incase if its not present) and hit OK.

Step8 : To check whether Maven is configured properly.
        Open command prompt and type these commands

       -> mvn -version  [To see the version of maven into your pc]
				&
       -> mvn clean  [This is command to clean the project , you will see Build Failure ,
                      this is expected as you don't have POM.xml file as of now]
		
Thank you!!

Java : How to read data from properties file

How to read data from properties file


The Properties class represents a persistent or defined set of properties. The Properties can be saved to a stream or loaded from a stream. Each key and its corresponding value in the property list is a string.
Because Properties inherits from Hashtable, the put and putAll methods can be applied to a Properties object.

The Properties file is highly used in automation. Let see with an example.

package com.qahumor;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Properties;

public class Reading_PropertyFile {

 /*
  * @author : Qahumor Reading Properties file in Java
  */

public static void main(String[] args) {

// Create an Object of Properties class.
Properties prop = new Properties();

// Get the path of properties file which you have created in your project.
// System.getProperty("user.dir") - help to read the root directory of your project.
// Change the below path accordingly.
String path = System.getProperty("user.dir") + "/src/config/test.properties";

// Print the path of file for Debug purpose
System.out.println("Debug : Properties file path :" + path);

try {

// Reading the File input stream
 FileInputStream fs = new FileInputStream(path);

// Load the file into memory
 prop.load(fs);
   
} catch (Exception e) {
 e.printStackTrace();
}

// Read the value from Property file - test.properties
System.out.println("\nVersion of the Property file is : " 
    + prop.getProperty("version"));

}

}

Output:

Version of the Property file is : 3.1.4




@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

To create a property file:
1. You can open a notepad
2. Type below content in it.
    version=3.1.4
    login=admin
    pswd=xxxx
3. Save it name "test.properties" in double quotes.
4. You can download the sample property file from Link


Thank you!!





Wednesday, January 13, 2016

Appium : How to get the activity name of android application

How to get the activity name of android application


For mobile app automation, Appium requires app activity name (usually the first screen of your app when you tap on app to launch it ) in desired capabilities parameter . To get the app activity name which Appium can use while launching an app. here are the ways you can use to get the same  

Step 1 : using the aapt command.

To get the aapt.exe , you have to navigate to android sdk folder then build-tools and goto some api version . for example(specific to my machine) 
E:\Android\adt\sdk\build-tools\android-4.4W 

open command prompt and run the below command 
aapt dump badging

for example : Let's take whatsapp application
aapt dump badging E:\com.whatsapp.apk

output :
You can get the package name and launchable-activity with other details as highlighted in below :





























Step 2: using Appium UI console


Sunday, December 27, 2015

Appium : Step by step Native IOS App Automation - Part 3(iOS Simulator)

In this Part 3 , we are talking about iOS Simulator command line commands.

How this will be helpful in automation:
This will helpful in checking/verifying your iOS app whether it’s working fine without Appium or any other automation tool in picture. Once you find your app works well then you can go for automation with Appium, this is just to save your time from unnecessary troubleshooting.

Here we start with some useful and important commands

1. To get the list of Simulators available in your system , you can type below command
-> Open Terminal and type below command
                        xcrun instruments -s

2. To launch Simulator using command line , you can type below command and provide same of simulator as you got from step 1 above
-> Open Terminal and type below command
$ xcrun instruments -w "iPhone 6 (9.2)”   // replace with your Simulator name

3. To install app on Simulator using command line once Simulator is up and running, you can type below command
-> Open Terminal and type below command
                        xcrun simctl install booted <app path>
                  e.g xcrun simctl install booted /Users/macuser/Desktop/UIKitCatalog.app

4. To launch an installed app on your simulator , type below command(you can also click/tap the app and launch in simulator using mouse )
-> Open Terminal and type below command
                        xcrun simctl launch booted <app identifier>  

// To get an app identifier or Bundle Identifier you can get it from info.plist file
     e.g xcrun simctl launch booted com.example.apple-samplecode.UIKitCatalog


if you are interested to learn more about all available subcommands you can get by running
          $ xcrun simctl

Hope this helps to get acquainted yourself with basic as well as important iOS simulator commands.click here for Part 2

In Part 4 , we will see the sample demo program of iOS Native App automation using Appium. Stay tuned.


Testing a New Product: Essential Information Software Testers Must Gather in the AI Era

    Learn what information software testers must gather before starting testing a new product, including AI, automation, compatibility, and ...