[Android]New release of ATSL and new feature of composer

Lately, I’ve been using composer to run instrumented tests in the Android world. ([Android]composer and swarmer)

Today, I just found an interesting PR. => https://github.com/gojuno/composer/pull/138

The PR is emulating the behaviour like AndroidTestOrchestrator. As you know, the orchestrator has some limitations and it includes Parameterized tests aren't currently supported. It is JUnit4’s feature. So, the test support library has introduced JUnitParams.

The PR also has the same limitation. My project has been introduced the new Params so we don’t affect the limitations. But if you’d like to introduce the new composer’s feature, you should take care it.

I also just found interesting news.

Espresso 3.0.2, Runner 1.0.2, Rules 1.0.2, Monitor 1.0.2, AndroidTestOrchestrator 1.0.2 (2018-04-24) have been released!
https://developer.android.com/topic/libraries/testing-support-library/release-notes

They have some good improvements and fixes. For example:

  • Espresso 3.0.0 should NOT depend on test runner
  • ActivityTestRule doesn’t update Activity instance during configuration changes
  • Pass -e clearPackageData flag if you wish the orchestrator to run pm clear context.getPackageName() and pm clear targetContext.getPackageName() commands in between test invocations. Note, the context in the clear command is the App under test context.

etc.
Reading the release note, they fixed and improved many things for AndroidTestOrchestrator. That is brilliant.

Advertisements

Read “Antifragile Systems and Teams”

I read Antifragile Systems and Teams. Entirely, this book is DevOps book, I thought. This book also short. So I just left some lines in this article and I’ll leave here.

Anyway, do you heard Antifragile? I hadn’t known the word before.

Let refer the Taleb’s word from a book.

“Some things benefit from shocks; they thrive and grow when exposed to volatility, randomness, disorder, and stressors and love adventure, risk, and uncertainty. Yet, in spite of the ubiquity of the phenomenon, there is no word for the exact opposite of fragile. Let us call it antifragile. Antifragility is beyond resilience or robustness. The resilient resists shocks and stays the same; the antifragile gets better”
> https://en.wikipedia.org/wiki/Antifragile

As the word said, antifragile is anti + fragile. But it isn’t not fragile. It’s more robust and resilient thing. And this book tried to show how to build such systems/teams, especially software development industry.

Lately, I believe DevOps methodology became common. We can imagen agile, flexible, robust and autonomous things. And this book also challenges to show use cases and examples for it.

What I surprised was I saw QA(Quality Assurance) related engineers often appeared. I thought this kind of books shows some ideal story, but this book was more close to real DevOps story. I also read DevOps and Testing books as same as this book.

This book is too short. Only 20 pages in PDF and they were summarised good enough things. So, if you have an opportunity to read it, let’s read it.

See you happy DevOps? 🙂

[Appium]Image comparison with Appium and other libraries

In general, we compare two images when we’d like to detect differences between them in visual.

I believe OpenCV and ImageMagick are famous tools to achieve the purpose lately. But sometimes we faced building errors, for example. So, I’ve used a simple enough comparison tool. That is Kobold. The library uses blink-diff as a comparison engine. The library provides some features to configure how to compare each other.

I’ve published Ruby wrapper to use them.

And you can also see some articles for it on this site. (Most of them are Japanese, and you need to translate though…) Link

By the way, I also researched some similar and straightforward libraries. I believe perceptualdiff also a famous library. I compared ImageMagick and perceptualdiff a bit before.

A few years ago, I started to investigate OpenCV, opencv_sample is one example, to make such comparison more flexible. The reason why I investigated it is many guys have been implemented Machine Learning / Deep Learning features in it. So I’ve believed it helps us.

And lately, Appium is going to support OpenCV based comparison features as one of the fundamental features. https://github.com/appium/appium-support/pull/65 is the brilliant PR. We can use some OpenCV features via them. We are also able to get diff images to ensure the results in visual.

The feature will help many users who would like to get image comparison easy.

Actually, to make test suites stable, separating steps are important like:

  • Conduct test cases and assert the results without image comparison
  • Compare images
  • Collect and save the results

Otherwise, the new Appium feature will encourage automation more, I believe.

[iOS]xccov and JSON format

Before Xcode 9.2, we can get formatted coverage data using https://github.com/SlatherOrg/slather, for example. The library formats llvm-cov.

But from Xcode 9.3, xccov is introduced officially. The command can run via xcrun.

xccov is a new command-line utility for inspecting the contents of Xcode coverage reports. It can be used to view coverage data in both human-readable and machine parseable format. To learn more, enter man xccov in Terminal. (37172926)

I tried the feature with https://github.com/KazuCocoa/test.examples and I put a simple Ruby gem script to get the target name and the line coverage.

Run

$ git clone https://github.com/KazuCocoa/test.examples && cd test.examples
$ xcodebuild -workspace test.examples.xcworkspace -scheme test.examples -derivedDataPath Build/ -destination 'platform=iOS Simulator,OS=11.3,name=iPhone 7' -enableCodeCoverage YES clean build test CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
$ xcrun xccov view --only-targets --json Build/Logs/Test/*.xccovreport > result.json

Get JSON

We can get some kind of format.

# Output: https://gist.github.com/KazuCocoa/40eaa3ac9de5e52c1a3795c49657dd4b
$ xcrun xccov view --json Build/Logs/Test/*.xccovreport | jq .

# Output: https://gist.github.com/KazuCocoa/879554e02934d368f976959d3f8cec4b
$ xcrun xccov view --only-targets --json Build/Logs/Test/*.xccovreport | jq .

Parse the JSON with Ruby

parsed = Xccov::Parse.new(file: './result.json')
parsed.targets_line_coverage["test.examples.app"] #=> 0.35

Conclusion

From Xcode 9.3, we can get formatted coverage data using xcrun command. I’ve seen some scripts use Slather and Nokogiri to handle XML format and collect them. But the script will be more simple. Does this make you happy?

「プロフェッショナルSSL/TLS」を読んでHTTP/Sの、特に暗号周りの基礎を学ぶ

プロフェッショナルSSL/TLS を読んだ。

大学時代に鉄板とされていたマスタリングシリーズの話題がでてきたりと、おぉという良い驚きの感じでした。ネットワークに関する日本語を真面目に学んだ時によくお世話になりましたね。。大学後もいくつか大学時代のものにお世話になるのですが、これはよく見ていましたね。

楕円曲線暗号(Elliptic Curve Cryptography)の話なんかもでてきて、大学のころにやったことも含まれて良い感じだった。主にはセキュリティ関係のところを想像しながら聞いていた。

私はこのてのプロトコル実装自体には関わっていないので、基礎を丸っと復習したのと、OpenSSL周りの話を熟読して、他はさっと内容を学ぶ感じで終えました。

今やインターネット、特にHTTP/Sは生活から切り離すことができないところまで浸透しているので、エンジニアであれば基礎としてこれは学んでおいて損はないだろうなーと感じました。

Read “Practical network automation”. It was for network engineers

I bought the book of Practical Network Automation when the book was discount.

The main topic is Ansible and Python code for network engineers who have few experience for Python/PowerShell. I expected more programming related stories, but it is a bit fundamental stuff.

BTW, when I saw some word such as “Software Defined Network”, “Open Flow”, etc, and it made me nostalgic… (My previous company and sort of my university age.)

iOS 11 Programmingを今更だけれど読んだ

そういえば、半年以上はもう経ってますよね…

飛行機の待ち時間とかにざっと読んだり、所々、きになるところは写経しながら読んだ。知っているところ、知らないところと様々あったのですが、あの時期にこれだけのものをリリースしたのってやっぱりすごい…

個人的には、Decodable付近の話が一番実際の仕事にも結びつく感じでよかったです。PDFKit付近は、簡単なアプリ作成も兼ねて作ってみようかなと思いました。技術書系も大体はebupで購入してGoogleBooksにあげている生活なのですが、たまにPDFのものを手に入れることもありますし。そんな時に自分で作ったものでサクッと読むとかやっぱり面白いですよね。(そこまで簡単にPDFを組み込める、というところが特に面白かった)

iOS 11 Programming

iOS 11 Programming

  • 著者:堤 修一,吉田 悠一,池田 翔,坂田 晃一,加藤 尋樹,川邉 雄介,岸川 克己,所 友太,永野 哲久,加藤 寛人,
  • 製本版,電子版
  • PEAKSで購入する

そういえば、Metalもそうだったんだ、確かにというところが多くてとても為になりました。

ありがとうございました。

[Appium]get performance for iOS

So long ago, I tried to monitor iOS performances using instrument commands. But I gave up once because of host machine’s load.

But https://github.com/appium/appium-xcuitest-driver/pull/637 is created and that is awesome…

I just remember seeing the PR and I’ve published this article in my memory…

touch Kubernetes

I know of Kubernetes, but I have few experience for that.

But the kubernetes community has interesting tutorials.

https://kubernetes.io/docs/tutorials/kubernetes-basics/

I can imagine the architecture and how to work.
I guess I’ll use them and Istio though.