Helium Automated Browser Testing
Helium is a tool that makes it easy to test websites and automate browsers.
It's designed to be very simple to use and integrate.
Helium can be used as a Java or Python library and integrates with the Selenium Framework.
Setting up Helium
There's a very good tutorial on how to set up Helium on the Helium Repository page.
Once you've got everything set up, it's easy to run your first test with Helium on TestingBot:
Running your first test
Below is an example on how to run a simple test on Firefox. When the test has finished, the test name and success state is sent to TestingBot so you can see the test success/failures in our dashboard.
To send the test success state back to us, please install our Python plugin:
Python Example:
import unittest
from selenium import webdriver
from helium.api import *
from testingbotclient import TestingBotClient
class HeliumOnTestingBot(unittest.TestCase):
def setUp(self):
desired_capabilities = webdriver.DesiredCapabilities.FIREFOX
desired_capabilities['platform'] = 'WINDOWS'
desired_capabilities['version'] = 'latest'
desired_capabilities['name'] = 'My First Test'
self.driver = webdriver.Remote(
desired_capabilities=desired_capabilities,
command_executor='https://key:secret@hub.testingbot.com/wd/hub',
)
set_driver(self.driver)
def test_tb(self):
go_to('http://testingbot.com')
click('Log in')
write("my@email.com", into="Email")
write("myPassword", into="Password")
click(Button('Sign in'))
def tearDown(self):
self.driver.quit()
status = sys.exc_info() == (None, None, None)
tb_client = TestingBotClient('key', 'secret')
tb_client.tests.update_test(self.driver.session_id, self._testMethodName, status)
if __name__ == '__main__':
unittest.main()
Java Example:
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import java.net.URL;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertTrue;
import static junit.framework.Assert.assertFalse;
import static com.heliumhq.API.*;
public class WebDriverTest {
private WebDriver driver;
@Before
public void setUp() throws Exception {
DesiredCapabilities capabilities = DesiredCapabilities.firefox();
capabilities.setCapability("version", "latest");
capabilities.setCapability("platform", Platform.VISTA);
capabilities.setCapability("name", "My First Test");
this.driver = new RemoteWebDriver(
new URL("https://key:secret@hub.testingbot.com/wd/hub"),
capabilities);
setDriver(this.driver);
}
@Test
public void testWithTestingBot() throws Exception {
goTo("https://testingbot.com");
click("Log in");
assertEquals("Online Selenium Testing - Log in to manage your unit tests.", getDriver().getTitle());
write("user12345", into("Email:"));
write("user12345", into("Password:"));
click(Button("Sign in"));
}
@After
public void tearDown() throws Exception {
driver.quit();
}
}
Specifying the operating system, browser and version
To let TestingBot know on which browser/platform you want to run your test on, you need to specify the browsername, version, OS and other optional options in the capabilities field.
Before Afterdriver = webdriver.Remote(
command_executor='https://key:secret@hub.testingbot.com/wd/hub',
desired_capabilities=desired_caps)
More Information
More information regarding Helium is available on the Helium Repository.