Automate Behavior-driven Development
Yas Naoi
Chief Architect, Cloud
DOCOMO Innovatins, Inc.
Yas
2
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved.
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
But scenario outline is not enough!
77
I want to use parameters for everything!
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 78
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. 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 }}" |
Twig Template!
Get Parameterized
80
Get Parameterized
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 81
Get Parameterized
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 82
docker build
Get Parameterized
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 83
docker build
RUN composer require 
drupal/cloud 
drupal/drupal-extension
...
Get Parameterized
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 84
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. 85
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. 86
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. 87
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. 88
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. 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
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. 90
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. 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 |
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
92
We Test Our Code
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 93
We Want This One!
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 94
GitLab CI/CD Pipeline
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 Architecture Basics
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 97
Developer
GitLab CI/CD Pipeline Architecture Basics
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 98
Developer
GitLab CI/CD Pipeline Architecture Basics
GitLab Master
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 99
GitLab Master GitLab Runner
Developer
GitLab CI/CD Pipeline Architecture Basics
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 100
GitLab Master
GitLab
Repository
Developer
GitLab CI/CD Pipeline Architecture Basics
GitLab Runner
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 101
GitLab Master
CI/CD
Pipeline
GitLab
Repository
Developer
GitLab CI/CD Pipeline Architecture Basics
GitLab Runner
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 102
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. 103
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. 104
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. 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
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. 109
gitlab-runner 1
gitlab-runner 2
gitlab-runner 3
gitlab-runner 4
Slack Integration
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 110
How we can build CI/CD pipeline?
111
.gitlab-ci.yml
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 112
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. 113
Demo
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 114
• Behat
• GitLab CI/CD Pipeline
Lessons That We Learned
115
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
116
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved.
Our Custom Extension to drupal-extension
117
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
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
Our Custom Extension to drupal-extension
119
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved.
Our Custom Extension to drupal-extension
120
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
121
Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved.
Resources
122
Where to Find Our Solutions
123
• 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
124
• 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.
Coming together is a beginning,
keeping together is a progress;
working together is a success.
Henry Ford
“ “

More Related Content

PDF
Java EEを補完する仕様 MicroProfile
PPTX
Kubernetes 101
PPTX
Why to Cloud Native
PPTX
CAF presentation 09 16-2020
PDF
DevSecOps Implementation Journey
PDF
Design patterns for microservice architecture
PPTX
Kubernetes
PDF
7 Things You Need to Know for Your Cloud-First Strategy
Java EEを補完する仕様 MicroProfile
Kubernetes 101
Why to Cloud Native
CAF presentation 09 16-2020
DevSecOps Implementation Journey
Design patterns for microservice architecture
Kubernetes
7 Things You Need to Know for Your Cloud-First Strategy

What's hot (20)

PPTX
Cloud workload migration guidelines
PDF
EC2でkeepalived+LVS(DSR)
PPTX
「実践ドメイン駆動設計」社内読書会まとめ ~IDDD本難民に捧げる1章から7章~
PDF
20200804 AWS Black Belt Online Seminar Amazon CodeGuru
PDF
AWS Black Belt Online Seminar 2018 AWS上の位置情報
PDF
MySQL High Availability with Group Replication
PDF
AWS Well-Architected Security とベストプラクティス
PDF
The Twelve-Factor Appで考えるAWSのサービス開発
PDF
ソフトウェアの核心にある複雑さに立ち向かう
PPTX
Cloud Native: what is it? Why?
PPTX
What is Cloud Native Explained?
PPTX
DevSecops: Defined, tools, characteristics, tools, frameworks, benefits and c...
PPTX
App Modernization with Microsoft Azure
PDF
Virtual Private Cloud
PDF
ドメイン駆動設計とは何か 【入門編】
PDF
Kubernetes architecture
PDF
DSDM Frameworks for Agile Project Management Offices
PDF
Salvatore Sanfilippo – How Redis Cluster works, and why - NoSQL matters Barce...
PDF
The Need of Cloud-Native Application
PDF
도커 무작정 따라하기: 도커가 처음인 사람도 60분이면 웹 서버를 올릴 수 있습니다!
Cloud workload migration guidelines
EC2でkeepalived+LVS(DSR)
「実践ドメイン駆動設計」社内読書会まとめ ~IDDD本難民に捧げる1章から7章~
20200804 AWS Black Belt Online Seminar Amazon CodeGuru
AWS Black Belt Online Seminar 2018 AWS上の位置情報
MySQL High Availability with Group Replication
AWS Well-Architected Security とベストプラクティス
The Twelve-Factor Appで考えるAWSのサービス開発
ソフトウェアの核心にある複雑さに立ち向かう
Cloud Native: what is it? Why?
What is Cloud Native Explained?
DevSecops: Defined, tools, characteristics, tools, frameworks, benefits and c...
App Modernization with Microsoft Azure
Virtual Private Cloud
ドメイン駆動設計とは何か 【入門編】
Kubernetes architecture
DSDM Frameworks for Agile Project Management Offices
Salvatore Sanfilippo – How Redis Cluster works, and why - NoSQL matters Barce...
The Need of Cloud-Native Application
도커 무작정 따라하기: 도커가 처음인 사람도 60분이면 웹 서버를 올릴 수 있습니다!
Ad

