JarvisJS: Functional Testing of Web Applications

    Hello Habr! In this post we would like to say hello and for the first time show the world our project JarvisJS.com - a service for functional testing of web applications. The project is still very young and is being developed with love by a team of three people for the past seven months.

    Under the cut, we will talk about our service and the reasons that prompted us to create it.

    No matter what size of application we develop, small or large, as developers, we always understand the importance of testing in our work. Moreover, the more experience we gain, the more clearly we are convinced of this. Do we always test our code? I think even the strongest of us, hand on heart, will answer no.

    Testing is always associated with two tasks: setting up some infrastructure for testing and, in fact, developing tests. It happens that at first in small projects it seems that spending time on testing is not worth it - I want to go forward as quickly as possible and build new functionality. But then life turns out very predictably and the project degenerates into a huge anti-hydra - chopping off one piece of the functionality we ruin and two others.

    Depending on the type of testing our code, the costs of preparing for it are different. If you usually don’t need to do anything supernatural to organize unit tests, then, for example, for frontend functional testing with Selenium, you need to deploy an entire infrastructure, especially if you want all tests to run somewhere remotely.

    It was this functional testing that did not give us rest for a long time. The idea is simple and clear - we are testing the application in the way a living person would work with it, right in the browser. At the same time, organizing the entire testing process is not an easy task and may require competitors from the team members that they do not have or are not interested at all (for example, unix and its command line, a new language like Java for writing Selenium tests, though WebdriverJS has recently appeared) .

    In our subjective opinion, for the average team, where the development of tests is treated as an inevitable evil, it is important that this development takes place in the most comfortable environment, with the help of familiar, native tools.

    For the frontend developer, Javascript is certainly the native tool, and the most “correct” implementation of functional testing based on Javascript is probably already familiar to all PhanotmJS. PhantomJS is really an amazing tool that allows you to control the browser using the Javascript language and at the same time allows you to automate the launch of tests on a remote server. True, in this case, testing is carried out only in one branch of browsers - Webkit, but if you are interested in just functional testing of logic, and not rendering engines, then this is not such a critical drawback compared to the feeling of being in the native environment.

    At the same time, many different tools have already been formed on top of PhantomJS that make working with it even easier: CasperJS, Zombie.JS, DalekJS, ... Personally, we opted for CasperJS.

    CasperJS is an open source project that provides a simple interface for working with PhantomJS and SlimerJS and allows you to develop functional tests for browsers using the webkit (Chrome, Safari, ...) and gecko (Firefox) engines.

    However, in spite of all the Javascript lamp-like nature of such tools, the tests still need to be stored somehow, run somewhere, and written to someone.

    Our vision of solving these problems was expressed in the project that we would like to present to you - JarvisJS.

    JarvisJS is a service that simplifies the development of functional tests based on the CasperJS framework and allows you to run them in the cloud.

    To aid in the development of tests, Jarvis provides a browser extension for recording the sequence of your actions. The extension is currently only available for the Chrome browser.

    An example of working with JarvisJS can be seen in this video:

    After recording the test, you can immediately save it in the service and run it on a remote server. Tests can be grouped by project and run the entire project at once. The test results consist of a set of assertions defined in it with the results of their verification. For each such check, a screenshot is automatically created.

    For those cases when the flexibility of the browser extension is not enough to describe the test, any test can be converted to CasperJS code and continue developing the test for JavaScript.

    Like regular test frameworks in Jarvis-e, test annotations such as “before” and “after” are available. Thanks to these annotations, you can easily distribute functionality, for example, take the authorization test into a separate test with the beforeEach annotation.

    We are currently at the pre-launch stage. And we would like to test the functioning of all systems in “combat” conditions on real users, but with a controlled number of them. =)

    In this connection, we will be very glad to see everyone interested in our project on our beta. Leave your email on jarvisjs.com and in the near future, as soon as we are ready, we will invite you to visit our service.

    In future posts, we would like to talk about the inner kitchen of our project, about how we tamed PhantomJS and CasperJS, about the technologies used and about project planning in part-time conditions.

    We welcome any of your comments and suggestions! Thanks for attention!

    I would also like to thank the administration of Thematic Media for the startup support program, thanks to which we posted this post.

    Also popular now: