We have covered a ton of stuff.
Alright, now this was fast for the material that we've covered because the aim is to give you an overview of what was possible. To show you the basics that you need to learn in order to be able to do this.
But also, to demonstrate that it is completely possible, and you don't need a lot of code in order to do this.
We started by just learning the app. Looking at an app to figure out how it works.
Then we learned just enough JavaScript to make us dangerous.
We learned for
loops.
We learned how to find elements on the page.
We learned how to trigger events, so that we could actually use it as though we were a user, to simulate the events that a user has.
Then we took it a little bit farther and learned how to look at the inside of an app and to use the objects functionality against itself. That is very useful.
We learned how to use setTimeout
and setInterval
to create functionality that will run in the future to avoid some of the JavaScript threading issues. The single threading that JavaScript has.
Now you have got work to do now in order to learn this, because some of you be at different points,
Some of you will know HTML so you will understand the DOM. Some of you won't.
So, you use this approach to look at the application that you've actually got in front of you and explore it in the DOM and learn just enough HTML to understand the application you're working with. Just enough CSS to understand the application you're working with and create the query selectors you need in order to access the application.
Then start experimenting with simple helper functions — to help you interact with the application and create data or automate tasks that you frequently do on the application. Automate within the browser rather than external tools.
When you get things that are useful to you, you can turn them into bookmarklets, so you have access to them all the time.
Then gradually build up to things like this where you have autonomous bots using the application if that helps you.
If you want to run a soak test to see how the application performs overnight, you can do that now without any extra tools.
The skills you learn here will help you with normal automating. Because you can execute JavaScript from most tools. You can inject JavaScript in.
And Web Driver’s JavaScript Executor is an underused piece of functionality because people don't have the JavaScript skills to use it effectively. But now you've seen what they can do.
The resources that I use are essentially:
Stack Overflow because I'll ask questions into the browser and Stack Overflow often comes back. How do I use a SetTimeout
? Stack overflow comes back.
If I want references, I'll look in W3 Schools.
Or I'll look in the Mozilla Developer Network.
Links are in the resources that you can use.
I've got a lot of videos on my site showing how to do this with different games and different applications. And I have practice applications that you can experiment with in order to do this in a nice easy way.
So, if you go off to Eviltester.com/jsauto… I should sell cars... “Js Auto Cars”
You will find a bunch of resources there that you can continue to practice on.
I have been enormously surprised at how much of a difference this had made to my technical testing and just automating in general. Because all these skills correlate and just make you a much better tester and automator.
So, welcome to the start of your journey of ever increasing the technical knowledge that you have and using JavaScript from the Console to automate whatever you want, however you want, and gain more control over your testing.