Similar to Automate Behavior-driven Development | DrupalCon Portland 2022 (20)

PDF
Automate Behavior-driven Development | Stanford WebCamp 2022
PDF
Automating Behavior-Driven Development: Boosting Productivity with Template-D...
PDF
Behavioral driven development with Behat
PDF
Successfully Implementing BDD in an Agile World
PPTX
Behat - human-readable automated testing
ODP
2014 11 20 Drupal 7 -> 8 test migratie
PDF
Sukumar Nayak-Agile-DevOps-Cloud Management
PDF
Behavior Driven Development—A Guide to Agile Practices
PDF
Bridging the gap between business and it using cucumber
PDF
Agile Development Lifecycle and Best Practices with Denodo
PDF
Javantura v7 - Behaviour Driven Development with Cucumber - Ivan Lozić
PDF
How DUO started with Continuous Delivery and changed their way of Testing
PDF
Testing in DevOps: A Complete Guide | Strategies, Tools, Best Practices | Top...
PPTX
Agile, DevOps & Test
PPTX
HPE ALM Octane | DevOps | Agile
PDF
Digital Disruption with DevOps - Reference Architecture Overview
PDF
Workshop: Behavior Driven Development - Deliver value by Naveen Kumar Singh
PDF
Smalltalks 2011 - Bringing BDD ideas to Pharo
PDF
Continuous (Non-)Functional Testing of Microservices on K8s
PDF
[DSC Europe 23] Matteo Molteni - Implementing a Robust CI Workflow with dbt f...
Automate Behavior-driven Development | Stanford WebCamp 2022
Automating Behavior-Driven Development: Boosting Productivity with Template-D...
Behavioral driven development with Behat
Successfully Implementing BDD in an Agile World
Behat - human-readable automated testing
2014 11 20 Drupal 7 -> 8 test migratie
Sukumar Nayak-Agile-DevOps-Cloud Management
Behavior Driven Development—A Guide to Agile Practices
Bridging the gap between business and it using cucumber
Agile Development Lifecycle and Best Practices with Denodo
Javantura v7 - Behaviour Driven Development with Cucumber - Ivan Lozić
How DUO started with Continuous Delivery and changed their way of Testing
Testing in DevOps: A Complete Guide | Strategies, Tools, Best Practices | Top...
Agile, DevOps & Test
HPE ALM Octane | DevOps | Agile
Digital Disruption with DevOps - Reference Architecture Overview
Workshop: Behavior Driven Development - Deliver value by Naveen Kumar Singh
Smalltalks 2011 - Bringing BDD ideas to Pharo
Continuous (Non-)Functional Testing of Microservices on K8s
[DSC Europe 23] Matteo Molteni - Implementing a Robust CI Workflow with dbt f...
Ad

More from DOCOMO Innovations, Inc. (17)

PDF
Automate, Integrate, Innovate - AI-powered GitLab CI for Drupal module develo...
PDF
Automate, Integrate, Innovate - AI-powered GitLab CI for Drupal module develo...
PDF
Automate, Integrate, Innovate - AI-powered GitLab CI for Drupal module develo...
PDF
Empower Your Single Site for Multi-tenancy Services | Stanford WebCamp 2023
PDF
クラウドオーケストレーターを使ってみよう
PDF
Leveraging Multiple Cloud Orchestration and Resource Optimization
PDF
Agile practice in drupal 8 module development 20200328a
PDF
Agile Practice in Drupal 8 Module Development
PDF
Leveraging Multiple Cloud Orchestration
PDF
DevOps+ to Leverage Software Development
PDF
Leveraging Multiple Cloud Orchestration
PDF
CouchConf Tokyo Customer Presentation: DOCOMO Innovations (Japanese)
PDF
CouchConf Tokyo Customer Presentation: DOCOMO Innovations (English)
PDF
CouchConf Tokyo DOCOMO Innovations Lunchtime Lightning Talk (English)
PPT
Clanavi: How to Manage Your Cloud by Drupal (BADCamp 2010)
PDF
Clanavi: How to Manage Your Cloud by Drupal
PPT
How to Manage Your Cloud by Drupal (DrupalCon CPH 2010)
Automate, Integrate, Innovate - AI-powered GitLab CI for Drupal module develo...
Automate, Integrate, Innovate - AI-powered GitLab CI for Drupal module develo...
Automate, Integrate, Innovate - AI-powered GitLab CI for Drupal module develo...
Empower Your Single Site for Multi-tenancy Services | Stanford WebCamp 2023
クラウドオーケストレーターを使ってみよう
Leveraging Multiple Cloud Orchestration and Resource Optimization
Agile practice in drupal 8 module development 20200328a
Agile Practice in Drupal 8 Module Development
Leveraging Multiple Cloud Orchestration
DevOps+ to Leverage Software Development
Leveraging Multiple Cloud Orchestration
CouchConf Tokyo Customer Presentation: DOCOMO Innovations (Japanese)
CouchConf Tokyo Customer Presentation: DOCOMO Innovations (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
How to Manage Your Cloud by Drupal (DrupalCon CPH 2010)

Recently uploaded (20)

PDF
Advancing precision in air quality forecasting through machine learning integ...
PDF
giants, standing on the shoulders of - by Daniel Stenberg
PDF
Auditboard EB SOX Playbook 2023 edition.
PDF
SaaS reusability assessment using machine learning techniques
PDF
CEH Module 2 Footprinting CEH V13, concepts
PDF
substrate PowerPoint Presentation basic one
PDF
Data Virtualization in Action: Scaling APIs and Apps with FME
PDF
CXOs-Are-you-still-doing-manual-DevOps-in-the-age-of-AI.pdf
PDF
Rapid Prototyping: A lecture on prototyping techniques for interface design
PPTX
Presentation - Principles of Instructional Design.pptx
PPTX
SGT Report The Beast Plan and Cyberphysical Systems of Control
PDF
Introduction to MCP and A2A Protocols: Enabling Agent Communication
DOCX
Basics of Cloud Computing - Cloud Ecosystem
PDF
Co-training pseudo-labeling for text classification with support vector machi...
PDF
Connector Corner: Transform Unstructured Documents with Agentic Automation
PDF
ment.tech-Siri Delay Opens AI Startup Opportunity in 2025.pdf
PDF
Planning-an-Audit-A-How-To-Guide-Checklist-WP.pdf
PDF
The-2025-Engineering-Revolution-AI-Quality-and-DevOps-Convergence.pdf
PDF
A hybrid framework for wild animal classification using fine-tuned DenseNet12...
PDF
Transform-Quality-Engineering-with-AI-A-60-Day-Blueprint-for-Digital-Success.pdf
Advancing precision in air quality forecasting through machine learning integ...
giants, standing on the shoulders of - by Daniel Stenberg
Auditboard EB SOX Playbook 2023 edition.
SaaS reusability assessment using machine learning techniques
CEH Module 2 Footprinting CEH V13, concepts
substrate PowerPoint Presentation basic one
Data Virtualization in Action: Scaling APIs and Apps with FME
CXOs-Are-you-still-doing-manual-DevOps-in-the-age-of-AI.pdf
Rapid Prototyping: A lecture on prototyping techniques for interface design
Presentation - Principles of Instructional Design.pptx
SGT Report The Beast Plan and Cyberphysical Systems of Control
Introduction to MCP and A2A Protocols: Enabling Agent Communication
Basics of Cloud Computing - Cloud Ecosystem
Co-training pseudo-labeling for text classification with support vector machi...
Connector Corner: Transform Unstructured Documents with Agentic Automation
ment.tech-Siri Delay Opens AI Startup Opportunity in 2025.pdf
Planning-an-Audit-A-How-To-Guide-Checklist-WP.pdf
The-2025-Engineering-Revolution-AI-Quality-and-DevOps-Convergence.pdf
A hybrid framework for wild animal classification using fine-tuned DenseNet12...
Transform-Quality-Engineering-with-AI-A-60-Day-Blueprint-for-Digital-Success.pdf

Automate Behavior-driven Development | DrupalCon Portland 2022

  • 1. Automate Behavior-driven Development Yas Naoi Chief Architect, Cloud DOCOMO Innovatins, Inc.
  • 2. Yas 2 Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved.
  • 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. But scenario outline is not enough! 77
  • 78. I want to use parameters for everything! Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 78 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 }}" |
  • 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 }}" | Twig Template!
  • 81. Get Parameterized Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 81
  • 82. Get Parameterized Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 82 docker build
  • 83. Get Parameterized Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 83 docker build RUN composer require drupal/cloud drupal/drupal-extension ...
  • 84. Get Parameterized Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 84 Packagist: drupal/cloud_orchestrator incl. drupal/cloud Feature: ... Scenario Outline: ... Examples: docker build RUN composer require drupal/cloud drupal/drupal-extension ... << Download >>
  • 85. Get Parameterized Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 85 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 >>
  • 86. Get Parameterized Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 86 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 >>
  • 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 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 >>
  • 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 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 >>
  • 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 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 >>
  • 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 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 >>
  • 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 | 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 >>
  • 93. We Test Our Code Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 93
  • 94. We Want This One! Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 94
  • 95. GitLab CI/CD Pipeline 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 Architecture Basics Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 97
  • 98. Developer GitLab CI/CD Pipeline Architecture Basics Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 98
  • 99. Developer GitLab CI/CD Pipeline Architecture Basics GitLab Master Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 99
  • 100. GitLab Master GitLab Runner Developer GitLab CI/CD Pipeline Architecture Basics Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 100
  • 101. GitLab Master GitLab Repository Developer GitLab CI/CD Pipeline Architecture Basics GitLab Runner Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 101
  • 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. 102
  • 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. 103
  • 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. 104 gitlab-runner 1 gitlab-runner 2 … gitlab-runner N
  • 105. 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. 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. 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. 109 gitlab-runner 1 gitlab-runner 2 gitlab-runner 3 gitlab-runner 4
  • 110. Slack Integration Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 110
  • 111. How we can build CI/CD pipeline? 111
  • 112. .gitlab-ci.yml Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 112 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 ...
  • 113. .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. 113
  • 114. Demo Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved. 114 • Behat • GitLab CI/CD Pipeline
  • 115. Lessons That We Learned 115
  • 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 116 Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved.
  • 117. Our Custom Extension to drupal-extension 117 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
  • 118. 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 118 Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved.
  • 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. Our Custom Extension to drupal-extension 120 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
  • 121. 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 121 Copyright © 2022 DOCOMO Innovations, Inc. All Rights Reserved.
  • 123. Where to Find Our Solutions 123 • 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.
  • 124. Resources 124 • 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.
  • 125. Coming together is a beginning, keeping together is a progress; working together is a success. Henry Ford “ “