Macaca-ios Getting started with those thingsPreface
Recently, a friend asked me to ask the iOS Automated test framework selection, just a while ago to do the lectures found Macaca, then try. So, the following content will only revolve around the iOS part of Macaca.
What is Macaca?
Ali's mobile auto-test framework, while supporting Android,ios. And the previous Ali's Athrun seems to have given up maintenance.
Official website: https://macacajs.github.io/macaca/
Macaca based on node. JS, the test Case authoring language only supports node. js for the time being.
the difference between Macaca and Appnium
Frankly speaking, this kind of external drive instruments server-client Automated test framework, the implementation of iOS is very limited, so its bottom-up implementation of the same way.
In the application-level package, both use node. js as the development language, the interface is also based on the Web-driver implementation, so the Macaca and Appnium are very similar.
How do you see the difference between Macaca and appnium?
The following are the design ideas of Macaca authors:
appium 是个优秀的工具。但无法满足更轻、更快、更稳、更易集成、更贴合业务的高要求。
You can think of Macaca as a lightweight appnium. Of course, this means that a lot of appnium functions will be gone. But it also creates a lightweight, more integrated framework, why isn't it?
installation
In fact, the installation is very simple, but still a lot of people can not build up the environment. Let's go over the details here.
-
Xcode (and Xcode Command line Tools)
-
node. js
- https://nodejs.org/en/download/
-
After installation, verify that the installation is successful
chentekimacbook-pro:~ chenximing$ node-v v4.4.3 chentekimacbook-pro:~ chenximing$ npm-v 2.15.1
- NPM is a node. js package Management, which is then used by Macaca.
-
Brew
- Apt-get on Mac, package management tools.
- Http://brew.sh/index_zh-tw.html
At this point, if the above 3 people do not understand, first give up the construction of Macaca, first to understand the above things using first ....
-
Macaca installation
NPM i-g MACACA-CLI
Note: Here is the new MACACA-CLI, if you look at the old version of the tutorial is: macaca-client (Hope not to change after ...) )。
Check to see if the installation is ready:
-
Note: Check-list you may not be able to pass, like my Android section, platforms directory check failed. So what, I try the iOS section again, don't bird it. Just make sure:
node. js Checklistios checklistinstalled Driver List
The above 3 full pass can be. If according to my earlier step, above 3 should not have failed.
-
Installing Iso-webkit-debug-proxy
brew install iso-webkit-debug-proxy
Make sure you install it in brew! Before some old documents will be slightly pit novice, hand-compiled way .... This requires manual installation of n multiple dependencies: Autoconf,libtool,xml2 ... It's not skilled, it's killing you.
What does Iso-webkit-debug-proxy do? From the dependent libraries it installs, you can see:
libimobiledevice/usbmuxd/
Itools is the use of this thing and the iphone communication, Libimobiledevice is cracked itunes and iphone communication after the implementation of LIB. Xcode5 before is fruitstrap,fruitstrap later abandoned maintenance, XCODE5 after using Libimobiledevice.
At this point, the installation is complete, very simple is not:>
run the first test case
After the installation of the framework, to run a run Ah, otherwise what to do? You have to answer the following questions first:
- Where did the case come from?
- There are cases also need to have app ...
- The device that runs the case, you can choose the simulator and the real machine. Since the installation of Xcode with the simulator, so when running the first case, the first use of the simulator will be relatively simple.
Then 1th, 2 questions how to solve?
The author has solved it for you. He has prepared the first test case and its corresponding app for you.
Download the case and app
git clone https://github.com/macacajs/macaca-test-sample.git --depth=1
If you don't know what git is or don't have, you can go to https://github.com/macacajs/macaca-test-sample to download it.
After downloading, go to the Macaca-test-sample directory and execute:
npm i
macaca-test-sample directory Structure parsing
./├── HISTORY.md├── LICENSE├── Makefile├── README.md├── app├── circle.yml├── macaca-test├── node_modules└── package.json
-
App
- Store the app:ios-app-bootstrap.zip used in the test.
-
Macaca-test:
./├── macaca-desktop-sample.test.js # 桌面浏览器测试案例...作者的想法有点多啊-_-!├── macaca-mobile-browser-sample.test.js # 移动端浏览器测试案例├── macaca-mobile-sample.test.js # 移动端App测试案例└── mocha.opts
If you simply want to see the iOS app test results, you can macaca-mobile-sample.test.js outside the *.js are killed.
run the first test case
macaca run --verbose
so far, Macaca and its case have run.
Macaca-ios Getting started with those things