SlideShare a Scribd company logo
1 of 126
Download to read offline
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 1
Stanford WebCamp 2022
Automate Behavior-driven Development
Yas Naoi
Chief Architect, Cloud
DOCOMO Innovatins, Inc.
Yas
2
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved.
@yas
linkedin.com/in/yasnaoi
Yas
3
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved.
• Chief Architect, Cloud
Yas
4
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved.
• Chief Architect, Cloud
• DOCOMO Innovations, Inc. (Palo Alto, CA)
• NTT DOCOMO Inc.
Yas
• Chief Architect, Cloud
• DOCOMO Innovations, Inc. (Palo Alto, CA)
• NTT DOCOMO Inc.
• Cloud, DevOps, Agile Software Development
• d.o: 17 years
5
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved.
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 6
Our Team
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 7
/ Cloud Team Members /
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 8
/ Cloud Team Members /
CA
Yas
Baldwin
Kumiko
Tatsuya
Hiroki
Tamaki
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 9
/ Cloud Team Members /
India
Sachin
CA
Yas
Baldwin
Kumiko
Tatsuya
Hiroki
Tamaki
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 10
/ Cloud Team Members /
Japan
Xiaohua
Takumaru
Masami
Ryo
Tomohiro
India
Sachin
CA
Yas
Baldwin
Kumiko
Tatsuya
Hiroki
Tamaki Shota
Makoto
11
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved.
Cloud Orchestrator
Search: drupal cloud orchestrator
12
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved.
Cloud Orchestrator
Search: drupal cloud orchestrator
Multi-cloud Support
──────────────
13
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved.
Cloud Orchestrator
Multi-cloud Support
──────────────
§ AWS
14
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved.
Cloud Orchestrator
Multi-cloud Support
──────────────
§ AWS
§ Kubernetes
15
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved.
Cloud Orchestrator
Multi-cloud Support
──────────────
§ AWS
§ Kubernetes
§ OpenStack
16
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved.
Cloud Orchestrator
Multi-cloud Support
──────────────
§ AWS
§ Kubernetes
§ OpenStack
§ VMware
17
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved.
Cloud Orchestrator
Multi-cloud Support
──────────────
§ AWS
§ Kubernetes
§ OpenStack
§ VMware
§ Terraform Cloud
18
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved.
Cloud Orchestrator
Agenda
19
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved.
Agenda
• Development Model
• What’s Behat for Behavior-driven Development (BDD)
• Templating for Behat Test Scenarios
• Automated Testing for BDD
20
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved.
Development Model
21
Software Development Lifecycle
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 22
Software Development Lifecycle
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 23
Coding
Integration Testing
Component Design
Function Design Unit Testing
System Requirements System Testing
Business Requirements Acceptance Testing
V-model [Boehm 79]
Software Development Lifecycle
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 24
Business Requirements
V-model [Boehm 79]
Software Development Lifecycle
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 25
System Requirements
Business Requirements
V-model [Boehm 79]
Software Development Lifecycle
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 26
Component Design
System Requirements
Business Requirements
V-model [Boehm 79]
Software Development Lifecycle
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 27
Component Design
Function Design
System Requirements
Business Requirements
V-model [Boehm 79]
Software Development Lifecycle
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 28
Coding
Component Design
Function Design
System Requirements
Business Requirements
V-model [Boehm 79]
Software Development Lifecycle
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 29
Coding
Component Design
Function Design Unit Testing
System Requirements
Business Requirements
V-model [Boehm 79]
Software Development Lifecycle
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 30
Coding
Integration Testing
Component Design
Function Design Unit Testing
System Requirements
Business Requirements
V-model [Boehm 79]
Software Development Lifecycle
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 31
Coding
Integration Testing
Component Design
Function Design Unit Testing
System Requirements System Testing
Business Requirements
V-model [Boehm 79]
Software Development Lifecycle
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 32
Coding
Integration Testing
Component Design
Function Design Unit Testing
System Requirements System Testing
Business Requirements Acceptance Testing
V-model [Boehm 79]
Software Development Lifecycle
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 33
Coding
Integration Testing
Component Design
Function Design Unit Testing
System Requirements System Testing
Business Requirements Acceptance Testing
V-model [Boehm 79]
Software Development Lifecycle
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 34
Coding
Integration Testing
Component Design
Function Design Unit Testing
System Requirements System Testing
Business Requirements Acceptance Testing
TDD
V-model [Boehm 79]
Software Development Lifecycle
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 35
Coding
Integration Testing
Component Design
Function Design Unit Testing
System Requirements System Testing
Business Requirements Acceptance Testing
TDD
BDD
V-model [Boehm 79]
Software Development Lifecycle
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 36
Coding
Integration Testing
Component Design
Function Design Unit Testing
System Requirements System Testing
Business Requirements Acceptance Testing
TDD
BDD
ATDD
V-model [Boehm 79]
Software Development Lifecycle
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 37
Coding
Integration Testing
Component Design
Function Design Unit Testing
System Requirements System Testing
Business Requirements Acceptance Testing
V-model [Boehm 79]
✔TDD
BDD
ATDD
PHPUnit (Drupal)
Software Development Lifecycle
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 38
Coding
Integration Testing
Component Design
Function Design Unit Testing
System Requirements System Testing
Business Requirements Acceptance Testing
V-model [Boehm 79]
✔TDD
✔BDD (ATDD)
PHPUnit (Drupal)
Behat+
Drupal
Extension
Behavior-driven Development
39
PHPUnit
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 40
/**
* Tests CRUD for K8s node.
*
* @throws Exception
*/
public function testNode(): void {
$cloud_context = $this->cloudContext;
$data = $this->createNodeTestFormData(self::K8S_NODE_REPEAT_COUNT);
$this->updateNodesMockData($data);
// Update k8s nodes.
$this->drupalGet("/clouds/k8s/$cloud_context/node/update");
$this->assertNoErrorMessage();
for ($i = 0; $i < self::K8S_NODE_REPEAT_COUNT; $i++) {
$this->assertSession()->pageTextContains($data[$i]['name']);
}
for ($i = 0, $num = 1; $i < self::K8S_NODE_REPEAT_COUNT; $i++, $num++) {
// Make sure the all node listing exists.
$this->drupalGet('/clouds/k8s/node');
$this->assertNoErrorMessage();
for ($j = 0; $j < $num; $j++) {
$this->assertSession()->pageTextContains($data[$j]['name']);
}
}
}
BDD Test Scenario Example by Behat
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 41
Feature: Login, Check the Clean State, and Logout
In order to list resources on the clean state
As a user
I need to have both Drupal and AWS IAM permissions
Scenario: Log in as "Anonymous user"
Given I am not logged in
When I visit "/clouds"
Then I should be on "/user/login"
And I should see the heading "Log in"
Scenario Outline: Access cloud service providers
Given I am logged in as a user with the <role> role
And I should not see the link "All" in the "nav_bar"
And I should <verb> "Add cloud service provider" in the "nav_bar"
When I go to "/clouds"
Then I should be on "/admin/structure/cloud_config/add"
And I should get a <code> HTTP response
And I should see the heading <heading>
Examples:
| role | verb | code | heading |
| "Authenticated user" | not see | 403 | "Access denied" |
| "Cloud administrator" | see | 200 | "Add cloud service provider" |
| "Administrator" | see | 200 | "Add cloud service provider" |
Behat Components
42
Behat + drupal-extension + Chrome Driver
2022 DOCOMO Innovations, Inc. All Rights Reserved. Confidential.
43
Application under Test
(AUT)
Test Framework
Behat + drupal-extension + Chrome Driver
2022 DOCOMO Innovations, Inc. All Rights Reserved. Confidential.
44
Test Framework
Behat + drupal-extension + Chrome Driver
2022 DOCOMO Innovations, Inc. All Rights Reserved. Confidential.
Test Framework
Features
in Gherkin
45
Behat + drupal-extension + Chrome Driver
2022 DOCOMO Innovations, Inc. All Rights Reserved. Confidential.
Test Framework
Features
in Gherkin
Drupal Ext.
Drush Ext.
API Driver
46
Behat + drupal-extension + Chrome Driver
2022 DOCOMO Innovations, Inc. All Rights Reserved. Confidential.
Test Framework
Features
in Gherkin
Drupal Ext.
Drush Ext.
API Driver
Mink Ext.
Chrome Ext.
WebDriver
47
Behat + drupal-extension + Chrome Driver
2022 DOCOMO Innovations, Inc. All Rights Reserved. Confidential.
Chrome
Driver
Test Framework
Features
in Gherkin
Drupal Ext.
Drush Ext.
API Driver
Mink Ext.
Chrome Ext.
WebDriver
WebDriver
Implementation
48
Behat + drupal-extension + Chrome Driver
2022 DOCOMO Innovations, Inc. All Rights Reserved. Confidential.
Chrome
Driver
Headless
Browser
Test Framework
Features
in Gherkin
Drupal Ext.
Drush Ext.
API Driver
Mink Ext.
Chrome Ext.
WebDriver
WebDriver
Implementation
<< Native API >>
49
Behat + drupal-extension + Chrome Driver
2022 DOCOMO Innovations, Inc. All Rights Reserved. Confidential.
Application under Test
(AUT)
Chrome
Driver
Headless
Browser
<< Native API >> << HTTP >>
Test Framework
Features
in Gherkin
Drupal Ext.
Drush Ext.
API Driver
Mink Ext.
Chrome Ext.
WebDriver
WebDriver
Implementation
50
Behat’s Friend: Gherkin
51
Behat (Gherkin)
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 52
Feature: Login, Check the Clean State, and Logout
In order to list resources on the clean state
As a user
I need to have both Drupal and AWS IAM permissions
Scenario: Log in as "Anonymous user"
Given I am not logged in
When I visit "/clouds"
Then I should be on "/user/login"
And I should see the heading "Log in"
Scenario Outline: Access cloud service providers
Given I am logged in as a user with the <role> role
And I should not see the link "All" in the "nav_bar"
And I should <verb> "Add cloud service provider" in the "nav_bar"
When I go to "/clouds"
Then I should be on "/admin/structure/cloud_config/add"
And I should get a <code> HTTP response
And I should see the heading <heading>
Examples:
| role | verb | code | heading |
| "Authenticated user" | not see | 403 | "Access denied" |
| "Cloud administrator" | see | 200 | "Add cloud service provider" |
| "Administrator" | see | 200 | "Add cloud service provider" |
Behat (Gherkin)
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 53
Feature: Login, Check the Clean State, and Logout
In order to list resources on the clean state
As a user
I need to have both Drupal and AWS IAM permissions
Scenario: Log in as "Anonymous user"
Given I am not logged in
When I visit "/clouds"
Then I should be on "/user/login"
And I should see the heading "Log in"
Scenario Outline: Access cloud service providers
Given I am logged in as a user with the <role> role
And I should not see the link "All" in the "nav_bar"
And I should <verb> "Add cloud service provider" in the "nav_bar"
When I go to "/clouds"
Then I should be on "/admin/structure/cloud_config/add"
And I should get a <code> HTTP response
And I should see the heading <heading>
Examples:
| role | verb | code | heading |
| "Authenticated user" | not see | 403 | "Access denied" |
| "Cloud administrator" | see | 200 | "Add cloud service provider" |
| "Administrator" | see | 200 | "Add cloud service provider" |
Behat (Gherkin)
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 54
Feature: Login, Check the Clean State, and Logout
In order to list resources on the clean state
As a user
I need to have both Drupal and AWS IAM permissions
Scenario: Log in as "Anonymous user"
Given I am not logged in
When I visit "/clouds"
Then I should be on "/user/login"
And I should see the heading "Log in"
Scenario Outline: Access cloud service providers
Given I am logged in as a user with the <role> role
And I should not see the link "All" in the "nav_bar"
And I should <verb> "Add cloud service provider" in the "nav_bar"
When I go to "/clouds"
Then I should be on "/admin/structure/cloud_config/add"
And I should get a <code> HTTP response
And I should see the heading <heading>
Examples:
| role | verb | code | heading |
| "Authenticated user" | not see | 403 | "Access denied" |
| "Cloud administrator" | see | 200 | "Add cloud service provider" |
| "Administrator" | see | 200 | "Add cloud service provider" |
Behat (Gherkin)
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 55
Feature: Login, Check the Clean State, and Logout
In order to list resources on the clean state
As a user
I need to have both Drupal and AWS IAM permissions
Scenario: Log in as "Anonymous user"
Given I am not logged in
When I visit "/clouds"
Then I should be on "/user/login"
And I should see the heading "Log in"
Scenario Outline: Access cloud service providers
Given I am logged in as a user with the <role> role
And I should not see the link "All" in the "nav_bar"
And I should <verb> "Add cloud service provider" in the "nav_bar"
When I go to "/clouds"
Then I should be on "/admin/structure/cloud_config/add"
And I should get a <code> HTTP response
And I should see the heading <heading>
Examples:
| role | verb | code | heading |
| "Authenticated user" | not see | 403 | "Access denied" |
| "Cloud administrator" | see | 200 | "Add cloud service provider" |
| "Administrator" | see | 200 | "Add cloud service provider" |
Behat (Gherkin)
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 56
Feature: Login, Check the Clean State, and Logout
In order to list resources on the clean state
As a user
I need to have both Drupal and AWS IAM permissions
Scenario: Log in as "Anonymous user"
Given I am not logged in
When I visit "/clouds"
Then I should be on "/user/login"
And I should see the heading "Log in"
Scenario Outline: Access cloud service providers
Given I am logged in as a user with the <role> role
And I should not see the link "All" in the "nav_bar"
And I should <verb> "Add cloud service provider" in the "nav_bar"
When I go to "/clouds"
Then I should be on "/admin/structure/cloud_config/add"
And I should get a <code> HTTP response
And I should see the heading <heading>
Examples:
| role | verb | code | heading |
| "Authenticated user" | not see | 403 | "Access denied" |
| "Cloud administrator" | see | 200 | "Add cloud service provider" |
| "Administrator" | see | 200 | "Add cloud service provider" |
Behat (Gherkin)
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 57
Feature: Login, Check the Clean State, and Logout
In order to list resources on the clean state
As a user
I need to have both Drupal and AWS IAM permissions
Scenario: Log in as "Anonymous user"
Given I am not logged in
When I visit "/clouds"
Then I should be on "/user/login"
And I should see the heading "Log in"
Scenario Outline: Access cloud service providers
Given I am logged in as a user with the <role> role
And I should not see the link "All" in the "nav_bar"
And I should <verb> "Add cloud service provider" in the "nav_bar"
When I go to "/clouds"
Then I should be on "/admin/structure/cloud_config/add"
And I should get a <code> HTTP response
And I should see the heading <heading>
Examples:
| role | verb | code | heading |
| "Authenticated user" | not see | 403 | "Access denied" |
| "Cloud administrator" | see | 200 | "Add cloud service provider" |
| "Administrator" | see | 200 | "Add cloud service provider" |
Behat (Gherkin)
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 58
Feature: Login, Check the Clean State, and Logout
In order to list resources on the clean state
As a user
I need to have both Drupal and AWS IAM permissions
Scenario: Log in as "Anonymous user"
Given I am not logged in
When I visit "/clouds"
Then I should be on "/user/login"
And I should see the heading "Log in"
Scenario Outline: Access cloud service providers
Given I am logged in as a user with the <role> role
And I should not see the link "All" in the "nav_bar"
And I should <verb> "Add cloud service provider" in the "nav_bar"
When I go to "/clouds"
Then I should be on "/admin/structure/cloud_config/add"
And I should get a <code> HTTP response
And I should see the heading <heading>
Examples:
| role | verb | code | heading |
| "Authenticated user" | not see | 403 | "Access denied" |
| "Cloud administrator" | see | 200 | "Add cloud service provider" |
| "Administrator" | see | 200 | "Add cloud service provider" |
Behat (Gherkin)
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 59
Feature: Login, Check the Clean State, and Logout
In order to list resources on the clean state
As a user
I need to have both Drupal and AWS IAM permissions
Scenario: Log in as "Anonymous user"
Given I am not logged in
When I visit "/clouds"
Then I should be on "/user/login"
And I should see the heading "Log in"
Scenario Outline: Access cloud service providers
Given I am logged in as a user with the <role> role
And I should not see the link "All" in the "nav_bar"
And I should <verb> "Add cloud service provider" in the "nav_bar"
When I go to "/clouds"
Then I should be on "/admin/structure/cloud_config/add"
And I should get a <code> HTTP response
And I should see the heading <heading>
Examples:
| role | verb | code | heading |
| "Authenticated user" | not see | 403 | "Access denied" |
| "Cloud administrator" | see | 200 | "Add cloud service provider" |
| "Administrator" | see | 200 | "Add cloud service provider" |
Behat (Gherkin)
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 60
Feature: Login, Check the Clean State, and Logout
In order to list resources on the clean state
As a user
I need to have both Drupal and AWS IAM permissions
Scenario: Log in as "Anonymous user"
Given I am not logged in
When I visit "/clouds"
Then I should be on "/user/login"
And I should see the heading "Log in"
Scenario Outline: Access cloud service providers
Given I am logged in as a user with the <role> role
And I should not see the link "All" in the "nav_bar"
And I should <verb> "Add cloud service provider" in the "nav_bar"
When I go to "/clouds"
Then I should be on "/admin/structure/cloud_config/add"
And I should get a <code> HTTP response
And I should see the heading <heading>
Examples:
| role | verb | code | heading |
| "Authenticated user" | not see | 403 | "Access denied" |
| "Cloud administrator" | see | 200 | "Add cloud service provider" |
| "Administrator" | see | 200 | "Add cloud service provider" |
Behat (Gherkin)
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 61
Feature: Login, Check the Clean State, and Logout
In order to list resources on the clean state
As a user
I need to have both Drupal and AWS IAM permissions
Scenario: Log in as "Anonymous user"
Given I am not logged in
When I visit "/clouds"
Then I should be on "/user/login"
And I should see the heading "Log in"
Scenario Outline: Access cloud service providers
Given I am logged in as a user with the <role> role
And I should not see the link "All" in the "nav_bar"
And I should <verb> "Add cloud service provider" in the "nav_bar"
When I go to "/clouds"
Then I should be on "/admin/structure/cloud_config/add"
And I should get a <code> HTTP response
And I should see the heading <heading>
Examples:
| role | verb | code | heading |
| "Authenticated user" | not see | 403 | "Access denied" |
| "Cloud administrator" | see | 200 | "Add cloud service provider" |
| "Administrator" | see | 200 | "Add cloud service provider" |
Behat (Gherkin)
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 62
Feature: Login, Check the Clean State, and Logout
In order to list resources on the clean state
As a user
I need to have both Drupal and AWS IAM permissions
Scenario: Log in as "Anonymous user"
Given I am not logged in
When I visit "/clouds"
Then I should be on "/user/login"
And I should see the heading "Log in"
Scenario Outline: Access cloud service providers
Given I am logged in as a user with the <role> role
And I should not see the link "All" in the "nav_bar"
And I should <verb> "Add cloud service provider" in the "nav_bar"
When I go to "/clouds"
Then I should be on "/admin/structure/cloud_config/add"
And I should get a <code> HTTP response
And I should see the heading <heading>
Examples:
| role | verb | code | heading |
| "Authenticated user" | not see | 403 | "Access denied" |
| "Cloud administrator" | see | 200 | "Add cloud service provider" |
| "Administrator" | see | 200 | "Add cloud service provider" |
Behat (Gherkin)
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 63
Feature: Login, Check the Clean State, and Logout
In order to list resources on the clean state
As a user
I need to have both Drupal and AWS IAM permissions
Scenario: Log in as "Anonymous user"
Given I am not logged in
When I visit "/clouds"
Then I should be on "/user/login"
And I should see the heading "Log in"
Scenario Outline: Access cloud service providers
Given I am logged in as a user with the <role> role
And I should not see the link "All" in the "nav_bar"
And I should <verb> "Add cloud service provider" in the "nav_bar"
When I go to "/clouds"
Then I should be on "/admin/structure/cloud_config/add"
And I should get a <code> HTTP response
And I should see the heading <heading>
Examples:
| role | verb | code | heading |
| "Authenticated user" | not see | 403 | "Access denied" |
| "Cloud administrator" | see | 200 | "Add cloud service provider" |
| "Administrator" | see | 200 | "Add cloud service provider" |
Behat (Gherkin)
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 64
Feature: Login, Check the Clean State, and Logout
In order to list resources on the clean state
As a user
I need to have both Drupal and AWS IAM permissions
Scenario: Log in as "Anonymous user"
Given I am not logged in
When I visit "/clouds"
Then I should be on "/user/login"
And I should see the heading "Log in"
Scenario Outline: Access cloud service providers
Given I am logged in as a user with the <role> role
And I should not see the link "All" in the "nav_bar"
And I should <verb> "Add cloud service provider" in the "nav_bar"
When I go to "/clouds"
Then I should be on "/admin/structure/cloud_config/add"
And I should get a <code> HTTP response
And I should see the heading <heading>
Examples:
| role | verb | code | heading |
| "Authenticated user" | not see | 403 | "Access denied" |
| "Cloud administrator" | see | 200 | "Add cloud service provider" |
| "Administrator" | see | 200 | "Add cloud service provider" |
Initial State / Condition
Behat (Gherkin)
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 65
Feature: Login, Check the Clean State, and Logout
In order to list resources on the clean state
As a user
I need to have both Drupal and AWS IAM permissions
Scenario: Log in as "Anonymous user"
Given I am not logged in
When I visit "/clouds"
Then I should be on "/user/login"
And I should see the heading "Log in"
Scenario Outline: Access cloud service providers
Given I am logged in as a user with the <role> role
And I should not see the link "All" in the "nav_bar"
And I should <verb> "Add cloud service provider" in the "nav_bar"
When I go to "/clouds"
Then I should be on "/admin/structure/cloud_config/add"
And I should get a <code> HTTP response
And I should see the heading <heading>
Examples:
| role | verb | code | heading |
| "Authenticated user" | not see | 403 | "Access denied" |
| "Cloud administrator" | see | 200 | "Add cloud service provider" |
| "Administrator" | see | 200 | "Add cloud service provider" |
Action Take Place
Behat (Gherkin)
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 66
Feature: Login, Check the Clean State, and Logout
In order to list resources on the clean state
As a user
I need to have both Drupal and AWS IAM permissions
Scenario: Log in as "Anonymous user"
Given I am not logged in
When I visit "/clouds"
Then I should be on "/user/login"
And I should see the heading "Log in"
Scenario Outline: Access cloud service providers
Given I am logged in as a user with the <role> role
And I should not see the link "All" in the "nav_bar"
And I should <verb> "Add cloud service provider" in the "nav_bar"
When I go to "/clouds"
Then I should be on "/admin/structure/cloud_config/add"
And I should get a <code> HTTP response
And I should see the heading <heading>
Examples:
| role | verb | code | heading |
| "Authenticated user" | not see | 403 | "Access denied" |
| "Cloud administrator" | see | 200 | "Add cloud service provider" |
| "Administrator" | see | 200 | "Add cloud service provider" |
Expected Result
Can I use parameters?
67
I want to use parameters in scenarios!
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 68
Feature: Login, Check the Clean State, and Logout
In order to list resources on the clean state
As a user
I need to have both Drupal and AWS IAM permissions
Scenario: Log in as "Anonymous user"
Given I am not logged in
When I visit "/clouds"
Then I should be on "/user/login"
And I should see the heading "Log in"
Scenario Outline: Access cloud service providers
Given I am logged in as a user with the <role> role
And I should not see the link "All" in the "nav_bar"
And I should <verb> "Add cloud service provider" in the "nav_bar"
When I go to "/clouds"
Then I should be on "/admin/structure/cloud_config/add"
And I should get a <code> HTTP response
And I should see the heading <heading>
Examples:
| role | verb | code | heading |
| "Authenticated user" | not see | 403 | "Access denied" |
| "Cloud administrator" | see | 200 | "Add cloud service provider" |
| "Administrator" | see | 200 | "Add cloud service provider" |
I want to use parameters in scenarios!
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 69
Feature: Login, Check the Clean State, and Logout
In order to list resources on the clean state
As a user
I need to have both Drupal and AWS IAM permissions
Scenario: Log in as "Anonymous user"
Given I am not logged in
When I visit "/clouds"
Then I should be on "/user/login"
And I should see the heading "Log in"
Scenario Outline: Access cloud service providers
Given I am logged in as a user with the <role> role
And I should not see the link "All" in the "nav_bar"
And I should <verb> "Add cloud service provider" in the "nav_bar"
When I go to "/clouds"
Then I should be on "/admin/structure/cloud_config/add"
And I should get a <code> HTTP response
And I should see the heading <heading>
Examples:
| role | verb | code | heading |
| "Authenticated user" | not see | 403 | "Access denied" |
| "Cloud administrator" | see | 200 | "Add cloud service provider" |
| "Administrator" | see | 200 | "Add cloud service provider" |
I want to use parameters in scenarios!
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 70
Feature: Login, Check the Clean State, and Logout
In order to list resources on the clean state
As a user
I need to have both Drupal and AWS IAM permissions
Scenario: Log in as "Anonymous user"
Given I am not logged in
When I visit "/clouds"
Then I should be on "/user/login"
And I should see the heading "Log in"
Scenario Outline: Access cloud service providers
Given I am logged in as a user with the <role> role
And I should not see the link "All" in the "nav_bar"
And I should <verb> "Add cloud service provider" in the "nav_bar"
When I go to "/clouds"
Then I should be on "/admin/structure/cloud_config/add"
And I should get a <code> HTTP response
And I should see the heading <heading>
Examples:
| role | verb | code | heading |
| "Authenticated user" | not see | 403 | "Access denied" |
| "Cloud administrator" | see | 200 | "Add cloud service provider" |
| "Administrator" | see | 200 | "Add cloud service provider" |
I want to use parameters in scenarios!
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 71
Feature: Login, Check the Clean State, and Logout
In order to list resources on the clean state
As a user
I need to have both Drupal and AWS IAM permissions
Scenario: Log in as "Anonymous user"
Given I am not logged in
When I visit "/clouds"
Then I should be on "/user/login"
And I should see the heading "Log in"
Scenario Outline: Access cloud service providers
Given I am logged in as a user with the <role> role
And I should not see the link "All" in the "nav_bar"
And I should <verb> "Add cloud service provider" in the "nav_bar"
When I go to "/clouds"
Then I should be on "/admin/structure/cloud_config/add"
And I should get a <code> HTTP response
And I should see the heading <heading>
Examples:
| role | verb | code | heading |
| "Authenticated user" | not see | 403 | "Access denied" |
| "Cloud administrator" | see | 200 | "Add cloud service provider" |
| "Administrator" | see | 200 | "Add cloud service provider" |
How it works by natural language?
72
The Tricks
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 73
/**
* Log in as the existing user
*
* @Given I am logged in as user :name
*/
public function iAmLoggedInAsUser($name): void {
$user = user_load_by_name($name);
$this->getSession()->visit(user_pass_reset_url($user) . '/login');
}
The Tricks
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 74
/**
* Log in as the existing user
*
* @Given I am logged in as user :name
*/
public function iAmLoggedInAsUser($name): void {
$user = user_load_by_name($name);
$this->getSession()->visit(user_pass_reset_url($user) . '/login');
}
Sentence
The Tricks
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 75
/**
* Log in as the existing user
*
* @Given I am logged in as user :name
*/
public function iAmLoggedInAsUser($name): void {
$user = user_load_by_name($name);
$this->getSession()->visit(user_pass_reset_url($user) . '/login');
}
Parameter
Variable
The Tricks
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 76
/**
* Check if the current page contains no messages of the specified selector.
*
* @Then /^I should see no (?P<selector>(?:success|error|warning)) message$/
*/
public function assertSelectorNotVisible($selector): void {
switch ($selector) {
case 'success':
$selector_id = 'success_message_selector';
break;
case 'error':
$selector_id = 'error_message_selector';
break;
case 'warning':
$selector_id = 'warning_message_selector';
break;
default:
throw new ExpectationException(sprintf("Message type is invalid: %s",
$selector), $this->getSession()->getDriver());
}
$this->assertNotVisible($selector_id);
}
Regular
Expression
Predefined Scenario List: behat -dl
• Given I am an anonymous user
• Given I am not logged in
• Given I am logged in as a user with the :role role(s)
• Given I am logged in as a/an :role
• Given I am logged in as a user with the :role role(s) and I have the following fields:
• Given I am logged in as :name
• Given I am logged in as a user with the :permissions permission(s)
• Given I click :link in the :rowText row
• Given the cache has been cleared
• Given I run cron
• Given I am viewing a/an :type (content )with the title :title
• Given a/an :type (content )with the title :title
• Given I am viewing my :type (content )with the title :title
• Given :type content:
• Given I am viewing a/an :type( content):
• Given I am viewing a/an :vocabulary term with the name :name
• Given a/an :vocabulary term with the name :name
• Given users:
• Given :vocabulary terms:
• Given the/these (following )languages are available:
• Given I am logged in as user :name
• Given I am at :path
• Given for :field I enter :value
• Given I enter :value for :field
• Given I wait for AJAX to finish
• Given I press the :char key in the :field field
• Given I press :button in the :region( region)
• Given I fill in :value for :field in the :region( region)
• Given I fill in :field with :value in the :region( region)
• Given I check the box :checkbox
• Given I uncheck the box :checkbox
• Given /^(?:|I )am on (?:|the )homepage$/
• Given /^(?:|I )am on "(?P<page>[^"]+)"$/
• Given I should not see the error message( containing) :message
• Given I should not see the success message( containing) :message
• Given I should not see the warning message( containing) :message
• Given I run drush :command
• Given I run drush :command :arguments
• Given /^I wait for the batch job to finish$/
• Given there is an item in the system queue:
• When I wait :msec milliseconds
• When I check the box in the :rowText row
• When I fill in :value for :field in the row :row in the :region( region)
• When I follow/click :link in a row with :value set in :field in the :region( region)
• When I visit :path
• When I click :link
• When /^(?:|I )press "(?P<button>(?:[^"]|")*)"$/
• When I press the :button button
• When I follow/click :link in the :region( region)
• When I select the radio button :label with the id :id
• When I select the radio button :label
• When /^(?:|I )go to (?:|the )homepage$/
• When /^(?:|I )go to "(?P<page>[^"]+)"$/
• When /^(?:|I )reload the page$/
• When /^(?:|I )move backward one page$/
• When /^(?:|I )move forward one page$/
• When /^(?:|I )follow "(?P<link>(?:[^"]|")*)"$/
• When /^(?:|I )fill in "(?P<field>(?:[^"]|")*)" with "(?P<value>(?:[^"]|")*)"$/
• When /^(?:|I )fill in "(?P<field>(?:[^"]|")*)" with:$/
• When /^(?:|I )fill in "(?P<value>(?:[^"]|")*)" for "(?P<field>(?:[^"]|")*)"$/
• When /^(?:|I )fill in the following:$/
• When /^(?:|I )select "(?P<option>(?:[^"]|")*)" from "(?P<select>(?:[^"]|")*)"$/
• When /^(?:|I )additionally select "(?P<option>(?:[^"]|")*)" from "(?P<select>(?:[^"]|")*)"$/
• When /^(?:|I )check "(?P<option>(?:[^"]|")*)"$/
• When /^(?:|I )uncheck "(?P<option>(?:[^"]|")*)"$/
• When /^(?:|I )attach the file "(?P<path>[^"]*)" to "(?P<field>(?:[^"]|")*)"$/
• Then I log out
• Then I should see (the text ):text in the :rowText row
• Then I should not see (the text ):text in the :rowText row
• Then I (should )see the :link in the :rowText row
• Then I should be able to edit a/an :type( content)
• Then (I )break
• Then I should see (the text ):text1 or :text2 in the :rowText row
• Then I should see (the text ):text in the :rowText row in the :region( region)
• Then I take screenshot
• Then I should see the link :link
• Then I should not see the link :link
• Then I should not visibly see the link :link
• Then I (should )see the heading :heading
• Then I (should )not see the heading :heading
• Then I (should ) see the button :button
• Then I (should ) see the :button button
• Then I should not see the button :button
• Then I should not see the :button button
• Then I should see the heading :heading in the :region( region)
• Then I should see the :heading heading in the :region( region)
• Then I should see the link :link in the :region( region)
• Then I should not see the link :link in the :region( region)
• Then I should see( the text) :text in the :region( region)
• Then I should not see( the text) :text in the :region( region)
• Then I (should )see the text :text
• Then I should not see the text :text
• Then I should get a :code HTTP response
• Then I should not get a :code HTTP response
• Then /^(?:|I )should be on "(?P<page>[^"]+)"$/
• Then /^(?:|I )should be on (?:|the )homepage$/
• Then /^the (?i)url(?-i) should match (?P<pattern>"(?:[^"]|")*")$/
• Then /^the response status code should be (?P<code>d+)$/
• Then /^the response status code should not be (?P<code>d+)$/
• Then /^(?:|I )should see "(?P<text>(?:[^"]|")*)"$/
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 77
• Then /^(?:|I )should not see "(?P<text>(?:[^"]|")*)"$/
• Then /^(?:|I )should see text matching (?P<pattern>"(?:[^"]|")*")$/
• Then /^(?:|I )should not see text matching (?P<pattern>"(?:[^"]|")*")$/
• Then /^the response should contain "(?P<text>(?:[^"]|")*)"$/
• Then /^the response should not contain "(?P<text>(?:[^"]|")*)"$/
• Then /^(?:|I )should see "(?P<text>(?:[^"]|")*)" in the "(?P<element>[^"]*)" element$/
• Then /^(?:|I )should not see "(?P<text>(?:[^"]|")*)" in the "(?P<element>[^"]*)" element$/
• Then /^the "(?P<element>[^"]*)" element should contain "(?P<value>(?:[^"]|")*)"$/
• Then /^the "(?P<element>[^"]*)" element should not contain "(?P<value>(?:[^"]|")*)"$/
• Then /^(?:|I )should see an? "(?P<element>[^"]*)" element$/
• Then /^(?:|I )should not see an? "(?P<element>[^"]*)" element$/
• Then /^the "(?P<field>(?:[^"]|")*)" field should contain "(?P<value>(?:[^"]|")*)"$/
• Then /^the "(?P<field>(?:[^"]|")*)" field should not contain "(?P<value>(?:[^"]|")*)"$/
• Then /^(?:|I )should see (?P<num>d+) "(?P<element>[^"]*)" elements?$/
• Then /^the "(?P<checkbox>(?:[^"]|")*)" checkbox should be checked$/
• Then /^the "(?P<checkbox>(?:[^"]|")*)" checkbox is checked$/
• Then /^the checkbox "(?P<checkbox>(?:[^"]|")*)" (?:is|should be) checked$/
• Then /^the "(?P<checkbox>(?:[^"]|")*)" checkbox should (?:be unchecked|not be checked)$/
• Then /^the "(?P<checkbox>(?:[^"]|")*)" checkbox is (?:unchecked|not checked)$/
• Then /^the checkbox "(?P<checkbox>(?:[^"]|")*)" should (?:be unchecked|not be checked)$/
• Then /^the checkbox "(?P<checkbox>(?:[^"]|")*)" is (?:unchecked|not checked)$/
• Then /^print current URL$/
• Then /^print last response$/
• Then /^show last response$/
• Then I should see the error message( containing) :message
• Then I should see the following error message(s):
• Then I should not see the following error messages:
• Then I should see the success message( containing) :message
• Then I should see the following success messages:
• Then I should not see the following success messages:
• Then I should see the warning message( containing) :message
• Then I should see the following warning messages:
• Then I should not see the following warning messages:
• Then I should see the message( containing) :message
• Then I should not see the message( containing) :message
• Then /^I should see no (?P<selector>(?:success|error|warning)) message$/
• Then I should see neither error nor warning messages
• Then drush output should contain :output
• Then drush output should match :regex
• Then drush output should not contain :output
• Then print last drush output
• Then I should see the button :button in the :region( region)
• Then I should see the :button button in the :region( region)
• Then I should not see the button :button in the :region( region)
• Then I should not see the :button button in the :region( region)
• Then I( should) see the :tag element in the :region( region)
• Then I( should) not see the :tag element in the :region( region)
• Then I( should) not see :text in the :tag element in the :region( region)
• Then I( should) see the :tag element with the :attribute attribute set to :value in the :region( region)
• Then I( should) see :text in the :tag element with the :attribute attribute set to :value in the :region( region)
• Then I( should) see :text in the :tag element with the :property CSS property set to :value in the :region( region)
But scenario outline is not enough!
78
I want to use parameters for everything!
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 79
Scenario Outline: Launch an EC2 instance
Given I am logged in as user "{{ user_name }}"
When I visit "/clouds/design/server_template/"
And I click <instance_name>{{ cloud_context }}
And I click "Launch"
And the url should match "/launch"
And I check the box "Automatically terminate instance"
And I press "Launch"
Then I should be on "/clouds/aws_cloud/{{ cloud_context }}/instance"
And I should see "pending" in the <instance_name> row
And I should see <instance_type> in the <instance_name> row
And I should see "{{ availability_zone }}" in the <instance_name> row
Examples:
| instance_name | instance_type |
| "{{ instance_name_1 }}" | "{{ instance_type_1 }}" |
| "{{ instance_name_2 }}" | "{{ instance_type_2 }}" |
I want to use parameters for everything!
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 80
Scenario Outline: Launch an EC2 instance
Given I am logged in as user "{{ user_name }}"
When I visit "/clouds/design/server_template/"
And I click <instance_name>{{ cloud_context }}
And I click "Launch"
And the url should match "/launch"
And I check the box "Automatically terminate instance"
And I press "Launch"
Then I should be on "/clouds/aws_cloud/{{ cloud_context }}/instance"
And I should see "pending" in the <instance_name> row
And I should see <instance_type> in the <instance_name> row
And I should see "{{ availability_zone }}" in the <instance_name> row
Examples:
| instance_name | instance_type |
| "{{ instance_name_1 }}" | "{{ instance_type_1 }}" |
| "{{ instance_name_2 }}" | "{{ instance_type_2 }}" |
Twig Template!
Get Parameterized
81
Get Parameterized
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 82
Get Parameterized
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 83
docker build
Get Parameterized
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 84
docker build
RUN composer require 
drupal/cloud 
drupal/drupal-extension
...
Get Parameterized
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 85
Packagist:
drupal/cloud_orchestrator
incl. drupal/cloud
Feature: ...
Scenario Outline: ...
Examples:
docker build
RUN composer require 
drupal/cloud 
drupal/drupal-extension
...
<< Download >>
Get Parameterized
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 86
docker run docomoinnovations/cloud_orchestrator
Packagist:
drupal/cloud_orchestrator
incl. drupal/cloud
Feature: ...
Scenario Outline: ...
Examples:
docker build
RUN composer require 
drupal/cloud 
drupal/drupal-extension
...
<< Download >>
<< docker run >>
Get Parameterized
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 87
docker run docomoinnovations/cloud_orchestrator
Run drush cloud:behat:preprocess
• Read a YAML file whih contains parameter mappings
• Replace {{...}} as an input variable
Packagist:
drupal/cloud_orchestrator
incl. drupal/cloud
Feature: ...
Scenario Outline: ...
Examples:
docker build
RUN composer require 
drupal/cloud 
drupal/drupal-extension
...
<< Download >>
<< docker run >>
Get Parameterized
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 88
docker run docomoinnovations/cloud_orchestrator
Run drush cloud:behat:preprocess
• Read a YAML file whih contains parameter mappings
• Replace {{...}} as an input variable
private_params.yml
e.g.
This is a placeholder:
Cloud Orchestrator
Packagist:
drupal/cloud_orchestrator
incl. drupal/cloud
Feature: ...
Scenario Outline: ...
Examples:
docker build
RUN composer require 
drupal/cloud 
drupal/drupal-extension
...
<< Read parameter files>>
<< Download >>
<< docker run >>
Get Parameterized
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 89
docker run docomoinnovations/cloud_orchestrator
Run drush cloud:behat:preprocess
• Read a YAML file whih contains parameter mappings
• Replace {{...}} as an input variable
Feature: ...
Scenario Outline: ...
...<This is a placeholder>...
Examples:
| This is a placeholder |
| {{This is a placeholder}} |
private_params.yml
e.g.
This is a placeholder:
Cloud Orchestrator
Packagist:
drupal/cloud_orchestrator
incl. drupal/cloud
Feature: ...
Scenario Outline: ...
Examples:
docker build
RUN composer require 
drupal/cloud 
drupal/drupal-extension
...
<< Read parameter files>>
<< Read Feature template files>>
<< Download >>
<< docker run >>
Get Parameterized
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 90
docker run docomoinnovations/cloud_orchestrator
Run drush cloud:behat:preprocess
• Read a YAML file whih contains parameter mappings
• Replace {{...}} as an input variable
Feature: ...
Scenario Outline: ...
...<This is a placeholder>...
Examples:
| This is a placeholder |
| {{This is a placeholder}} |
private_params.yml
e.g.
This is a placeholder:
Cloud Orchestrator
Feature: ...
Scenario Outline: ...
...<This is a placeholder>...
Examples:
| This is a placeholder |
| Cloud Orchestrator |
Packagist:
drupal/cloud_orchestrator
incl. drupal/cloud
Feature: ...
Scenario Outline: ...
Examples:
docker build
RUN composer require 
drupal/cloud 
drupal/drupal-extension
...
<< Read parameter files>>
<< Read Feature template files>>
<< Output actual feature files>>
<< Download >>
<< docker run >>
Get Parameterized
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 91
docker run docomoinnovations/cloud_orchestrator
Run drush cloud:behat:preprocess
• Read a YAML file whih contains parameter mappings
• Replace {{...}} as an input variable
Run behat command
run_behat.sh
Feature: ...
Scenario Outline: ...
...<This is a placeholder>...
Examples:
| This is a placeholder |
| {{This is a placeholder}} |
private_params.yml
e.g.
This is a placeholder:
Cloud Orchestrator
Feature: ...
Scenario Outline: ...
...<This is a placeholder>...
Examples:
| This is a placeholder |
| Cloud Orchestrator |
Packagist:
drupal/cloud_orchestrator
incl. drupal/cloud
Feature: ...
Scenario Outline: ...
Examples:
docker build
RUN composer require 
drupal/cloud 
drupal/drupal-extension
...
<< Read parameter files>>
<< Read Feature template files>>
<< Output actual feature files>>
<< Read feature files>>
<< Download >>
<< docker run >>
Get Parameterized
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 92
docker run docomoinnovations/cloud_orchestrator
Run drush cloud:behat:preprocess
• Read a YAML file whih contains parameter mappings
• Replace {{...}} as an input variable
Run behat command
run_behat.sh
Feature: ...
Scenario Outline: ...
...<This is a placeholder>...
Examples:
| This is a placeholder |
| {{This is a placeholder}} |
private_params.yml
e.g.
This is a placeholder:
Cloud Orchestrator
Feature: ...
Scenario Outline: ...
...<This is a placeholder>...
Examples:
| This is a placeholder |
| Cloud Orchestrator |
Execute BDD tests
and get Output
Packagist:
drupal/cloud_orchestrator
incl. drupal/cloud
Feature: ...
Scenario Outline: ...
Examples:
docker build
RUN composer require 
drupal/cloud 
drupal/drupal-extension
...
<< Process features >>
<< Read parameter files>>
<< Read Feature template files>>
<< Output actual feature files>>
<< Read feature files>>
<< docker run >>
<< Download >>
GitLab CI/CD Pipeline
93
We Test Our Code
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 94
We Want This One!
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 95
GitLab CI/CD Pipeline
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 96
GitLab CI/CD Pipeline
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 97
GitLab CI/CD Pipeline Architecture Basics
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 98
Developer
GitLab CI/CD Pipeline Architecture Basics
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 99
Developer
GitLab CI/CD Pipeline Architecture Basics
GitLab Master
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 100
GitLab Master GitLab Runner
Developer
GitLab CI/CD Pipeline Architecture Basics
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 101
GitLab Master
GitLab
Repository
Developer
GitLab CI/CD Pipeline Architecture Basics
GitLab Runner
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 102
GitLab Master
CI/CD
Pipeline
GitLab
Repository
Developer
GitLab CI/CD Pipeline Architecture Basics
GitLab Runner
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 103
GitLab Master GitLab Runner
CI/CD
Pipeline
GitLab
Repository
Developer
gitlab-runner 1
gitlab-runner 2
…
gitlab-runner N
GitLab CI/CD Pipeline Architecture Basics
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 104
GitLab Master GitLab Runner
GitLab
Container
Registry
CI/CD
Pipeline
GitLab
Repository
Developer
GitLab CI/CD Pipeline Architecture Basics
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 105
gitlab-runner 1
gitlab-runner 2
…
gitlab-runner N
GitLab Master GitLab Runner
CI/CD
Pipeline
GitLab
Repository
Developer
GitLab CI/CD Pipeline Architecture Basics
GitLab
Container
Registry
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 106
gitlab-runner 1
gitlab-runner 2
…
gitlab-runner N
GitLab Master GitLab Runner
CI/CD
Pipeline
GitLab
Repository
Developer
GitLab CI/CD Pipeline Architecture Basics
GitLab
Container
Registry
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 107
gitlab-runner 1
gitlab-runner 2
…
gitlab-runner N
GitLab Master GitLab Runner
CI/CD
Pipeline
GitLab
Repository
Developer
GitLab CI/CD Pipeline Architecture Basics
GitLab
Container
Registry
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 108
gitlab-runner 1
gitlab-runner 2
…
gitlab-runner N
GitLab Master GitLab Runner
CI/CD
Pipeline
GitLab
Repository
Developer
GitLab CI/CD Pipeline Architecture Basics
GitLab
Container
Registry
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 109
gitlab-runner 1
gitlab-runner 2
…
gitlab-runner N
EC2
Our GitLab CI/CD Pipeline Architecture
GitLab Master (SaaS)
CI/CD
Pipeline
GitLab
Repository
Developer
Slack
GitLab
Container Registry
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 110
gitlab-runner 1
gitlab-runner 2
gitlab-runner 3
gitlab-runner 4
Slack Integration
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 111
How can we build CI/CD pipeline?
112
.gitlab-ci.yml
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 113
stages:
- run_tests
- .post
variables:
UPDATE: 20220408a
WEB_ROOT: '/var/www/html/web'
CLOUD_HOME: "${WEB_ROOT}/modules/contrib/cloud"
BROWSER_OUTPUT: "${WEB_ROOT}/sites/simpletest/browser_output/"
IMAGE_TAG: 9.4.x-arm64
.preprocess_template: &preprocess_definition
image:
name: "${CI_REGISTRY_IMAGE}:${IMAGE_TAG}"
stage: run_tests
only:
- branches
# - merge_requests
before_script: |
whoami
sudo service apache2 start
sudo service memcached start
sudo mkdir -p "${WEB_ROOT}/simpletest/${CI_PIPELINE_ID}"
sudo mount -t tmpfs -o size=8G tmpfs "${WEB_ROOT}/simpletest/${CI_PIPELINE_ID}"
sudo chmod 777 -R "${WEB_ROOT}/simpletest"
rm -rf "${CLOUD_HOME}" && cp -ar "${PWD}" "${CLOUD_HOME}”
.artifacts_template: &postprocess_definition
after_script: |
mkdir -p "${BROWSER_OUTPUT}"
if [ -d "${BROWSER_OUTPUT}" ]; then cp -ar "${BROWSER_OUTPUT}" "${CI_PROJECT_DIR}/";
else mkdir -p "${BROWSER_OUTPUT}" && touch "${BROWSER_OUTPUT}/NO_ARTIFACTS.txt"; fi
php -v
drush status
...
.gitlab-ci.yml
• Describe the pipeline definition in one YAML file
• Put root (top) directory of your branch
• Get started
– https://docs.gitlab.com/ee/ci/quick_start/
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 114
Demo
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 115
• Behat
• GitLab CI/CD Pipeline
Lessons That We Learned
116
Our Custom Extension to drupal-extension
1. Logged in as the existing user without password
– Using drush user:login
2. Take a screenshot, which is very useful in troubleshooting
– Not only with Selenium + @javascript, but Chrome Extension or w/o
@javascript
3. Specifying a region with the row index of a table
– Especially when the same labels are used in multiple rows
4. Assert only the success message shows
– Namely, neither error or warning messages show
117
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved.
Our Custom Extension to drupal-extension
118
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved.
1. Logged in as the existing user without password
– Using drush user:login
2. Take a screenshot, which is very useful in troubleshooting
– Not only with Selenium + @javascript, but Chrome Extension
or w/o @javascript annotation
3. Specifying a region with the row index of a table
– Especially when the same labels are used in multiple rows
4. Assert only the success message shows
– Namely, neither error or warning messages show
1. Logged in as the existing user without password
– Using drush user:login
2. Take a screenshot, which is very useful in troubleshooting
– Not only with Selenium + @javascript, but Chrome Extension
or w/o @javascript annotation
3. Specifying a region with the row index of a table
– Especially when the same labels are used in multiple rows
4. Assert only the success message shows
– Namely, neither error or warning messages show
Our Custom Extension to drupal-extension
119
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved.
1. Logged in as the existing user without password
– Using drush user:login
2. Take a screenshot, which is very useful in troubleshooting
– Not only with Selenium + @javascript, but Chrome Extension
or w/o @javascript annotation
3. Specifying a region with the row index of a table
– Especially when the same labels are used in multiple rows
4. Assert only the success message shows
– Namely, neither error or warning messages show
Our Custom Extension to drupal-extension
120
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved.
Our Custom Extension to drupal-extension
121
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved.
1. Logged in as the existing user without password
– Using drush user:login
2. Take a screenshot, which is very useful in troubleshooting
– Not only with Selenium + @javascript, but Chrome Extension
or w/o @javascript annotation
3. Specifying a region with the row index of a table
– Especially when the same labels are used in multiple rows
4. Assert only the success message shows
– Namely, neither error or warning messages show
Known Issues: Solutions
1. User login sometimes fails due to "Username" is not found
– Workaround: add a longer sleep after chromium started
2. The text in checkbox/link is visible, but not ready to be clicked
– Add 500 ms sleep before such action
3. Cannot distinguish DOM objects if the same text are set
– For the table rows
4. Cannot login with a role created in the same Behat process
– Workaround: divide a feature file to run Behat for each
– Avoid using login with such role
122
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved.
Resources
123
Where to Find Our Solutions
124
• Behat feature files & configurations
– https://git.drupalcode.org/project/cloud/-/tree/5.x/tests/src/Behat
– https://git.drupalcode.org/project/cloud/-/tree/5.x/modules/cloud_service_providers/aws_cloud/tests/src/Behat
– https://git.drupalcode.org/project/cloud/-/tree/5.x/modules/cloud_service_providers/k8s/tests/src/Behat
• Drupal extensions with our custom functions
– https://github.com/docomoinnovations/drupalextension
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved.
Resources
125
• Cloud Orchestrator
– https://drupal.org/project/cloud
– https://cloud.airgap.host
• YouTube Channel
– https://bit.ly/2TJssME
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved.
126
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved.
Thank you!
"Coming together is a beginning, keeping together is
a progress; working together is a success.“
- Henry Ford
@yas
linkedin.com/in/yasnaoi

