Automatization

Build the right tools right

Thucydides With Selenium/Webdriver: How to Deny Camera Access?

| Comments

If you have web application that needs access to media devices, such as web camera, and try to use Selenium/Webdriver for test automation, you will find that browser shows you own promt. In this promt the user is asked to allow or deny access to camera.

To solve this issue you need to add extra parameter when start browser. Here is an example for Firefox and Chrome browsers for Thucydides framework, but you can use those options directly with Webdriver.

thucydides.properties
1
2
firefox.preferences=media.navigator.permission.disabled=true
chrome.switches=--use-fake-device-for-media-stream,--use-fake-ui-for-media-stream

I hope this will be usefull for someone.

Thucydides+JBehave+Maven Generate New Steps From Scenarios

| Comments

If you are using Jbehave framework, you know that it has very simple structure of .story file content. Which consists of steps – Given,When,Then. And only steps are required part of the story. But this framework provides us to add meta-information to our tests for better understanding. One of the way to do this is use Scenario: sections.

1
2
3
4
5
Scenario: log in as autorized user
 
Given user on authorization page
When he logs in as John with password 123
Then opens user's page

It is very useful feature, which divide story into sections and makes it more readable/understandable. But you can use Scenario to create your own steps library automatically.

Thucydides+JBehave+Maven Run Tests in Fixed Order

| Comments

In my previous post, I discribed how to run tests in parallel mode using Thucycdides,Jbehave and Maven Failsafe Plugin. But sometimes you need to run tests in fixed order, for example when you:

  • make some preconditions
  • clear data
  • import new configuration
  • test applications when some services are shutdown
  • etc.

Thucydides+JBehave+Maven Run Tests in Parallel

| Comments

Thucydides is very cool test automation framework, with good built-in support of Selenium/WebDriver, understandable java API, simple architecture. This project also has integration with common BDD frameworks as JBehave and EasyB. Integration with JBehave is done by thucydides-jbehave project src.

JBehave allows you to write, store and run your tests in plain text files with .story extension.

1
2
3
4
5
6
7
8
9
10
11
Scenario: trader is not alerted below threshold
 
Given a stock of symbol STK1 and a threshold of 10.0
When the stock is traded at 5.0
Then the alert status should be OFF
 
Scenario: trader is alerted above threshold
 
Given a stock of symbol STK1 and a threshold of 10.0
When the stock is traded at 11.0
Then the alert status should be ON

Each story file is same as one test suite. That’s why it should be atomic and without dependecies from other tests.

The main goal of testing is to provide feedback to developers team as fast as possible. The most powerfull solution to reduce time spent for tests is run them in parallel processes. Now if you use Thucydides and Jbehave frameworks together out of the box, you can’t run tests in parallel mode. But exists severall solutions for this issue.