Arachnidium self-made framework for testing web and mobile applications. Get started!
Hi, Habr!
This article is about one tiny trick (yes, compared to, for example, Spring), which, with some fine-tuning to the mind, can find application in testing both web and mobile applications, or just be some kind of interesting example for future developments. direction. In this case, should be implied tests from the UI. I think it's interesting in its own way that someone has a similar prototype. In fact, this publication is dedicated to one of my hobbies. In my free time I tried to work on simplifying and unifying ways of describing interactivity with web and mobile applications using the WebDriver API.
And also - this is the work on the mistakes of the articles “About Selenium and one“ bicycle ” and “ From bicycle to ... ” . ')
I mean, this is an opener of a series of small consecutive topics. Thanks to the advice of Dmitry_Zhariy, I decided to make them in an unusual format ... There will be little text, but there will be video materials in which I will try to clearly and concisely cover the topic. I hope I won’t waste your time.
Articles may be of interest to both QA specialists and developers. People who are just interested in open source, I am very happy. If someone is not familiar with Selemium and Appium - it does not matter. After all, you can always google! ..
There will be simple examples. In the following articles (if it makes sense) - more advanced.
Plan: - TTX; - Let's start; - The first web test; - The first test of the mobile application; - Cross-platform test; - The conclusion or continuation follows. As a “guinea pig”, the social network “VKontakte” was chosen - web and native Android application. Instead of unnecessary words, I will simply demonstrate the actions that will be “tested”.
The sketch was originally written in java 7, but then migrated to the eighth version. I was just interested to try its features + it contains things that helped reduce the amount of code. Some features, such as Repeatable Annotations, have found their obvious use in the form of framework features.
Selenium - needs no introduction. Used to automate the interaction with desktop browsers: - Mozilla Firefox; - Google Chrome; - Internet Explorer; - Safari; - PhantomJS (because of it, it is still impossible to raise the version of Selenium to the last, waiting for the publication of the fix ).
Appium is a relatively young framework designed to automate interaction with mobile browsers and applications. It includes NodeJS server and client libraries in various programming languages. It is still actively developing, although in my opinion it is no longer as loose as it was at the time of this writing . I myself from time to time throw my five kopecks into the development of client libraries. At first it was a Java-client , I think a little help with .NET.
Used to automate interactions with: - Android Chrome; - native browser Android and Chromium - recently screwed to the described development; - Mobile Safari; - native and hybrid applications - while Android and iOS. In the future - Firefox OS and Windows Phone.
Inside the framework, there is a system of mediators, factories, dependency injection, etc. All this farming lives by ...
Spring + AspectJ - in my opinion it turned out to be a great alternative to EventFiringWebDriver and not only. I think it makes sense to think how you can further expand the use of this sweet couple.
CGLIB supports a significant amount of end-to-end functionality.
Many other secondary libraries ...
Let's start
The operating system is Windows 7/8, Mac OS X (minimum 8.5). About Linux / Unix / Ubuntu I can not say anything, because I did not check. I repent, a sinner, I will try to fix it!
Firstly, you need to download and install Java. At least Java SE Development Kit 8. Further. Install a new IDEA or download Eclipse - Luna is better right away. If you are interested in mobile platforms, I advise you to read and configure everything according to the requirements of Appuim . True, there is not a word said about Genymotion (Android). But you can try. I personally really like :)
Customized?
Open the development environment. We create Maven - the project. Fine! It is enough to write the following dependency in pom.xml:
Attention!!! I Wang, that comments on the video are possible. Usually the speaker Kodit and explains. My hand is not yet full. It was easier for me to prepare everything in advance and then explain it by what was written. But if such a format suits everyone ... It took me 1 hour (+ - 10 minutes) with all debugs to prepare all three examples. If anything - the quality of the video will be discussed in the comments. For now - each video will be followed by corresponding links to github.
From myself: I think those who use the development of Yandex HtmlElements on a daily basis may have a feeling of deja vu. Indeed, I borrowed something from there. BUT! This is a simple example for priming. There are several deeper differences that I will bypass and present in the following publications.
Further, I think the material is more interesting!
In this publication, I just presented to you what happened. I hope it was interesting. I didn’t do a real tutorial, since this format is more suitable for solutions that have already proven themselves and are being actively implemented. The usefulness of this development is still virtual, I think - it is better seen from the side.
You can see the full “tutorial” on github . By the way, there is already material here that is not disclosed in this article, but is ready for the next one.
Very simple things were shown here. In the following (I assume another 2-3 publications) I want to demonstrate more interesting developments. But! Whether the following publications are needed is up to you.