More Related Content

Similar to Automate Behavior-driven Development (Stanford WebCamp 2022)

Commit to the Cause, Push for Change: Contributing to Call for Code Open Sour...
Commit to the Cause, Push for Change: Contributing to Call for Code Open Sour...Commit to the Cause, Push for Change: Contributing to Call for Code Open Sour...
Commit to the Cause, Push for Change: Contributing to Call for Code Open Sour...Daniel Krook
 
Tokyo Release.pdf
Tokyo Release.pdfTokyo Release.pdf
Tokyo Release.pdfRajiv283486
 
Get the Exact Identity Solution You Need - In the Cloud - Overview
Get the Exact Identity Solution You Need - In the Cloud - OverviewGet the Exact Identity Solution You Need - In the Cloud - Overview
Get the Exact Identity Solution You Need - In the Cloud - OverviewForgeRock
 
Enhancing the Power of Salesforce with DevOps & Copado Webinar | SoftClouds D...
Enhancing the Power of Salesforce with DevOps & Copado Webinar | SoftClouds D...Enhancing the Power of Salesforce with DevOps & Copado Webinar | SoftClouds D...
Enhancing the Power of Salesforce with DevOps & Copado Webinar | SoftClouds D...SoftClouds LLC
 
Using GitHub and Visual Studio Code for Mainframe Development
Using GitHub and Visual Studio Code for Mainframe DevelopmentUsing GitHub and Visual Studio Code for Mainframe Development
Using GitHub and Visual Studio Code for Mainframe DevelopmentDevOps.com
 
