Have you ever thought that it would be cool to automate web apps like Twitter, but you are not a developer and don't have any use for things like APIs? What if I told you that it is possible to automate the sending of a tweet in just 20 lines?
This is an example of an Iridium test. Iridium is a tool used to test and automate web applications, and here, it has been used to log into Twitter and send a tweet:
Feature: Post a Twitter message Scenario: Configure aliases and input speed When I set the alias mappings | Username | .js-username-field | | Password | .js-password-field | | Log in | button.submit | | Tweet box | tweet-box-home-timeline | | Tweet | .js-tweet-btn | And I set the default keystroke delay to "0" milliseconds Scenario: Log In Given I open the page "https://twitter.com/login" And I populate the "Username" textbox with "your_username" And I populate the "Password" textbox with "your_password" And I click the "Log in" button Scenario: Send Tweet Then I populate the "Tweet box" textbox with "This is a tweet" And I click the "Tweet" button
Although this is a very simple example of what Iridium can do, it does highlight how easy it is to automate web apps like Twitter without writing any code. Iridium uses a plain English syntax to describe the interaction with a web app and abstracts away the code that is usually required to interact with a browser in an automated fashion.
And running tests is as easy as writing them. All you need to install Java 8, download this WebStart file (right-click the link and save the file), and run it. Iridium will be downloaded and the test script will be run.
Actually, the script will fail because the test script that is being launched does not have a valid Twitter username and password in it. This line of the WebStart file determines the test to be run:
<property name="javaws.testSource" value="https://raw.githubusercontent.com/mcasperson/IridiumTwitterTest/master/twitter.feature"/>
To see the test run against your own Twitter account, you will need to download the file from here, edit it to include your own Twitter credentials, and then update the location of the test in the WebStart file to point to your local copy. For example, you might save the feature file to your desktop and reference it like this:
<property name="javaws.testSource" value="/Users/matthewcasperson/Desktop/twitter.feature"/>
If you are interested in writing end-to-end tests like the one shown above, check out the Iridium documentation, and take a look at the course on Udemy. Iridium itself is a free and open source project on GitHub.