Search code examples
javascriptautomated-testsandroid-testingnashornopentest

What's the best way to learn JavaScript for OpenTest


I'm looking to get up to speed on JavaScript that is used by the OpenTest framework link. I know that it uses the Nash Horn JavaScript engine. Has anyone taken the time to find out what version of JavaScript OpenTest uses?


Solution

  • Latest OpenTest version (1.1.4) supports JavaScript ES5. The JS knowledge required for OpenTest is minimal (although you can apply any valid ES5 construct). This is what you should be familiar with:

    • Variable declaration, assignment and scoping. This can be tricky in JS make sure to learn about the concept of hoisting, to avoid unpleasant surprises later on.
    • Control structures and looping: if, for and while statements.
    • Working with objects: mainly declaration and accessing properties.
    • Working with arrays: declaration, adding/removing elements and the array API (you can probably get by with just using length, indexOf, filter and push).
    • Working with functions: declaration, functions expressions, function calling and arguments. Also learn about hoisting in the context of function declarations.
    • JSON: converting to/from JSON data. In OpenTest, the $json function can also be used to convert a JS variable to a JSON string.

    There are many good resources to learn JavaScript. If you already have some coding skills, here's a book that's designed for people that are somewhat familiar with another programming language: Axel Rauschmayer, Speaking JavaScript. It's pretty good and it's also free. What I like about this book is that it's written for ES5. Most newer books, will also introduce ES6 concepts, which can be confusing if you don't know how to tell them apart from ES5 ones.