CampDevOps keynote - DevOps: Using 'Lean' to eliminate Bottlenecks
CampDevOps keynote - DevOps: Using 'Lean' to eliminate BottlenecksCampDevOps keynote - DevOps: Using 'Lean' to eliminate Bottlenecks
CampDevOps keynote - DevOps: Using 'Lean' to eliminate BottlenecksSanjeev Sharma
 
Software Factory Tools Partner Day Final
Software Factory Tools Partner Day FinalSoftware Factory Tools Partner Day Final
Software Factory Tools Partner Day FinalLek Pongpatimet
 
SUGCON: The Agile Nirvana of DevSecOps and Containerization
SUGCON: The Agile Nirvana of DevSecOps and ContainerizationSUGCON: The Agile Nirvana of DevSecOps and Containerization
SUGCON: The Agile Nirvana of DevSecOps and ContainerizationVasiliy Fomichev
 
Where Does IBM Web Experience Factory Fit in your Architecture? TECH-D22 from...
Where Does IBM Web Experience Factory Fit in your Architecture? TECH-D22 from...Where Does IBM Web Experience Factory Fit in your Architecture? TECH-D22 from...
Where Does IBM Web Experience Factory Fit in your Architecture? TECH-D22 from...Davalen LLC
 
UrbanCode Deploy course and product overview slides
UrbanCode Deploy course and product overview slidesUrbanCode Deploy course and product overview slides
UrbanCode Deploy course and product overview slidesIBM Rational software
 
Customer Centric View of Best Practices in Software Monetization
Customer Centric View of Best Practices in Software MonetizationCustomer Centric View of Best Practices in Software Monetization
Customer Centric View of Best Practices in Software Monetizationteam-WIBU
 
Agile Practice in Drupal 8 Module Development
Agile Practice in Drupal 8 Module DevelopmentAgile Practice in Drupal 8 Module Development
Agile Practice in Drupal 8 Module DevelopmentDOCOMO Innovations, Inc.
 
State of Mainframe DevOps
State of Mainframe DevOpsState of Mainframe DevOps
State of Mainframe DevOpsDevOps.com
 
Kong Academyを日本語でお届け!#4 ”はじめてのKong”オンラインミートアップKong Developer Portal編
Kong Academyを日本語でお届け!#4 ”はじめてのKong”オンラインミートアップKong Developer Portal編Kong Academyを日本語でお届け!#4 ”はじめてのKong”オンラインミートアップKong Developer Portal編
Kong Academyを日本語でお届け!#4 ”はじめてのKong”オンラインミートアップKong Developer Portal編Junji Nishihara
 
Engage.UG 2022 - Domino TOTP/2FA - Best Practices and Pitfalls
Engage.UG 2022 - Domino TOTP/2FA - Best Practices and PitfallsEngage.UG 2022 - Domino TOTP/2FA - Best Practices and Pitfalls
Engage.UG 2022 - Domino TOTP/2FA - Best Practices and PitfallsMilan Matejic
 
DevSecOps 的規模化實踐 (Level: 300-400)
DevSecOps 的規模化實踐 (Level: 300-400)DevSecOps 的規模化實踐 (Level: 300-400)
DevSecOps 的規模化實踐 (Level: 300-400)Amazon Web Services
 
Groovy-Powered Microservices with Micronaut
Groovy-Powered Microservices with MicronautGroovy-Powered Microservices with Micronaut
Groovy-Powered Microservices with MicronautZachary Klein
 
CI/CD with AWS Developer Tools and Fargate
CI/CD with AWS Developer Tools and FargateCI/CD with AWS Developer Tools and Fargate
CI/CD with AWS Developer Tools and FargateAmazon Web Services
 

Similar to Automate Behavior-driven Development (Stanford WebCamp 2022) (20)

Commit to the Cause, Push for Change: Contributing to Call for Code Open Sour...
Commit to the Cause, Push for Change: Contributing to Call for Code Open Sour...Commit to the Cause, Push for Change: Contributing to Call for Code Open Sour...
Commit to the Cause, Push for Change: Contributing to Call for Code Open Sour...
 
Tokyo Release.pdf
Tokyo Release.pdfTokyo Release.pdf
Tokyo Release.pdf
 
Get the Exact Identity Solution You Need - In the Cloud - Overview
Get the Exact Identity Solution You Need - In the Cloud - OverviewGet the Exact Identity Solution You Need - In the Cloud - Overview
Get the Exact Identity Solution You Need - In the Cloud - Overview
 
Enhancing the Power of Salesforce with DevOps & Copado Webinar | SoftClouds D...
Enhancing the Power of Salesforce with DevOps & Copado Webinar | SoftClouds D...Enhancing the Power of Salesforce with DevOps & Copado Webinar | SoftClouds D...
Enhancing the Power of Salesforce with DevOps & Copado Webinar | SoftClouds D...
 
Using GitHub and Visual Studio Code for Mainframe Development
Using GitHub and Visual Studio Code for Mainframe DevelopmentUsing GitHub and Visual Studio Code for Mainframe Development
Using GitHub and Visual Studio Code for Mainframe Development
 
CampDevOps keynote - DevOps: Using 'Lean' to eliminate Bottlenecks
CampDevOps keynote - DevOps: Using 'Lean' to eliminate BottlenecksCampDevOps keynote - DevOps: Using 'Lean' to eliminate Bottlenecks
CampDevOps keynote - DevOps: Using 'Lean' to eliminate Bottlenecks
 
Leveraging Multiple Cloud Orchestration
Leveraging Multiple Cloud OrchestrationLeveraging Multiple Cloud Orchestration
Leveraging Multiple Cloud Orchestration
 
Software Factory Tools Partner Day Final
Software Factory Tools Partner Day FinalSoftware Factory Tools Partner Day Final
Software Factory Tools Partner Day Final
 
SUGCON: The Agile Nirvana of DevSecOps and Containerization
SUGCON: The Agile Nirvana of DevSecOps and ContainerizationSUGCON: The Agile Nirvana of DevSecOps and Containerization
SUGCON: The Agile Nirvana of DevSecOps and Containerization
 
Where Does IBM Web Experience Factory Fit in your Architecture? TECH-D22 from...
Where Does IBM Web Experience Factory Fit in your Architecture? TECH-D22 from...Where Does IBM Web Experience Factory Fit in your Architecture? TECH-D22 from...
Where Does IBM Web Experience Factory Fit in your Architecture? TECH-D22 from...
 
Overview
OverviewOverview
Overview
 
UrbanCode Deploy course and product overview slides
UrbanCode Deploy course and product overview slidesUrbanCode Deploy course and product overview slides
UrbanCode Deploy course and product overview slides
 
Customer Centric View of Best Practices in Software Monetization
Customer Centric View of Best Practices in Software MonetizationCustomer Centric View of Best Practices in Software Monetization
Customer Centric View of Best Practices in Software Monetization
 
Agile Practice in Drupal 8 Module Development
Agile Practice in Drupal 8 Module DevelopmentAgile Practice in Drupal 8 Module Development
Agile Practice in Drupal 8 Module Development
 
State of Mainframe DevOps
State of Mainframe DevOpsState of Mainframe DevOps
State of Mainframe DevOps
 
Kong Academyを日本語でお届け!#4 ”はじめてのKong”オンラインミートアップKong Developer Portal編
Kong Academyを日本語でお届け!#4 ”はじめてのKong”オンラインミートアップKong Developer Portal編Kong Academyを日本語でお届け!#4 ”はじめてのKong”オンラインミートアップKong Developer Portal編
Kong Academyを日本語でお届け!#4 ”はじめてのKong”オンラインミートアップKong Developer Portal編
 
Engage.UG 2022 - Domino TOTP/2FA - Best Practices and Pitfalls
Engage.UG 2022 - Domino TOTP/2FA - Best Practices and PitfallsEngage.UG 2022 - Domino TOTP/2FA - Best Practices and Pitfalls
Engage.UG 2022 - Domino TOTP/2FA - Best Practices and Pitfalls
 
DevSecOps 的規模化實踐 (Level: 300-400)
DevSecOps 的規模化實踐 (Level: 300-400)DevSecOps 的規模化實踐 (Level: 300-400)
DevSecOps 的規模化實踐 (Level: 300-400)
 
Groovy-Powered Microservices with Micronaut
Groovy-Powered Microservices with MicronautGroovy-Powered Microservices with Micronaut
Groovy-Powered Microservices with Micronaut
 
CI/CD with AWS Developer Tools and Fargate
CI/CD with AWS Developer Tools and FargateCI/CD with AWS Developer Tools and Fargate
CI/CD with AWS Developer Tools and Fargate
 

More from DOCOMO Innovations, Inc.

Empower Your Single Site for Multi-tenancy Services (Stanford WebCamp 2023)
Empower Your Single Site for Multi-tenancy Services (Stanford WebCamp 2023)Empower Your Single Site for Multi-tenancy Services (Stanford WebCamp 2023)
Empower Your Single Site for Multi-tenancy Services (Stanford WebCamp 2023)DOCOMO Innovations, Inc.
 
クラウドオーケストレーターを使ってみよう
クラウドオーケストレーターを使ってみようクラウドオーケストレーターを使ってみよう
クラウドオーケストレーターを使ってみようDOCOMO Innovations, Inc.
 
Leveraging Multiple Cloud Orchestration and Resource Optimization
Leveraging Multiple Cloud Orchestration and Resource OptimizationLeveraging Multiple Cloud Orchestration and Resource Optimization
Leveraging Multiple Cloud Orchestration and Resource OptimizationDOCOMO Innovations, Inc.
 
CouchConf Tokyo Customer Presentation: DOCOMO Innovations (Japanese)
CouchConf Tokyo Customer Presentation: DOCOMO Innovations (Japanese)CouchConf Tokyo Customer Presentation: DOCOMO Innovations (Japanese)
CouchConf Tokyo Customer Presentation: DOCOMO Innovations (Japanese)DOCOMO Innovations, Inc.
 
CouchConf Tokyo Customer Presentation: DOCOMO Innovations (English)
CouchConf Tokyo Customer Presentation: DOCOMO Innovations (English)CouchConf Tokyo Customer Presentation: DOCOMO Innovations (English)
CouchConf Tokyo Customer Presentation: DOCOMO Innovations (English)DOCOMO Innovations, Inc.
 
CouchConf Tokyo DOCOMO Innovations Lunchtime Lightning Talk (English)
CouchConf Tokyo DOCOMO Innovations Lunchtime Lightning Talk (English)CouchConf Tokyo DOCOMO Innovations Lunchtime Lightning Talk (English)
CouchConf Tokyo DOCOMO Innovations Lunchtime Lightning Talk (English)DOCOMO Innovations, Inc.
 
Clanavi: How to Manage Your Cloud by Drupal (BADCamp 2010)
Clanavi: How to Manage Your Cloud by Drupal (BADCamp 2010)Clanavi: How to Manage Your Cloud by Drupal (BADCamp 2010)
Clanavi: How to Manage Your Cloud by Drupal (BADCamp 2010)DOCOMO Innovations, Inc.
 
Clanavi: How to Manage Your Cloud by Drupal
Clanavi: How to Manage Your Cloud by DrupalClanavi: How to Manage Your Cloud by Drupal
Clanavi: How to Manage Your Cloud by DrupalDOCOMO Innovations, Inc.
 
How to Manage Your Cloud by Drupal (DrupalCon CPH 2010)
How to Manage Your Cloud by Drupal (DrupalCon CPH 2010)How to Manage Your Cloud by Drupal (DrupalCon CPH 2010)
How to Manage Your Cloud by Drupal (DrupalCon CPH 2010)DOCOMO Innovations, Inc.
 

More from DOCOMO Innovations, Inc. (10)

Empower Your Single Site for Multi-tenancy Services (Stanford WebCamp 2023)
Empower Your Single Site for Multi-tenancy Services (Stanford WebCamp 2023)Empower Your Single Site for Multi-tenancy Services (Stanford WebCamp 2023)
Empower Your Single Site for Multi-tenancy Services (Stanford WebCamp 2023)
 
クラウドオーケストレーターを使ってみよう
クラウドオーケストレーターを使ってみようクラウドオーケストレーターを使ってみよう
クラウドオーケストレーターを使ってみよう
 
Leveraging Multiple Cloud Orchestration and Resource Optimization
Leveraging Multiple Cloud Orchestration and Resource OptimizationLeveraging Multiple Cloud Orchestration and Resource Optimization
Leveraging Multiple Cloud Orchestration and Resource Optimization
 
Leveraging Multiple Cloud Orchestration
Leveraging Multiple Cloud OrchestrationLeveraging Multiple Cloud Orchestration
Leveraging Multiple Cloud Orchestration
 
CouchConf Tokyo Customer Presentation: DOCOMO Innovations (Japanese)
CouchConf Tokyo Customer Presentation: DOCOMO Innovations (Japanese)CouchConf Tokyo Customer Presentation: DOCOMO Innovations (Japanese)
CouchConf Tokyo Customer Presentation: DOCOMO Innovations (Japanese)
 
CouchConf Tokyo Customer Presentation: DOCOMO Innovations (English)
CouchConf Tokyo Customer Presentation: DOCOMO Innovations (English)CouchConf Tokyo Customer Presentation: DOCOMO Innovations (English)
CouchConf Tokyo Customer Presentation: DOCOMO Innovations (English)
 
CouchConf Tokyo DOCOMO Innovations Lunchtime Lightning Talk (English)
CouchConf Tokyo DOCOMO Innovations Lunchtime Lightning Talk (English)CouchConf Tokyo DOCOMO Innovations Lunchtime Lightning Talk (English)
CouchConf Tokyo DOCOMO Innovations Lunchtime Lightning Talk (English)
 
Clanavi: How to Manage Your Cloud by Drupal (BADCamp 2010)
Clanavi: How to Manage Your Cloud by Drupal (BADCamp 2010)Clanavi: How to Manage Your Cloud by Drupal (BADCamp 2010)
Clanavi: How to Manage Your Cloud by Drupal (BADCamp 2010)
 
Clanavi: How to Manage Your Cloud by Drupal
Clanavi: How to Manage Your Cloud by DrupalClanavi: How to Manage Your Cloud by Drupal
Clanavi: How to Manage Your Cloud by Drupal
 
How to Manage Your Cloud by Drupal (DrupalCon CPH 2010)
How to Manage Your Cloud by Drupal (DrupalCon CPH 2010)How to Manage Your Cloud by Drupal (DrupalCon CPH 2010)
How to Manage Your Cloud by Drupal (DrupalCon CPH 2010)
 

Recently uploaded

SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfjimielynbastida
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 

Recently uploaded (20)

SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdf
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 

