GUIs have always killed automation. We’re giving automation a fighting chance.
Automating UI interactions in Jenkins jobs. Crazy? Yes. Cool? Oh yes. Useful? I hope not.
Many companies have that application. The old, unavoidable GUI-based beast of legacy code that is essential to their process. Ever dreamt up the perfect automated pipeline, only to be stopped by the beast?
In a perfect world, you would like to add command line support, or just rewrite the damn thing. But that takes too many resources, so you put the pipeline idea on hold and wait for better times. Fortunately, with the aid of some clever tools, it’s actually possible to automate the pain away.
Sikuli is a visual framework for automating user interface tasks. It’s a Jython-based scripting language based on image recognition, with some very handy and self-explanatory methods.
The built-in IDE makes it easy to take screenshots and use them directly in the code. Here’s an example of a simple script that opens paint, draws a line and closes the program. Take a look at the video below to see it in action. The accompanied image shows the script being run.
See the official documentation for details on the different methods.
Invoking a Sikuli script outside the IDE is easy.
Sikuli ships in a handy JAR, so simply run
java -jar sikulix.jar -r projects/my-script.sikuli and watch the magic happen.
Sikuli in itself is a useful tool for developers tired of clicking the same 20 buttons every time some project needs to run. It removes the risk of human error and is genuinely satisfying to watch.
You might be thinking: “Running Sikuli on Jenkins, are you completely mad?”. The answer is “Yes, but…”.
In certain unfortunate situations, it’s still useful:
If a potential Jenkins pipeline is dependant on a GUI application, Sikuli can run directly on a Jenkins slave. Sikuli runs on pretty much any platform:
For Linux based systems, there are Docker containers that make it possible to run several containerised instances of Sikuli on one machine.
On Windows slaves there are a couple of requirements:
After following these steps you will be able to invoke any Sikuli script from Jenkins and the world will be open to you.
There are some obvious dangers involved in this, especially when running Sikuli directly on a slave. You need proper exception handling to make sure your slave does not enter an error state, leaving applications open. Solid concurrency controls should also be in place, ensuring that multiple jobs don’t attempt to grab one desktop at the same time. For the latter, I recommend using the throttle concurrent builds plugin.
Image recognition can be fickle. Scripts can break due to interface scaling, window size changes etc. They also take a lot of maintenance when your UI changes often, or has many execution paths.
Avoid cramming GUI interactions in your pipeline. While it’s tempting to use Sikuli extensively, consider it only as a last resort. You have the power to automate GUI, to slay the beast, but use it wisely.
Had enough of sluggish polling? With instant Artifactory event triggers you can give responsiveness in Jenkins a real boost. Here’s an easy way to set it up.
A super easy configuration guide
With the arrival of microservices code is becoming disposable. Does this mean that we no longer need maintainable code? Is it the end of refactoring?
Still relevant or increasingly redundant?
In software development tight coupling is one of our biggest enemies. On the function level it makes our application hard to change and fragile. Unfortunately, tight coupling is like the entropy of software development, so we have always have to be working to reduce it.
How to safely introduce modular architecture to legacy software.
I am an Atlassian certified trainer and over the years I have been spending much time with clients and their Jiras. In this blogpost, I have collected some small tips and tricks that will make your Jira usage better.
Jira Software is a powerful tool deployed in so many organizations, yet in day to day usage people are missing out on improvements, big and small.
In this post, I’ll take a closer look at the version of Jenkins X using Tekton, to give you an idea of how the general development, build, test, deploy flow looks like with Jenkins X. How does it feel to ship your code to production using a product coming from the Jenkins community that has very little Jenkins in it?
A crash course in Jenkins X and how to test it out on a local Kubernetes cluster
In this blog I will show you how to create snapshots of Persistent volumes in Kubernetes clusters and restore them again by only talking to the api server. This can be useful for either backups or when scaling stateful applications that need “startup data”.
Sneak peak at CSI Volume snapshotting Alpha feature
When I read Fowler’s new ‘Refactoring’ book I felt sure the example from the first chapter would make a good Code Kata. However, he didn’t include the code for the test cases. I can fix that!
Writing tests for ‘Theatrical Players’
Nicole Forsgren and the Accelerate DORA team has just released the newest iteration of the State of DevOps report. The report investigates what practices make us better at delivering valuable software to our users as measured by business outcomes. Read on for our analysis of the report, and how it can be best put to use.
The latest drivers of software delivery performance
A major challenge of software development is that our work is by and large invisible. This makes our folklore essential in business matters. Some of our commonly used arguments and visualizations are digital urban legends rather than solid foundations for informed decisions. Here, we’ll go through a few examples and some measures to address our misconceptions.
How the stories we tell influence our decisions
When you embark on your cloud native journey there will be important choices to make about cloud providers, continuous deployment, environments’ setup and separation. This guide will help you make the right choices by sharing lessons learnt from running cloud native apps in production.
Kubernetes has become the de facto container orchestration platform. When we help clients of different sizes and domains start their cloud native journeys in Kubernetes, we assist them in making sound decisions and technology choices. There is no one-size-fits-all solution when it comes to choosing cloud providers, CI tools, continuous deployment pipelines etc., so it is important to make the right decisions at the start. Failing to do so can be very costly in terms of lost time and money.
How to make the right technical choices on your cloud native journey
Learn how Docker and Kubernetes work and the key benefits they bring. Using real demos, I show how Docker is a great packaging and distribution technology, and how Kubernetes provides a powerful runtime for containerized applications.
Watch this introduction to Docker and Kubernetes at the Trondheim Developer Conference (TDC)
In the world of Agile and DevOps we use many figures, charts and diagrams to argue and reason about our world and how we prioritize and make choices. However, at all levels of the organization, we misuse and misinterpret figures. It’s time to be explicit, measure the right things and act on them. Watch this talk from DevOpsDays Zurich in May 2019.
Watch this talk from DevOpsDays Zurich
Hear about upcoming events in Scandinavia, latest tech blogs, and training in the field of Continuous Delivery and DevOps