Everyone’s favorite serpentine language (sorry Slytherin) can be installed on Mac. Thissssss is how I did it.
1. You’ll need a text editor. There are many out there, but I selected one that works on Mac, Windows, and Linux. I chose Atom which I downloaded from their website https://atom.io
2. You’ll need to download Python
3. You’ll need an IDE to edit and run your program. There are many out there. When I heard of Spyder’s science and data analysis libraries, I thought I’d give it a shot. I’ll be running the program below in the terminal.
To Install Python do the following:
- Open a terminal window
- Mac comes with a pre-installed version of Python 2.x.xx
- Check this by entering the following command
- To install Python 3 go to their official page (python.org/downloads) and select the download button
- Open the .pkg download and run through the installation widget.
- Once completed use the following in the command in the terminal to verify installation
Write and run a program
- Open Atom text editor
- Save the file with any name and the python file extension. For example Hello.py
- Run from the terminal
- Ensure you’re in the directory where your file was saved
- Run the program using the following command in the terminal based on the name the file was saved as.
Appium follows client/server architecture. It’s a webserver that exposes REST API
- It received connection from a client, listens for commands, executes those commands on a mobile device and responds with HTTP representing the results of the command execution
Clients initiate a session with a server in ways specific to each library, but they all end up sending a POST/session request to the server, with a JSON object called the ‘desired capabilities’ object. At this point the server will start up the automation session and responds with a session ID which is used for sending further commands.
Desired capabilities are a set of keys and values (i.e. a map or hash)) sent to the Appium server to tell the server what kind of automation session we’re interested in starting up
- There are various cababilites which can modify the behavior of the server during automation (examples…)
- We might set the ‘platformName’ capability to iOS to tell Appium that we want an ‘iOS’ session, rather than an Android one
- The complete list of capabilities is in Appium’s documentation
Appium is a server written in Node.js. It can be built and installed from source or installed directly from NPM.
There exist GUI wrappers around the Appium server that can be downloaded. These come bundeled with everything required to run the Appium server, so you don’t need to worry about Node. They also come with an Inspector, which enables you to check out the hierarchy of your app. This can come in handy when writing tests.
Appium is an open source, cross-platform test automation tool for native, hybrid, and mobile web pages, tested on simulators (iOS, FirefoxOS), emulators (Android), and real devices (iOS, Android, FirefoxOS).
The supported platforms are those that can be tested on using simulators, emulators, and real devices i.e.:
- Android OS
- Firefox OS
So why Appium?
- You don’t have to recompile your app or modify it in any way, due to use of standard automation APIs on all platforms
- You can use any testing framework
- You can write the code in any language supported by Webdriver
I’m currently on an adventure to learn automation. Tuck and roll with me as I learn and troubleshoot the framework as well as write scripts.
First couple of things I’ve learned so far and will be doing are:
- Appium is a open source mobile automation testing tool for Android and iOS application for both Native, Hybrid, and mobile web apps. It supports Selenium Web Driver API.
- I’ll be developing, architecting, and designing a mobile automation framework which my Appium test cases will be imported into.
- IDE’s for writing Java are Eclipse, IntelliJ, and Android Studio.
Solving the quadratic equation for any real or imaginary solutions is fun. See the source code below:
Maybe you want to Pay your employees. Maybe you don’t. In the case of the former there’s a link to a quick and easy C++ paycheck calculator at the bottom of the following problem:
Write a program that calculates and prints the monthly paycheck for an employee. The net pay is calculated after taking the following deductions;
Federal Income Tax: 15%
State Tax: 3.5%
Social Security Tax: 5.75%
Medicare/Medicaid Tax: 2.75%
Health Insurance: $75.00
The program should prompt the user to input the gross amount and the employee name. The output will be stored in a file. Format your out put to have two decimal places. A sample output follows:
Gross Amount: ………..$375.00
Federal Tax: ………………$536.25
State Tax: ……………………$125.13
Social Security Tax: …..$ 205.56
Medicare/Medicaid Tax: $98.31
Pension Plan: ………………$ 178.75
Health Insurance: ……….$ $75.00
Net Pay: ………………………..$2356.00
The first column is left-justified, and the right column is right-justified
See Algorithm as comment above the Code below
Find the sum of all the multiples of 3 or 5 below 1000. For example; sum of all natural numbers less than 10, that are multiples of 3 or 5 (3, 5, 6, & 9), is 23.
For the domain If there’s no remainder when x is divided by 3 or 5, take the sum of all those x’s.