Automate Behavior-driven Development (Stanford WebCamp 2022)

  • 1. Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 1 Stanford WebCamp 2022 Automate Behavior-driven Development Yas Naoi Chief Architect, Cloud DOCOMO Innovatins, Inc.
  • 2. Yas 2 Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. @yas linkedin.com/in/yasnaoi
  • 3. Yas 3 Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. • Chief Architect, Cloud
  • 4. Yas 4 Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. • Chief Architect, Cloud • DOCOMO Innovations, Inc. (Palo Alto, CA) • NTT DOCOMO Inc.
  • 5. Yas • Chief Architect, Cloud • DOCOMO Innovations, Inc. (Palo Alto, CA) • NTT DOCOMO Inc. • Cloud, DevOps, Agile Software Development • d.o: 17 years 5 Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved.
  • 6. Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 6 Our Team
  • 7. Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 7 / Cloud Team Members /
  • 8. Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 8 / Cloud Team Members / CA Yas Baldwin Kumiko Tatsuya Hiroki Tamaki
  • 9. Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 9 / Cloud Team Members / India Sachin CA Yas Baldwin Kumiko Tatsuya Hiroki Tamaki
  • 10. Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 10 / Cloud Team Members / Japan Xiaohua Takumaru Masami Ryo Tomohiro India Sachin CA Yas Baldwin Kumiko Tatsuya Hiroki Tamaki Shota Makoto
  • 11. 11 Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. Cloud Orchestrator Search: drupal cloud orchestrator
  • 12. 12 Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. Cloud Orchestrator Search: drupal cloud orchestrator
  • 13. Multi-cloud Support ────────────── 13 Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. Cloud Orchestrator
  • 14. Multi-cloud Support ────────────── § AWS 14 Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. Cloud Orchestrator
  • 15. Multi-cloud Support ────────────── § AWS § Kubernetes 15 Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. Cloud Orchestrator
  • 16. Multi-cloud Support ────────────── § AWS § Kubernetes § OpenStack 16 Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. Cloud Orchestrator
  • 17. Multi-cloud Support ────────────── § AWS § Kubernetes § OpenStack § VMware 17 Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. Cloud Orchestrator
  • 18. Multi-cloud Support ────────────── § AWS § Kubernetes § OpenStack § VMware § Terraform Cloud 18 Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. Cloud Orchestrator
  • 19. Agenda 19 Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved.
  • 20. Agenda • Development Model • What’s Behat for Behavior-driven Development (BDD) • Templating for Behat Test Scenarios • Automated Testing for BDD 20 Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved.
  • 22. Software Development Lifecycle Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 22
  • 23. Software Development Lifecycle Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 23 Coding Integration Testing Component Design Function Design Unit Testing System Requirements System Testing Business Requirements Acceptance Testing V-model [Boehm 79]
  • 24. Software Development Lifecycle Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 24 Business Requirements V-model [Boehm 79]
  • 25. Software Development Lifecycle Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 25 System Requirements Business Requirements V-model [Boehm 79]
  • 26. Software Development Lifecycle Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 26 Component Design System Requirements Business Requirements V-model [Boehm 79]
  • 27. Software Development Lifecycle Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 27 Component Design Function Design System Requirements Business Requirements V-model [Boehm 79]
  • 28. Software Development Lifecycle Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 28 Coding Component Design Function Design System Requirements Business Requirements V-model [Boehm 79]
  • 29. Software Development Lifecycle Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 29 Coding Component Design Function Design Unit Testing System Requirements Business Requirements V-model [Boehm 79]
  • 30. Software Development Lifecycle Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 30 Coding Integration Testing Component Design Function Design Unit Testing System Requirements Business Requirements V-model [Boehm 79]
  • 31. Software Development Lifecycle Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 31 Coding Integration Testing Component Design Function Design Unit Testing System Requirements System Testing Business Requirements V-model [Boehm 79]
  • 32. Software Development Lifecycle Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 32 Coding Integration Testing Component Design Function Design Unit Testing System Requirements System Testing Business Requirements Acceptance Testing V-model [Boehm 79]
  • 33. Software Development Lifecycle Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 33 Coding Integration Testing Component Design Function Design Unit Testing System Requirements System Testing Business Requirements Acceptance Testing V-model [Boehm 79]
  • 34. Software Development Lifecycle Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 34 Coding Integration Testing Component Design Function Design Unit Testing System Requirements System Testing Business Requirements Acceptance Testing TDD V-model [Boehm 79]
  • 35. Software Development Lifecycle Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 35 Coding Integration Testing Component Design Function Design Unit Testing System Requirements System Testing Business Requirements Acceptance Testing TDD BDD V-model [Boehm 79]
  • 36. Software Development Lifecycle Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 36 Coding Integration Testing Component Design Function Design Unit Testing System Requirements System Testing Business Requirements Acceptance Testing TDD BDD ATDD V-model [Boehm 79]
  • 37. Software Development Lifecycle Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 37 Coding Integration Testing Component Design Function Design Unit Testing System Requirements System Testing Business Requirements Acceptance Testing V-model [Boehm 79] ✔TDD BDD ATDD PHPUnit (Drupal)
  • 38. Software Development Lifecycle Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 38 Coding Integration Testing Component Design Function Design Unit Testing System Requirements System Testing Business Requirements Acceptance Testing V-model [Boehm 79] ✔TDD ✔BDD (ATDD) PHPUnit (Drupal) Behat+ Drupal Extension
  • 40. PHPUnit Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 40 /** * Tests CRUD for K8s node. * * @throws Exception */ public function testNode(): void { $cloud_context = $this->cloudContext; $data = $this->createNodeTestFormData(self::K8S_NODE_REPEAT_COUNT); $this->updateNodesMockData($data); // Update k8s nodes. $this->drupalGet("/clouds/k8s/$cloud_context/node/update"); $this->assertNoErrorMessage(); for ($i = 0; $i < self::K8S_NODE_REPEAT_COUNT; $i++) { $this->assertSession()->pageTextContains($data[$i]['name']); } for ($i = 0, $num = 1; $i < self::K8S_NODE_REPEAT_COUNT; $i++, $num++) { // Make sure the all node listing exists. $this->drupalGet('/clouds/k8s/node'); $this->assertNoErrorMessage(); for ($j = 0; $j < $num; $j++) { $this->assertSession()->pageTextContains($data[$j]['name']); } } }
  • 41. BDD Test Scenario Example by Behat Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 41 Feature: Login, Check the Clean State, and Logout In order to list resources on the clean state As a user I need to have both Drupal and AWS IAM permissions Scenario: Log in as "Anonymous user" Given I am not logged in When I visit "/clouds" Then I should be on "/user/login" And I should see the heading "Log in" Scenario Outline: Access cloud service providers Given I am logged in as a user with the <role> role And I should not see the link "All" in the "nav_bar" And I should <verb> "Add cloud service provider" in the "nav_bar" When I go to "/clouds" Then I should be on "/admin/structure/cloud_config/add" And I should get a <code> HTTP response And I should see the heading <heading> Examples: | role | verb | code | heading | | "Authenticated user" | not see | 403 | "Access denied" | | "Cloud administrator" | see | 200 | "Add cloud service provider" | | "Administrator" | see | 200 | "Add cloud service provider" |
  • 43. Behat + drupal-extension + Chrome Driver 2022 DOCOMO Innovations, Inc. All Rights Reserved. Confidential. 43 Application under Test (AUT) Test Framework
  • 44. Behat + drupal-extension + Chrome Driver 2022 DOCOMO Innovations, Inc. All Rights Reserved. Confidential. 44 Test Framework
  • 45. Behat + drupal-extension + Chrome Driver 2022 DOCOMO Innovations, Inc. All Rights Reserved. Confidential. Test Framework Features in Gherkin 45
  • 46. Behat + drupal-extension + Chrome Driver 2022 DOCOMO Innovations, Inc. All Rights Reserved. Confidential. Test Framework Features in Gherkin Drupal Ext. Drush Ext. API Driver 46
  • 47. Behat + drupal-extension + Chrome Driver 2022 DOCOMO Innovations, Inc. All Rights Reserved. Confidential. Test Framework Features in Gherkin Drupal Ext. Drush Ext. API Driver Mink Ext. Chrome Ext. WebDriver 47
  • 48. Behat + drupal-extension + Chrome Driver 2022 DOCOMO Innovations, Inc. All Rights Reserved. Confidential. Chrome Driver Test Framework Features in Gherkin Drupal Ext. Drush Ext. API Driver Mink Ext. Chrome Ext. WebDriver WebDriver Implementation 48
  • 49. Behat + drupal-extension + Chrome Driver 2022 DOCOMO Innovations, Inc. All Rights Reserved. Confidential. Chrome Driver Headless Browser Test Framework Features in Gherkin Drupal Ext. Drush Ext. API Driver Mink Ext. Chrome Ext. WebDriver WebDriver Implementation << Native API >> 49
  • 50. Behat + drupal-extension + Chrome Driver 2022 DOCOMO Innovations, Inc. All Rights Reserved. Confidential. Application under Test (AUT) Chrome Driver Headless Browser << Native API >> << HTTP >> Test Framework Features in Gherkin Drupal Ext. Drush Ext. API Driver Mink Ext. Chrome Ext. WebDriver WebDriver Implementation 50
  • 52. Behat (Gherkin) Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 52 Feature: Login, Check the Clean State, and Logout In order to list resources on the clean state As a user I need to have both Drupal and AWS IAM permissions Scenario: Log in as "Anonymous user" Given I am not logged in When I visit "/clouds" Then I should be on "/user/login" And I should see the heading "Log in" Scenario Outline: Access cloud service providers Given I am logged in as a user with the <role> role And I should not see the link "All" in the "nav_bar" And I should <verb> "Add cloud service provider" in the "nav_bar" When I go to "/clouds" Then I should be on "/admin/structure/cloud_config/add" And I should get a <code> HTTP response And I should see the heading <heading> Examples: | role | verb | code | heading | | "Authenticated user" | not see | 403 | "Access denied" | | "Cloud administrator" | see | 200 | "Add cloud service provider" | | "Administrator" | see | 200 | "Add cloud service provider" |
  • 53. Behat (Gherkin) Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 53 Feature: Login, Check the Clean State, and Logout In order to list resources on the clean state As a user I need to have both Drupal and AWS IAM permissions Scenario: Log in as "Anonymous user" Given I am not logged in When I visit "/clouds" Then I should be on "/user/login" And I should see the heading "Log in" Scenario Outline: Access cloud service providers Given I am logged in as a user with the <role> role And I should not see the link "All" in the "nav_bar" And I should <verb> "Add cloud service provider" in the "nav_bar" When I go to "/clouds" Then I should be on "/admin/structure/cloud_config/add" And I should get a <code> HTTP response And I should see the heading <heading> Examples: | role | verb | code | heading | | "Authenticated user" | not see | 403 | "Access denied" | | "Cloud administrator" | see | 200 | "Add cloud service provider" | | "Administrator" | see | 200 | "Add cloud service provider" |
  • 54. Behat (Gherkin) Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 54 Feature: Login, Check the Clean State, and Logout In order to list resources on the clean state As a user I need to have both Drupal and AWS IAM permissions Scenario: Log in as "Anonymous user" Given I am not logged in When I visit "/clouds" Then I should be on "/user/login" And I should see the heading "Log in" Scenario Outline: Access cloud service providers Given I am logged in as a user with the <role> role And I should not see the link "All" in the "nav_bar" And I should <verb> "Add cloud service provider" in the "nav_bar" When I go to "/clouds" Then I should be on "/admin/structure/cloud_config/add" And I should get a <code> HTTP response And I should see the heading <heading> Examples: | role | verb | code | heading | | "Authenticated user" | not see | 403 | "Access denied" | | "Cloud administrator" | see | 200 | "Add cloud service provider" | | "Administrator" | see | 200 | "Add cloud service provider" |
  • 55. Behat (Gherkin) Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 55 Feature: Login, Check the Clean State, and Logout In order to list resources on the clean state As a user I need to have both Drupal and AWS IAM permissions Scenario: Log in as "Anonymous user" Given I am not logged in When I visit "/clouds" Then I should be on "/user/login" And I should see the heading "Log in" Scenario Outline: Access cloud service providers Given I am logged in as a user with the <role> role And I should not see the link "All" in the "nav_bar" And I should <verb> "Add cloud service provider" in the "nav_bar" When I go to "/clouds" Then I should be on "/admin/structure/cloud_config/add" And I should get a <code> HTTP response And I should see the heading <heading> Examples: | role | verb | code | heading | | "Authenticated user" | not see | 403 | "Access denied" | | "Cloud administrator" | see | 200 | "Add cloud service provider" | | "Administrator" | see | 200 | "Add cloud service provider" |
  • 56. Behat (Gherkin) Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 56 Feature: Login, Check the Clean State, and Logout In order to list resources on the clean state As a user I need to have both Drupal and AWS IAM permissions Scenario: Log in as "Anonymous user" Given I am not logged in When I visit "/clouds" Then I should be on "/user/login" And I should see the heading "Log in" Scenario Outline: Access cloud service providers Given I am logged in as a user with the <role> role And I should not see the link "All" in the "nav_bar" And I should <verb> "Add cloud service provider" in the "nav_bar" When I go to "/clouds" Then I should be on "/admin/structure/cloud_config/add" And I should get a <code> HTTP response And I should see the heading <heading> Examples: | role | verb | code | heading | | "Authenticated user" | not see | 403 | "Access denied" | | "Cloud administrator" | see | 200 | "Add cloud service provider" | | "Administrator" | see | 200 | "Add cloud service provider" |
  • 57. Behat (Gherkin) Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 57 Feature: Login, Check the Clean State, and Logout In order to list resources on the clean state As a user I need to have both Drupal and AWS IAM permissions Scenario: Log in as "Anonymous user" Given I am not logged in When I visit "/clouds" Then I should be on "/user/login" And I should see the heading "Log in" Scenario Outline: Access cloud service providers Given I am logged in as a user with the <role> role And I should not see the link "All" in the "nav_bar" And I should <verb> "Add cloud service provider" in the "nav_bar" When I go to "/clouds" Then I should be on "/admin/structure/cloud_config/add" And I should get a <code> HTTP response And I should see the heading <heading> Examples: | role | verb | code | heading | | "Authenticated user" | not see | 403 | "Access denied" | | "Cloud administrator" | see | 200 | "Add cloud service provider" | | "Administrator" | see | 200 | "Add cloud service provider" |
  • 58. Behat (Gherkin) Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 58 Feature: Login, Check the Clean State, and Logout In order to list resources on the clean state As a user I need to have both Drupal and AWS IAM permissions Scenario: Log in as "Anonymous user" Given I am not logged in When I visit "/clouds" Then I should be on "/user/login" And I should see the heading "Log in" Scenario Outline: Access cloud service providers Given I am logged in as a user with the <role> role And I should not see the link "All" in the "nav_bar" And I should <verb> "Add cloud service provider" in the "nav_bar" When I go to "/clouds" Then I should be on "/admin/structure/cloud_config/add" And I should get a <code> HTTP response And I should see the heading <heading> Examples: | role | verb | code | heading | | "Authenticated user" | not see | 403 | "Access denied" | | "Cloud administrator" | see | 200 | "Add cloud service provider" | | "Administrator" | see | 200 | "Add cloud service provider" |
  • 59. Behat (Gherkin) Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 59 Feature: Login, Check the Clean State, and Logout In order to list resources on the clean state As a user I need to have both Drupal and AWS IAM permissions Scenario: Log in as "Anonymous user" Given I am not logged in When I visit "/clouds" Then I should be on "/user/login" And I should see the heading "Log in" Scenario Outline: Access cloud service providers Given I am logged in as a user with the <role> role And I should not see the link "All" in the "nav_bar" And I should <verb> "Add cloud service provider" in the "nav_bar" When I go to "/clouds" Then I should be on "/admin/structure/cloud_config/add" And I should get a <code> HTTP response And I should see the heading <heading> Examples: | role | verb | code | heading | | "Authenticated user" | not see | 403 | "Access denied" | | "Cloud administrator" | see | 200 | "Add cloud service provider" | | "Administrator" | see | 200 | "Add cloud service provider" |
  • 60. Behat (Gherkin) Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 60 Feature: Login, Check the Clean State, and Logout In order to list resources on the clean state As a user I need to have both Drupal and AWS IAM permissions Scenario: Log in as "Anonymous user" Given I am not logged in When I visit "/clouds" Then I should be on "/user/login" And I should see the heading "Log in" Scenario Outline: Access cloud service providers Given I am logged in as a user with the <role> role And I should not see the link "All" in the "nav_bar" And I should <verb> "Add cloud service provider" in the "nav_bar" When I go to "/clouds" Then I should be on "/admin/structure/cloud_config/add" And I should get a <code> HTTP response And I should see the heading <heading> Examples: | role | verb | code | heading | | "Authenticated user" | not see | 403 | "Access denied" | | "Cloud administrator" | see | 200 | "Add cloud service provider" | | "Administrator" | see | 200 | "Add cloud service provider" |
  • 61. Behat (Gherkin) Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 61 Feature: Login, Check the Clean State, and Logout In order to list resources on the clean state As a user I need to have both Drupal and AWS IAM permissions Scenario: Log in as "Anonymous user" Given I am not logged in When I visit "/clouds" Then I should be on "/user/login" And I should see the heading "Log in" Scenario Outline: Access cloud service providers Given I am logged in as a user with the <role> role And I should not see the link "All" in the "nav_bar" And I should <verb> "Add cloud service provider" in the "nav_bar" When I go to "/clouds" Then I should be on "/admin/structure/cloud_config/add" And I should get a <code> HTTP response And I should see the heading <heading> Examples: | role | verb | code | heading | | "Authenticated user" | not see | 403 | "Access denied" | | "Cloud administrator" | see | 200 | "Add cloud service provider" | | "Administrator" | see | 200 | "Add cloud service provider" |
  • 62. Behat (Gherkin) Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 62 Feature: Login, Check the Clean State, and Logout In order to list resources on the clean state As a user I need to have both Drupal and AWS IAM permissions Scenario: Log in as "Anonymous user" Given I am not logged in When I visit "/clouds" Then I should be on "/user/login" And I should see the heading "Log in" Scenario Outline: Access cloud service providers Given I am logged in as a user with the <role> role And I should not see the link "All" in the "nav_bar" And I should <verb> "Add cloud service provider" in the "nav_bar" When I go to "/clouds" Then I should be on "/admin/structure/cloud_config/add" And I should get a <code> HTTP response And I should see the heading <heading> Examples: | role | verb | code | heading | | "Authenticated user" | not see | 403 | "Access denied" | | "Cloud administrator" | see | 200 | "Add cloud service provider" | | "Administrator" | see | 200 | "Add cloud service provider" |
  • 63. Behat (Gherkin) Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 63 Feature: Login, Check the Clean State, and Logout In order to list resources on the clean state As a user I need to have both Drupal and AWS IAM permissions Scenario: Log in as "Anonymous user" Given I am not logged in When I visit "/clouds" Then I should be on "/user/login" And I should see the heading "Log in" Scenario Outline: Access cloud service providers Given I am logged in as a user with the <role> role And I should not see the link "All" in the "nav_bar" And I should <verb> "Add cloud service provider" in the "nav_bar" When I go to "/clouds" Then I should be on "/admin/structure/cloud_config/add" And I should get a <code> HTTP response And I should see the heading <heading> Examples: | role | verb | code | heading | | "Authenticated user" | not see | 403 | "Access denied" | | "Cloud administrator" | see | 200 | "Add cloud service provider" | | "Administrator" | see | 200 | "Add cloud service provider" |
  • 64. Behat (Gherkin) Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 64 Feature: Login, Check the Clean State, and Logout In order to list resources on the clean state As a user I need to have both Drupal and AWS IAM permissions Scenario: Log in as "Anonymous user" Given I am not logged in When I visit "/clouds" Then I should be on "/user/login" And I should see the heading "Log in" Scenario Outline: Access cloud service providers Given I am logged in as a user with the <role> role And I should not see the link "All" in the "nav_bar" And I should <verb> "Add cloud service provider" in the "nav_bar" When I go to "/clouds" Then I should be on "/admin/structure/cloud_config/add" And I should get a <code> HTTP response And I should see the heading <heading> Examples: | role | verb | code | heading | | "Authenticated user" | not see | 403 | "Access denied" | | "Cloud administrator" | see | 200 | "Add cloud service provider" | | "Administrator" | see | 200 | "Add cloud service provider" | Initial State / Condition
  • 65. Behat (Gherkin) Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 65 Feature: Login, Check the Clean State, and Logout In order to list resources on the clean state As a user I need to have both Drupal and AWS IAM permissions Scenario: Log in as "Anonymous user" Given I am not logged in When I visit "/clouds" Then I should be on "/user/login" And I should see the heading "Log in" Scenario Outline: Access cloud service providers Given I am logged in as a user with the <role> role And I should not see the link "All" in the "nav_bar" And I should <verb> "Add cloud service provider" in the "nav_bar" When I go to "/clouds" Then I should be on "/admin/structure/cloud_config/add" And I should get a <code> HTTP response And I should see the heading <heading> Examples: | role | verb | code | heading | | "Authenticated user" | not see | 403 | "Access denied" | | "Cloud administrator" | see | 200 | "Add cloud service provider" | | "Administrator" | see | 200 | "Add cloud service provider" | Action Take Place
  • 66. Behat (Gherkin) Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 66 Feature: Login, Check the Clean State, and Logout In order to list resources on the clean state As a user I need to have both Drupal and AWS IAM permissions Scenario: Log in as "Anonymous user" Given I am not logged in When I visit "/clouds" Then I should be on "/user/login" And I should see the heading "Log in" Scenario Outline: Access cloud service providers Given I am logged in as a user with the <role> role And I should not see the link "All" in the "nav_bar" And I should <verb> "Add cloud service provider" in the "nav_bar" When I go to "/clouds" Then I should be on "/admin/structure/cloud_config/add" And I should get a <code> HTTP response And I should see the heading <heading> Examples: | role | verb | code | heading | | "Authenticated user" | not see | 403 | "Access denied" | | "Cloud administrator" | see | 200 | "Add cloud service provider" | | "Administrator" | see | 200 | "Add cloud service provider" | Expected Result
  • 67. Can I use parameters? 67
  • 68. I want to use parameters in scenarios! Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 68 Feature: Login, Check the Clean State, and Logout In order to list resources on the clean state As a user I need to have both Drupal and AWS IAM permissions Scenario: Log in as "Anonymous user" Given I am not logged in When I visit "/clouds" Then I should be on "/user/login" And I should see the heading "Log in" Scenario Outline: Access cloud service providers Given I am logged in as a user with the <role> role And I should not see the link "All" in the "nav_bar" And I should <verb> "Add cloud service provider" in the "nav_bar" When I go to "/clouds" Then I should be on "/admin/structure/cloud_config/add" And I should get a <code> HTTP response And I should see the heading <heading> Examples: | role | verb | code | heading | | "Authenticated user" | not see | 403 | "Access denied" | | "Cloud administrator" | see | 200 | "Add cloud service provider" | | "Administrator" | see | 200 | "Add cloud service provider" |
  • 69. I want to use parameters in scenarios! Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 69 Feature: Login, Check the Clean State, and Logout In order to list resources on the clean state As a user I need to have both Drupal and AWS IAM permissions Scenario: Log in as "Anonymous user" Given I am not logged in When I visit "/clouds" Then I should be on "/user/login" And I should see the heading "Log in" Scenario Outline: Access cloud service providers Given I am logged in as a user with the <role> role And I should not see the link "All" in the "nav_bar" And I should <verb> "Add cloud service provider" in the "nav_bar" When I go to "/clouds" Then I should be on "/admin/structure/cloud_config/add" And I should get a <code> HTTP response And I should see the heading <heading> Examples: | role | verb | code | heading | | "Authenticated user" | not see | 403 | "Access denied" | | "Cloud administrator" | see | 200 | "Add cloud service provider" | | "Administrator" | see | 200 | "Add cloud service provider" |
  • 70. I want to use parameters in scenarios! Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 70 Feature: Login, Check the Clean State, and Logout In order to list resources on the clean state As a user I need to have both Drupal and AWS IAM permissions Scenario: Log in as "Anonymous user" Given I am not logged in When I visit "/clouds" Then I should be on "/user/login" And I should see the heading "Log in" Scenario Outline: Access cloud service providers Given I am logged in as a user with the <role> role And I should not see the link "All" in the "nav_bar" And I should <verb> "Add cloud service provider" in the "nav_bar" When I go to "/clouds" Then I should be on "/admin/structure/cloud_config/add" And I should get a <code> HTTP response And I should see the heading <heading> Examples: | role | verb | code | heading | | "Authenticated user" | not see | 403 | "Access denied" | | "Cloud administrator" | see | 200 | "Add cloud service provider" | | "Administrator" | see | 200 | "Add cloud service provider" |
  • 71. I want to use parameters in scenarios! Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 71 Feature: Login, Check the Clean State, and Logout In order to list resources on the clean state As a user I need to have both Drupal and AWS IAM permissions Scenario: Log in as "Anonymous user" Given I am not logged in When I visit "/clouds" Then I should be on "/user/login" And I should see the heading "Log in" Scenario Outline: Access cloud service providers Given I am logged in as a user with the <role> role And I should not see the link "All" in the "nav_bar" And I should <verb> "Add cloud service provider" in the "nav_bar" When I go to "/clouds" Then I should be on "/admin/structure/cloud_config/add" And I should get a <code> HTTP response And I should see the heading <heading> Examples: | role | verb | code | heading | | "Authenticated user" | not see | 403 | "Access denied" | | "Cloud administrator" | see | 200 | "Add cloud service provider" | | "Administrator" | see | 200 | "Add cloud service provider" |
  • 72. How it works by natural language? 72
  • 73. The Tricks Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 73 /** * Log in as the existing user * * @Given I am logged in as user :name */ public function iAmLoggedInAsUser($name): void { $user = user_load_by_name($name); $this->getSession()->visit(user_pass_reset_url($user) . '/login'); }
  • 74. The Tricks Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 74 /** * Log in as the existing user * * @Given I am logged in as user :name */ public function iAmLoggedInAsUser($name): void { $user = user_load_by_name($name); $this->getSession()->visit(user_pass_reset_url($user) . '/login'); } Sentence
  • 75. The Tricks Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 75 /** * Log in as the existing user * * @Given I am logged in as user :name */ public function iAmLoggedInAsUser($name): void { $user = user_load_by_name($name); $this->getSession()->visit(user_pass_reset_url($user) . '/login'); } Parameter Variable
  • 76. The Tricks Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 76 /** * Check if the current page contains no messages of the specified selector. * * @Then /^I should see no (?P<selector>(?:success|error|warning)) message$/ */ public function assertSelectorNotVisible($selector): void { switch ($selector) { case 'success': $selector_id = 'success_message_selector'; break; case 'error': $selector_id = 'error_message_selector'; break; case 'warning': $selector_id = 'warning_message_selector'; break; default: throw new ExpectationException(sprintf("Message type is invalid: %s", $selector), $this->getSession()->getDriver()); } $this->assertNotVisible($selector_id); } Regular Expression
  • 77. Predefined Scenario List: behat -dl • Given I am an anonymous user • Given I am not logged in • Given I am logged in as a user with the :role role(s) • Given I am logged in as a/an :role • Given I am logged in as a user with the :role role(s) and I have the following fields: • Given I am logged in as :name • Given I am logged in as a user with the :permissions permission(s) • Given I click :link in the :rowText row • Given the cache has been cleared • Given I run cron • Given I am viewing a/an :type (content )with the title :title • Given a/an :type (content )with the title :title • Given I am viewing my :type (content )with the title :title • Given :type content: • Given I am viewing a/an :type( content): • Given I am viewing a/an :vocabulary term with the name :name • Given a/an :vocabulary term with the name :name • Given users: • Given :vocabulary terms: • Given the/these (following )languages are available: • Given I am logged in as user :name • Given I am at :path • Given for :field I enter :value • Given I enter :value for :field • Given I wait for AJAX to finish • Given I press the :char key in the :field field • Given I press :button in the :region( region) • Given I fill in :value for :field in the :region( region) • Given I fill in :field with :value in the :region( region) • Given I check the box :checkbox • Given I uncheck the box :checkbox • Given /^(?:|I )am on (?:|the )homepage$/ • Given /^(?:|I )am on "(?P<page>[^"]+)"$/ • Given I should not see the error message( containing) :message • Given I should not see the success message( containing) :message • Given I should not see the warning message( containing) :message • Given I run drush :command • Given I run drush :command :arguments • Given /^I wait for the batch job to finish$/ • Given there is an item in the system queue: • When I wait :msec milliseconds • When I check the box in the :rowText row • When I fill in :value for :field in the row :row in the :region( region) • When I follow/click :link in a row with :value set in :field in the :region( region) • When I visit :path • When I click :link • When /^(?:|I )press "(?P<button>(?:[^"]|")*)"$/ • When I press the :button button • When I follow/click :link in the :region( region) • When I select the radio button :label with the id :id • When I select the radio button :label • When /^(?:|I )go to (?:|the )homepage$/ • When /^(?:|I )go to "(?P<page>[^"]+)"$/ • When /^(?:|I )reload the page$/ • When /^(?:|I )move backward one page$/ • When /^(?:|I )move forward one page$/ • When /^(?:|I )follow "(?P<link>(?:[^"]|")*)"$/ • When /^(?:|I )fill in "(?P<field>(?:[^"]|")*)" with "(?P<value>(?:[^"]|")*)"$/ • When /^(?:|I )fill in "(?P<field>(?:[^"]|")*)" with:$/ • When /^(?:|I )fill in "(?P<value>(?:[^"]|")*)" for "(?P<field>(?:[^"]|")*)"$/ • When /^(?:|I )fill in the following:$/ • When /^(?:|I )select "(?P<option>(?:[^"]|")*)" from "(?P<select>(?:[^"]|")*)"$/ • When /^(?:|I )additionally select "(?P<option>(?:[^"]|")*)" from "(?P<select>(?:[^"]|")*)"$/ • When /^(?:|I )check "(?P<option>(?:[^"]|")*)"$/ • When /^(?:|I )uncheck "(?P<option>(?:[^"]|")*)"$/ • When /^(?:|I )attach the file "(?P<path>[^"]*)" to "(?P<field>(?:[^"]|")*)"$/ • Then I log out • Then I should see (the text ):text in the :rowText row • Then I should not see (the text ):text in the :rowText row • Then I (should )see the :link in the :rowText row • Then I should be able to edit a/an :type( content) • Then (I )break • Then I should see (the text ):text1 or :text2 in the :rowText row • Then I should see (the text ):text in the :rowText row in the :region( region) • Then I take screenshot • Then I should see the link :link • Then I should not see the link :link • Then I should not visibly see the link :link • Then I (should )see the heading :heading • Then I (should )not see the heading :heading • Then I (should ) see the button :button • Then I (should ) see the :button button • Then I should not see the button :button • Then I should not see the :button button • Then I should see the heading :heading in the :region( region) • Then I should see the :heading heading in the :region( region) • Then I should see the link :link in the :region( region) • Then I should not see the link :link in the :region( region) • Then I should see( the text) :text in the :region( region) • Then I should not see( the text) :text in the :region( region) • Then I (should )see the text :text • Then I should not see the text :text • Then I should get a :code HTTP response • Then I should not get a :code HTTP response • Then /^(?:|I )should be on "(?P<page>[^"]+)"$/ • Then /^(?:|I )should be on (?:|the )homepage$/ • Then /^the (?i)url(?-i) should match (?P<pattern>"(?:[^"]|")*")$/ • Then /^the response status code should be (?P<code>d+)$/ • Then /^the response status code should not be (?P<code>d+)$/ • Then /^(?:|I )should see "(?P<text>(?:[^"]|")*)"$/ Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 77 • Then /^(?:|I )should not see "(?P<text>(?:[^"]|")*)"$/ • Then /^(?:|I )should see text matching (?P<pattern>"(?:[^"]|")*")$/ • Then /^(?:|I )should not see text matching (?P<pattern>"(?:[^"]|")*")$/ • Then /^the response should contain "(?P<text>(?:[^"]|")*)"$/ • Then /^the response should not contain "(?P<text>(?:[^"]|")*)"$/ • Then /^(?:|I )should see "(?P<text>(?:[^"]|")*)" in the "(?P<element>[^"]*)" element$/ • Then /^(?:|I )should not see "(?P<text>(?:[^"]|")*)" in the "(?P<element>[^"]*)" element$/ • Then /^the "(?P<element>[^"]*)" element should contain "(?P<value>(?:[^"]|")*)"$/ • Then /^the "(?P<element>[^"]*)" element should not contain "(?P<value>(?:[^"]|")*)"$/ • Then /^(?:|I )should see an? "(?P<element>[^"]*)" element$/ • Then /^(?:|I )should not see an? "(?P<element>[^"]*)" element$/ • Then /^the "(?P<field>(?:[^"]|")*)" field should contain "(?P<value>(?:[^"]|")*)"$/ • Then /^the "(?P<field>(?:[^"]|")*)" field should not contain "(?P<value>(?:[^"]|")*)"$/ • Then /^(?:|I )should see (?P<num>d+) "(?P<element>[^"]*)" elements?$/ • Then /^the "(?P<checkbox>(?:[^"]|")*)" checkbox should be checked$/ • Then /^the "(?P<checkbox>(?:[^"]|")*)" checkbox is checked$/ • Then /^the checkbox "(?P<checkbox>(?:[^"]|")*)" (?:is|should be) checked$/ • Then /^the "(?P<checkbox>(?:[^"]|")*)" checkbox should (?:be unchecked|not be checked)$/ • Then /^the "(?P<checkbox>(?:[^"]|")*)" checkbox is (?:unchecked|not checked)$/ • Then /^the checkbox "(?P<checkbox>(?:[^"]|")*)" should (?:be unchecked|not be checked)$/ • Then /^the checkbox "(?P<checkbox>(?:[^"]|")*)" is (?:unchecked|not checked)$/ • Then /^print current URL$/ • Then /^print last response$/ • Then /^show last response$/ • Then I should see the error message( containing) :message • Then I should see the following error message(s): • Then I should not see the following error messages: • Then I should see the success message( containing) :message • Then I should see the following success messages: • Then I should not see the following success messages: • Then I should see the warning message( containing) :message • Then I should see the following warning messages: • Then I should not see the following warning messages: • Then I should see the message( containing) :message • Then I should not see the message( containing) :message • Then /^I should see no (?P<selector>(?:success|error|warning)) message$/ • Then I should see neither error nor warning messages • Then drush output should contain :output • Then drush output should match :regex • Then drush output should not contain :output • Then print last drush output • Then I should see the button :button in the :region( region) • Then I should see the :button button in the :region( region) • Then I should not see the button :button in the :region( region) • Then I should not see the :button button in the :region( region) • Then I( should) see the :tag element in the :region( region) • Then I( should) not see the :tag element in the :region( region) • Then I( should) not see :text in the :tag element in the :region( region) • Then I( should) see the :tag element with the :attribute attribute set to :value in the :region( region) • Then I( should) see :text in the :tag element with the :attribute attribute set to :value in the :region( region) • Then I( should) see :text in the :tag element with the :property CSS property set to :value in the :region( region)
  • 78. But scenario outline is not enough! 78
  • 79. I want to use parameters for everything! Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 79 Scenario Outline: Launch an EC2 instance Given I am logged in as user "{{ user_name }}" When I visit "/clouds/design/server_template/" And I click <instance_name>{{ cloud_context }} And I click "Launch" And the url should match "/launch" And I check the box "Automatically terminate instance" And I press "Launch" Then I should be on "/clouds/aws_cloud/{{ cloud_context }}/instance" And I should see "pending" in the <instance_name> row And I should see <instance_type> in the <instance_name> row And I should see "{{ availability_zone }}" in the <instance_name> row Examples: | instance_name | instance_type | | "{{ instance_name_1 }}" | "{{ instance_type_1 }}" | | "{{ instance_name_2 }}" | "{{ instance_type_2 }}" |
  • 80. I want to use parameters for everything! Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 80 Scenario Outline: Launch an EC2 instance Given I am logged in as user "{{ user_name }}" When I visit "/clouds/design/server_template/" And I click <instance_name>{{ cloud_context }} And I click "Launch" And the url should match "/launch" And I check the box "Automatically terminate instance" And I press "Launch" Then I should be on "/clouds/aws_cloud/{{ cloud_context }}/instance" And I should see "pending" in the <instance_name> row And I should see <instance_type> in the <instance_name> row And I should see "{{ availability_zone }}" in the <instance_name> row Examples: | instance_name | instance_type | | "{{ instance_name_1 }}" | "{{ instance_type_1 }}" | | "{{ instance_name_2 }}" | "{{ instance_type_2 }}" | Twig Template!
  • 82. Get Parameterized Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 82
  • 83. Get Parameterized Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 83 docker build
  • 84. Get Parameterized Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 84 docker build RUN composer require drupal/cloud drupal/drupal-extension ...
  • 85. Get Parameterized Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 85 Packagist: drupal/cloud_orchestrator incl. drupal/cloud Feature: ... Scenario Outline: ... Examples: docker build RUN composer require drupal/cloud drupal/drupal-extension ... << Download >>
  • 86. Get Parameterized Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 86 docker run docomoinnovations/cloud_orchestrator Packagist: drupal/cloud_orchestrator incl. drupal/cloud Feature: ... Scenario Outline: ... Examples: docker build RUN composer require drupal/cloud drupal/drupal-extension ... << Download >> << docker run >>
  • 87. Get Parameterized Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 87 docker run docomoinnovations/cloud_orchestrator Run drush cloud:behat:preprocess • Read a YAML file whih contains parameter mappings • Replace {{...}} as an input variable Packagist: drupal/cloud_orchestrator incl. drupal/cloud Feature: ... Scenario Outline: ... Examples: docker build RUN composer require drupal/cloud drupal/drupal-extension ... << Download >> << docker run >>
  • 88. Get Parameterized Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 88 docker run docomoinnovations/cloud_orchestrator Run drush cloud:behat:preprocess • Read a YAML file whih contains parameter mappings • Replace {{...}} as an input variable private_params.yml e.g. This is a placeholder: Cloud Orchestrator Packagist: drupal/cloud_orchestrator incl. drupal/cloud Feature: ... Scenario Outline: ... Examples: docker build RUN composer require drupal/cloud drupal/drupal-extension ... << Read parameter files>> << Download >> << docker run >>
  • 89. Get Parameterized Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 89 docker run docomoinnovations/cloud_orchestrator Run drush cloud:behat:preprocess • Read a YAML file whih contains parameter mappings • Replace {{...}} as an input variable Feature: ... Scenario Outline: ... ...<This is a placeholder>... Examples: | This is a placeholder | | {{This is a placeholder}} | private_params.yml e.g. This is a placeholder: Cloud Orchestrator Packagist: drupal/cloud_orchestrator incl. drupal/cloud Feature: ... Scenario Outline: ... Examples: docker build RUN composer require drupal/cloud drupal/drupal-extension ... << Read parameter files>> << Read Feature template files>> << Download >> << docker run >>
  • 90. Get Parameterized Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 90 docker run docomoinnovations/cloud_orchestrator Run drush cloud:behat:preprocess • Read a YAML file whih contains parameter mappings • Replace {{...}} as an input variable Feature: ... Scenario Outline: ... ...<This is a placeholder>... Examples: | This is a placeholder | | {{This is a placeholder}} | private_params.yml e.g. This is a placeholder: Cloud Orchestrator Feature: ... Scenario Outline: ... ...<This is a placeholder>... Examples: | This is a placeholder | | Cloud Orchestrator | Packagist: drupal/cloud_orchestrator incl. drupal/cloud Feature: ... Scenario Outline: ... Examples: docker build RUN composer require drupal/cloud drupal/drupal-extension ... << Read parameter files>> << Read Feature template files>> << Output actual feature files>> << Download >> << docker run >>
  • 91. Get Parameterized Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 91 docker run docomoinnovations/cloud_orchestrator Run drush cloud:behat:preprocess • Read a YAML file whih contains parameter mappings • Replace {{...}} as an input variable Run behat command run_behat.sh Feature: ... Scenario Outline: ... ...<This is a placeholder>... Examples: | This is a placeholder | | {{This is a placeholder}} | private_params.yml e.g. This is a placeholder: Cloud Orchestrator Feature: ... Scenario Outline: ... ...<This is a placeholder>... Examples: | This is a placeholder | | Cloud Orchestrator | Packagist: drupal/cloud_orchestrator incl. drupal/cloud Feature: ... Scenario Outline: ... Examples: docker build RUN composer require drupal/cloud drupal/drupal-extension ... << Read parameter files>> << Read Feature template files>> << Output actual feature files>> << Read feature files>> << Download >> << docker run >>
  • 92. Get Parameterized Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 92 docker run docomoinnovations/cloud_orchestrator Run drush cloud:behat:preprocess • Read a YAML file whih contains parameter mappings • Replace {{...}} as an input variable Run behat command run_behat.sh Feature: ... Scenario Outline: ... ...<This is a placeholder>... Examples: | This is a placeholder | | {{This is a placeholder}} | private_params.yml e.g. This is a placeholder: Cloud Orchestrator Feature: ... Scenario Outline: ... ...<This is a placeholder>... Examples: | This is a placeholder | | Cloud Orchestrator | Execute BDD tests and get Output Packagist: drupal/cloud_orchestrator incl. drupal/cloud Feature: ... Scenario Outline: ... Examples: docker build RUN composer require drupal/cloud drupal/drupal-extension ... << Process features >> << Read parameter files>> << Read Feature template files>> << Output actual feature files>> << Read feature files>> << docker run >> << Download >>
  • 94. We Test Our Code Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 94
  • 95. We Want This One! Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 95
  • 96. GitLab CI/CD Pipeline Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 96
  • 97. GitLab CI/CD Pipeline Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 97
  • 98. GitLab CI/CD Pipeline Architecture Basics Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 98
  • 99. Developer GitLab CI/CD Pipeline Architecture Basics Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 99
  • 100. Developer GitLab CI/CD Pipeline Architecture Basics GitLab Master Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 100
  • 101. GitLab Master GitLab Runner Developer GitLab CI/CD Pipeline Architecture Basics Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 101
  • 102. GitLab Master GitLab Repository Developer GitLab CI/CD Pipeline Architecture Basics GitLab Runner Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 102
  • 103. GitLab Master CI/CD Pipeline GitLab Repository Developer GitLab CI/CD Pipeline Architecture Basics GitLab Runner Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 103
  • 104. GitLab Master GitLab Runner CI/CD Pipeline GitLab Repository Developer gitlab-runner 1 gitlab-runner 2 … gitlab-runner N GitLab CI/CD Pipeline Architecture Basics Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 104
  • 105. GitLab Master GitLab Runner GitLab Container Registry CI/CD Pipeline GitLab Repository Developer GitLab CI/CD Pipeline Architecture Basics Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 105 gitlab-runner 1 gitlab-runner 2 … gitlab-runner N
  • 106. GitLab Master GitLab Runner CI/CD Pipeline GitLab Repository Developer GitLab CI/CD Pipeline Architecture Basics GitLab Container Registry Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 106 gitlab-runner 1 gitlab-runner 2 … gitlab-runner N
  • 107. GitLab Master GitLab Runner CI/CD Pipeline GitLab Repository Developer GitLab CI/CD Pipeline Architecture Basics GitLab Container Registry Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 107 gitlab-runner 1 gitlab-runner 2 … gitlab-runner N
  • 108. GitLab Master GitLab Runner CI/CD Pipeline GitLab Repository Developer GitLab CI/CD Pipeline Architecture Basics GitLab Container Registry Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 108 gitlab-runner 1 gitlab-runner 2 … gitlab-runner N
  • 109. GitLab Master GitLab Runner CI/CD Pipeline GitLab Repository Developer GitLab CI/CD Pipeline Architecture Basics GitLab Container Registry Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 109 gitlab-runner 1 gitlab-runner 2 … gitlab-runner N
  • 110. EC2 Our GitLab CI/CD Pipeline Architecture GitLab Master (SaaS) CI/CD Pipeline GitLab Repository Developer Slack GitLab Container Registry Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 110 gitlab-runner 1 gitlab-runner 2 gitlab-runner 3 gitlab-runner 4
  • 111. Slack Integration Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 111
  • 112. How can we build CI/CD pipeline? 112
  • 113. .gitlab-ci.yml Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 113 stages: - run_tests - .post variables: UPDATE: 20220408a WEB_ROOT: '/var/www/html/web' CLOUD_HOME: "${WEB_ROOT}/modules/contrib/cloud" BROWSER_OUTPUT: "${WEB_ROOT}/sites/simpletest/browser_output/" IMAGE_TAG: 9.4.x-arm64 .preprocess_template: &preprocess_definition image: name: "${CI_REGISTRY_IMAGE}:${IMAGE_TAG}" stage: run_tests only: - branches # - merge_requests before_script: | whoami sudo service apache2 start sudo service memcached start sudo mkdir -p "${WEB_ROOT}/simpletest/${CI_PIPELINE_ID}" sudo mount -t tmpfs -o size=8G tmpfs "${WEB_ROOT}/simpletest/${CI_PIPELINE_ID}" sudo chmod 777 -R "${WEB_ROOT}/simpletest" rm -rf "${CLOUD_HOME}" && cp -ar "${PWD}" "${CLOUD_HOME}” .artifacts_template: &postprocess_definition after_script: | mkdir -p "${BROWSER_OUTPUT}" if [ -d "${BROWSER_OUTPUT}" ]; then cp -ar "${BROWSER_OUTPUT}" "${CI_PROJECT_DIR}/"; else mkdir -p "${BROWSER_OUTPUT}" && touch "${BROWSER_OUTPUT}/NO_ARTIFACTS.txt"; fi php -v drush status ...
  • 114. .gitlab-ci.yml • Describe the pipeline definition in one YAML file • Put root (top) directory of your branch • Get started – https://docs.gitlab.com/ee/ci/quick_start/ Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 114
  • 115. Demo Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 115 • Behat • GitLab CI/CD Pipeline
  • 116. Lessons That We Learned 116
  • 117. Our Custom Extension to drupal-extension 1. Logged in as the existing user without password – Using drush user:login 2. Take a screenshot, which is very useful in troubleshooting – Not only with Selenium + @javascript, but Chrome Extension or w/o @javascript 3. Specifying a region with the row index of a table – Especially when the same labels are used in multiple rows 4. Assert only the success message shows – Namely, neither error or warning messages show 117 Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved.
  • 118. Our Custom Extension to drupal-extension 118 Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 1. Logged in as the existing user without password – Using drush user:login 2. Take a screenshot, which is very useful in troubleshooting – Not only with Selenium + @javascript, but Chrome Extension or w/o @javascript annotation 3. Specifying a region with the row index of a table – Especially when the same labels are used in multiple rows 4. Assert only the success message shows – Namely, neither error or warning messages show
  • 119. 1. Logged in as the existing user without password – Using drush user:login 2. Take a screenshot, which is very useful in troubleshooting – Not only with Selenium + @javascript, but Chrome Extension or w/o @javascript annotation 3. Specifying a region with the row index of a table – Especially when the same labels are used in multiple rows 4. Assert only the success message shows – Namely, neither error or warning messages show Our Custom Extension to drupal-extension 119 Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved.
  • 120. 1. Logged in as the existing user without password – Using drush user:login 2. Take a screenshot, which is very useful in troubleshooting – Not only with Selenium + @javascript, but Chrome Extension or w/o @javascript annotation 3. Specifying a region with the row index of a table – Especially when the same labels are used in multiple rows 4. Assert only the success message shows – Namely, neither error or warning messages show Our Custom Extension to drupal-extension 120 Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved.
  • 121. Our Custom Extension to drupal-extension 121 Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 1. Logged in as the existing user without password – Using drush user:login 2. Take a screenshot, which is very useful in troubleshooting – Not only with Selenium + @javascript, but Chrome Extension or w/o @javascript annotation 3. Specifying a region with the row index of a table – Especially when the same labels are used in multiple rows 4. Assert only the success message shows – Namely, neither error or warning messages show
  • 122. Known Issues: Solutions 1. User login sometimes fails due to "Username" is not found – Workaround: add a longer sleep after chromium started 2. The text in checkbox/link is visible, but not ready to be clicked – Add 500 ms sleep before such action 3. Cannot distinguish DOM objects if the same text are set – For the table rows 4. Cannot login with a role created in the same Behat process – Workaround: divide a feature file to run Behat for each – Avoid using login with such role 122 Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved.
  • 124. Where to Find Our Solutions 124 • Behat feature files & configurations – https://git.drupalcode.org/project/cloud/-/tree/5.x/tests/src/Behat – https://git.drupalcode.org/project/cloud/-/tree/5.x/modules/cloud_service_providers/aws_cloud/tests/src/Behat – https://git.drupalcode.org/project/cloud/-/tree/5.x/modules/cloud_service_providers/k8s/tests/src/Behat • Drupal extensions with our custom functions – https://github.com/docomoinnovations/drupalextension Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved.
  • 125. Resources 125 • Cloud Orchestrator – https://drupal.org/project/cloud – https://cloud.airgap.host • YouTube Channel – https://bit.ly/2TJssME Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved.
  • 126. 126 Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. Thank you! "Coming together is a beginning, keeping together is a progress; working together is a success.“ - Henry Ford @yas linkedin.com/in/yasnaoi