So you've to decided to embark on an end-to-end test automation journey for your web based apps. This is your Odyssey. Exciting but where do you start? Choosing a programming language.
There are quite a few considerations:
- what language is native to the application under test?
- are you focused on one component of a system, like web only, or are you going full stack and writing tests for web ui, mobile apps and backend api's?
- what language are you comfortable with now or are you starting fresh?
- what are fellow QA's in my organisation using and are there existing frameworks I can use?
- what support do I require?
There's a good case for choosing the language native to the application under test. This would allow developers to get involved in the writing of end-to-end tests. But there are drawbacks to this. Tests need to be maintained and constantly optimised. Typically a dev will only ever write a tests for newly delivered features. So who is going to maintain the project. You right? Well, if you go native on web with it likely being javascript then you go javascript. But seeing as you are in a cross functional team you're also going native for backends. These APIs are developed in let's say Java. So for them you go native in Java. And for iOS, Swift. And for Android, maybe Kotlin. Congratulations, you're now a jack of all trades and a master of none. And maintenance, developing tests for new features and optimisations becomes overwhelming. But we are going native so can't developers pitch in here? Yes, but at the cost of delivery time. This will greatly reduce the amount of work developers can get through in terms of user features and most importantly the technical tasks that are endless in this game to stay up to date with the latest technologies. And what about those areas that existed before our automation odyssey began? We all no they need coverage but who's going to cover them.
So the one language fits all approach is my preferred approach. The ultimate goal is to be developing end-to-end test as close to in parallel with developers as possible. This will enable you to be a master of full stack end-to-end automated testing. The gold standard.
Firstly, I'd say, if there is an existing team with end-to-end automation talk to them and see if the language they are using is appropriate. You will need support over the course of your journey so having peers to lean on is always good.
If you are comfortable with a language already that's also a good route to explore.
And lastly, straight up, go with Java or Javascript. Java is the most used in the industry for this and the frameworks available will cater for your every need. Online support for your testing needs is ahead of the rest for those sticky situations you get into along the way. And Javascript is the second most popular and continuously growing and improving.
Here on this blog we'll be focusing on Java predominantly because it's what I use day to day and we'll explore some interesting Javascript tools along the way but with less focus on them.
About Java
Java is a general purpose class based object oriented programming language. What does that mean?
- A class usually represent a real world thing. Think of it as a definition of something.
- A class has attributes and methods. Attributes are used to describe the class. Methods are actions the class can perform.
- An object is an instance of a class.
Let's briefly describe a using web application example. Let's say we have a backend API called the User-API that deals with users. Users can be created and retrieved. So we have a class called UserAPI. This class has attributes name, email address and age. And the class has methods to create a user and a method to retrieve a user. An object(instance of this class) is created when we want to use it.
This is a really simplified description and if you are new to programming and have no idea what you just read don't worry. I'll provide further posts in time with coded examples to help you along the way. We'll also jump into more complex topics in Java to help utilise the features of the language to suit those automated testing needs.
Installing Java
To compile and run java programs you develop you'll will need to install the Java JDK. Here's a few ways to do this.
Oracle: official java JDKs. Follow the instructions on the website to do so:
OpenJDK: open-source implementation of the Java Platform
- Select your required version here and download the build and follow the instructions.
SDKMAN: allows you to manage multiple JDK versions
- follow the instructions here.
Setting Java Home on MacOS
This may be needed for Maven and Appium later on.
- Open a terminal.
- run the following to check if it's zsh or bash echo $0
- Change to bash if it's zsh by running chsh -s /bin/bash
- close and reopen the terminal
- Open a text editor.
- Enter the following line export JAVA_HOME=/Library/Java/JavaVirtualMachines/VERSION-YOU-DOWNLOADED/Contents/Home substituting VERSION-YOU-DOWNLOADED with what you downloaded.
- Save to your user root directory
- And if you want to change back to zsh run chsh -s /bin/zsh
If you are brand new to Java you'll have to spend a bit of time getting up to speed with the basics. I like the tutorials Oracle provide. But there are many great ones available online. Whatever works best for you.
Comments
Post a Comment