I followed this blog as an example and read the ParallerRunner info. When I call bin/behat command, one browser window opens and runs all the tests successfully with the setting below.
symfony/behat.yml
default:
context:
class: Site\CommonBundle\Features\Context\FeatureContext
extensions:
Behat\Symfony2Extension\Extension:
mink_driver: true
kernel:
env: test
debug: true
Behat\MinkExtension\Extension:
base_url: 'http://symfony.local/app_test.php/'
javascript_session: selenium2
browser_name: firefox
goutte: ~
selenium2: ~
paths:
features: %behat.paths.base%/src
bootstrap: %behat.paths.features%/Context
I modified the behay.yml (as shown below) to run some tests in one browser window and some in another window, however it doesn't do that. What it does is, it opens two browser windows but they both run same tests! How can I overcome this issue?
symfony/behat.yml
default:
context:
class: Site\CommonBundle\Features\Context\FeatureContext
parameters:
output_path: %behat.paths.base%/build/behat/output/
screen_shot_path: %behat.paths.base%/build/behat/screenshot/
extensions:
Behat\Symfony2Extension\Extension:
mink_driver: true
kernel:
env: test
debug: true
Behat\MinkExtension\Extension:
base_url: 'http://symfony.local/app_test.php/'
files_path: %behat.paths.base%/build/dummy/
javascript_session: selenium2
browser_name: firefox
goutte: ~
selenium2: ~
shvetsgroup\ParallelRunner\Extension:
process_count: 2
paths:
features: %behat.paths.base%/src
bootstrap: %behat.paths.features%/Context
F1:
filters:
tags: "#backend"
F2:
filters:
tags: "#frontend"
BEHAT TESTS:
This should run in one window:
#frontend
Feature: User Login
#javascript
Scenario: I can login to the system
Given I am on "/login"
And I login as "user"
This should run in another window:
#backend
Feature: Admin Login
#javascript
Scenario: I can login to the system
Given I am on "/login"
And I login as "admin"
I setup parallel test execution with GNU Parallel and xargs.
Also implement consolidated report for all executed features.
Details in my article here:
http://parallelandvisualtestingwithbehat.blogspot.com/p/blog-page.html
find ./features -name "*.feature" |
parallel --gnu --halt-on-error=0 -j 3 --keep-order vendor/bin/behat -c src/my_directory/behat.yml
--halt-on-error possibilities are :
0 Do not halt if a job fails. Exit status will be the number of jobs
failed. This is the default.
1 Do not start new jobs if a job fails, but complete the running
jobs including cleanup. The exit status will be the exit status from
the last failing job.
2 Kill off all jobs immediately and exit without cleanup. The exit
status will be the exit status from the failing job.
-j 3 : Run 3 jobs in parallel
It work perfectly with selenium.
Related
I have a playbook that works just great locally, when trying to run with AWX I run into an errors that seem to indicate the device type in the task is not supported.
Loading collection ansible.netcommon from /runner/requirements_collections/ansible_collections/ansible/netcommon
Loading callback plugin awx_display of type stdout, v2.0 from /usr/local/lib/python3.8/site-packages/ansible_runner/callbacks/awx_display.py
Skipping callback 'awx_display', as we already have a stdout callback.
Skipping callback 'default', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.
PLAYBOOK: soft_reset.yml *******************************************************
Positional arguments: soft_reset.yml
verbosity: 4
remote_user: root
connection: smart
timeout: 10
become: True
become_method: sudo
tags: ('all',)
inventory: ('/runner/inventory/hosts',)
extra_vars: ('#/runner/env/extravars',)
forks: 5
1 plays in soft_reset.yml
PLAY [aggs] ****************************************************************
META: ran handlers
TASK [soft reset bgp peers] ****************************************************
task path: /runner/project/soft_reset.yml:5
fatal: [lab-core-blue]: FAILED! => {
"msg": "network os cisco.iosxr.iosxr is not supported"
}
inventory/hosts.yml
aggs:
hosts:
lab-core-blue:
ansible_host: lab-core-blue.mylab.com
vars:
ansible_network_os: cisco.iosxr.iosxr
ansible_connection: ansible.netcommon.network_cli
soft_reset.yml
- hosts: aggs
gather_facts: no
tasks:
- name: soft reset bgp peers
ansible.netcommon.cli_command:
command: clear bgp vpnv4 unicast {{item}} soft
loop:
- 1.2.3.2
- 1.2.3.3
- 1.2.3.4
collections/requirements.yml
---
collections:
- ansible.netcommon
Thanks to #sivel in #ansible irc for the answer!
I think the AWX EEs only have ansible-core by default, you need cisco.iosxr in that list
Turns out I needed to add a line to collections/requirements.yml
---
collections:
- ansible.netcommon
- cisco.iosxr
I'm trying to follow along this blog about using Docker with R.
I followed basic Docker set up steps and am able to run the hello world image.
I'm on a old 2009 Mac and had to use Docker Toolbox.
I'm in a place with weak internet connection and am using a personal hotspot.
Each time I try to run docker run --rm -p 8787:8787 rocker/verse I wait for a few minutes and see a downloading message, then I get a message "docker: unauthorized: authentication required."
I found this separate documentation which advised me to add a password:
docker run --rm -p 8787:8787 -e PASSWORD=blah rocker/rstudio
But I got the same result "docker: unauthorized: authentication required."
I did some Google searching and found some posts both here on SO and on Github but was unable to identify what is causing this error in my specific case.
I suspect my weak internet connection might have something to do with it since I seem to be able to download for about 10 or 15 minutes before seeing this message.
Here is Docker info:
Macs-MacBook:~ macuser$ docker info
Containers: 1
Running: 0
Paused: 0
Stopped: 1
Images: 2
Server Version: 18.09.6
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: bb71b10fd8f58240ca47fbb579b9d1028eea7c84
runc version: 2b18fe1d885ee5083ef9f0838fee39b62d653e30
init version: fec3683
Security Options:
seccomp
Profile: default
Kernel Version: 4.14.116-boot2docker
Operating System: Boot2Docker 18.09.6 (TCL 8.2.1)
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 1.951GiB
Name: default
ID: XMCE:OBLV:CKEX:EGIB:PHQ7:MLHF:ZJSA:PGYN:OIMM:JI67:ETCI:JKBH
Docker Root Dir: /mnt/sda1/var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
provider=virtualbox
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Does anyone know where I can look to next in order to be able to pull and or run the rocker image?
I am trying to build an .sls file which will always restart a service:
systemd-resolved:
service.running:
- restart: True
When deployed, this gives
ID: systemd-resolved
Function: service.running
Result: True
Comment: The service systemd-resolved is already running
Started: 23:46:49.999789
Duration: 53.068 ms
Changes:
This is correct, the service is already running. What I was trying to convey with this command is to restart it. How to do that?
Note: I would like to avoid, if possible, an explicit command to be ran (as I feel it i snot very salt-like - this should rather be handled by the appropriate module):
'systemctl restart systemd-resolved':
cmd.run
If you want your service to reload you need to set reload: True instead.
Beside, If you only want to restart the service if there is any change in any other state, you need to use watch instead.
for instance,
systemd-resolved:
service.running:
- enable: True
- reload: True
- watch:
- pkg: <abc>
Trying to set behat tests for mobile devices in a Symfony2 Project.
I'm running selenium standalone server with chromedriver
This is my config file behat.yml
default:
suites:
default:
contexts:
- FeatureContext:
simpleArg: '%%kernel.environment%%'
session: '#session'
mink_session: default
mink_javascript_session: selenium_chrome_mobile_session
extensions:
Behat\Symfony2Extension: ~
Behat\MinkExtension:
base_url: http://frontend.local
show_cmd: open -a Google\ Chrome %s
sessions:
default:
symfony2: ~
selenium2:
selenium2:
wd_host: http://127.0.0.1:4444/wd/hub
selenium_chrome_mobile_session:
selenium2:
browser: chrome
capabilities:
extra_capabilities:
chromeOptions:
mobileEmulation:
deviceName: "Google Nexus 5"
selenium_chrome_session:
selenium2:
browser: chrome
capabilities:
extra_capabilities:
chromeOptions:
args:
- "--start-maximized"
- "--test-type"
emuse\BehatHTMLFormatter\BehatHTMLFormatterExtension:
name: html
renderer: Twig,Behat2
file_name: behat_report
print_args: true
print_outp: true
loop_break: true
formatters:
html:
output_path: %paths.base%/web
chrome_mobile:
extensions:
Behat\MinkExtension:
default_session: selenium_chrome_mobile_session
chrome:
extensions:
Behat\MinkExtension:
default_session: selenium_chrome_session
The website is adaptative (not responsive) and when I run the mobile features, the response is the one made for desktop browsers.
What I'm missing in my behat.yml?
For some reason running behat with profile doesn't work for chrome sessions
behat -p chrome_mobile -f pretty
Instead I added a tag with the session to execute. Like this:
Feature: This is my feature
#mink:selenium_chrome_session
Scenario: This is first scenario
When I am in homepage
It works now
I installed a Symfony2 extension for Behat Mink from here
When I run test, an error occurs
[ReflectionException] Class AppKernel does not exist.
What am I doing wrong?
behat.yml
default:
extensions:
Behat\MinkExtension\Extension:
base_url: http://localhost/behat
goutte: ~
selenium2: ~
Behat\Symfony2Extension\Extension: ~
First run these commands to install the dependencies:
composer require behat/behat
composer require behat/symfony2-extension
composer require behat/mink
composer require behat/mink-browserkit-driver
composer require behat/mink-extension
composer require behat/mink-goutte-driver
composer require behat/mink-selenium2-driver
composer require emuse/behat-html-formatter
composer require coduo/php-matcher
Now say your symfony applcation you want to host as localhost.behat, then add the vhost configuration to httpd_vhost.conf:
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/behat/web"
ServerName lochost.behat
DirectoryIndex app_dev.php
<Directory "C:/xampp/htdocs/behat/web">
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
Now your behat.yml file should be at app/config/behat.yml with belo content :
default:
formatters:
html:
output_path: web/behat
extensions:
Behat\Symfony2Extension: ~
# Irs\BehatPopupExtension\Extension: ~
Behat\MinkExtension:
base_url: http://lochost.behat/app_dev.php/
javascript_session: selenium2
sessions:
symfony2:
symfony2: ~
selenium2:
selenium2:
browser: chrome
emuse\BehatHTMLFormatter\BehatHTMLFormatterExtension:
name: html
renderer: Twig,Behat2
file_name: index
print_args: true
print_outp: true
loop_break: true
suites:
api:
type: symfony_bundle
bundle: NameSpaceYourBundle
#mink_session: symfony2
mink_session: selenium2
contexts:
- NameSpace\YourBundle\Features\Context\FeatureContext:
baseUrl: http://lochost.behat/app_dev.php/
screenCapturePath: web/behat
# Add "-p firefox" parameter to behat command to run tests with Firefox browser
firefox:
extensions:
Behat\MinkExtension\Extension:
browser_name: firefox
# Add "-p chrome" parameter to behat command to run tests with Chrome browser
chrome:
extensions:
#Behat\MinkExtension\Extension:
Behat\MinkExtension:
browser_name: chrome
# Add "-p safari" parameter to behat command to run tests with Safari browser
safari:
extensions:
Behat\MinkExtension\Extension:
browser_name: safari
All you go, now add your feature and context file at namespace : NameSpace\YourBundle\Features\Context\FeatureContext
and run the below commands from command prompt/git bash(preferrable):
bin/behat -v --suite=api #NameSpaceYourBundle/your.feature --config=app/config/behat.yml -f pretty
or if you want to save the output as html at web/behat directory then:
bin/behat -v --suite=api #NameSpaceYourBundle/your.feature --config=app/config/behat.yml
Let me know if it works
Note:
I am not sure if you are running selenium server or standalone server, hence adding the step to run selenium standalone server:
Download selenium and chromedriver and place the selenium server .exe and chromedriver.exe in same folder
check with "java -version" and it should not be < 1.6.x
you may need to download compatible selenium server and chrome driver
open command prompt and run the below commands:
cd C:\<folder contains selenium server .exe and chromedriver.exe>
java -Dwebdriver.chrome.driver="chromedriver.exe" -jar selenium-server-standalone-x.xx.0.jar