Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
テストコードを書きたいけどテスト対象がない。どうする? / What to do to wri...
Search
akihisa1210
February 10, 2022
Technology
2
920
テストコードを書きたいけどテスト対象がない。どうする? / What to do to write test?
QA Tips LT会 #QATipslt - connpass
https://rakus.connpass.com/event/234065/
akihisa1210
February 10, 2022
Tweet
Share
More Decks by akihisa1210
See All by akihisa1210
Four Keysに基づくリリースプロセス改善とその成果 / Release process improvement based on the Four Keys and its results
ak1210
0
1.2k
独立したQA担当者か開発チームか? あるプロダクトチームのQA体制の変遷 / Independent QA or Dev Team
ak1210
0
1.4k
ソフトウェアテスト 2022 / Software Testing 2022
ak1210
1
8k
E2E自動テスト導入・運用をめぐる先入観と実際に起きたこと / Preconceptions and What Happened with E2E Testing
ak1210
7
2.9k
ここからはじめるスクラムQA(増補改訂版) / Getting started with QA in Scrum (revised)
ak1210
2
880
ここからはじめるスクラムQA / Getting started with QA in Scrum
ak1210
2
1.2k
「開発チーム」とQA /"Development Team" and QA
ak1210
1
8.4k
Other Decks in Technology
See All in Technology
タイミーのレコメンドにおける ABテストの運用
ozeshun
1
210
JTCや セキュリティチェックリストが夢の跡
nikinusu
1
800
eBPFのこれまでとこれから
yutarohayakawa
10
3.3k
エムスリーエビデンス創出プロダクトチーム紹介資料 / Introduction of M3 Create Evidence Team
m3_engineering
0
100
Fediverse Discovery Providers overview
andypiper
0
170
OSTという文化を組織に根付かせてみた
sansantech
PRO
2
430
Passkey Autofill に賭けるマネーフォワード ID - Money Forward Tech Day 2024
nov
0
200
フルカイテン株式会社 採用資料
fullkaiten
0
32k
ついに出た!OpenAIの最新モデル「o1」って何がすごいの?
minorun365
PRO
3
1.3k
Tricentisにおけるテスト自動化へのAI活用ご紹介/20240910Shunsuke Katakura
shift_evolve
0
210
グイグイ系QAマネージャーの仕事
sadonosake
0
360
横断組織として考える共通DBの課題解決 〜 桃園の誓いアーキテクチャ 〜 / Addressing Shared Database Challenges as Cross-Team: “Peach Garden Oath” Architecture
4geru
0
230
Featured
See All Featured
Scaling GitHub
holman
458
140k
Robots, Beer and Maslow
schacon
PRO
157
8.2k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
8.9k
Rebuilding a faster, lazier Slack
samanthasiow
78
8.6k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
1
55
Fantastic passwords and where to find them - at NoRuKo
philnash
48
2.8k
A Philosophy of Restraint
colly
202
16k
Git: the NoSQL Database
bkeepers
PRO
425
64k
The Mythical Team-Month
searls
218
43k
Designing for humans not robots
tammielis
248
25k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
26
2k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
326
21k
Transcript
テストコードを書きたいけど テスト対象がない。どうする? 2022-02-10 QA Tips LT会 #QATipslt サイボウズ株式会社 Garoon開発チーム 兼
生産性向上チーム 小山 晃久(@akihisa1210)
自己紹介 小山 晃久 (@akihisa1210) サイボウズ株式会社 Garoon開発チーム 兼 生産性向上チーム 品質、テスト、CI/CD、アジャイル 趣味は読書
Twemoji https://twemoji.twitter.com/content/twemoji-twitter/en.html Copyright 2020 Twitter, Inc and other contributors Graphics licensed under CC-BY 4.0: https://creativecommons.org/licenses/by/4.0/
Cybozu Productivity Weekly • 開発者の生産性向上ネタを毎週共有 • CI/CDや自動テストの話題も • Zenn &
Twitterで発信中!
本題
テストコードを書きたい! • テストコードを書いたことがないので書きたい! • あのテストフレームワークを使ってみたい! • 特に理由はないが書きたい!
テスト対象がない……。 • 何にテストコードを書こう?
なければ作ろう! • Webアプリケーションを作成する類の書籍を買ってくる • サンプルコードにテストを追加しながら進める
書籍を選ぶ際の注意 • 特定のユニットテストツールを使いたい場合は、そのツールが対 応している言語と同じ言語でアプリケーションを作る書籍を選ぶ • E2Eテストツールはテスト対象が何で実装されているかには依存 していないので大丈夫 • できれば新しめの書籍を選ぶ(余計な所でハマらないために)
静的解析
静的解析を導入する • 問題のある書き方を検出・自動修正する • 特定のスタイルを強制する • 「Linter」「Formatter」などで検索!
(参考)パッケージマネージャー • プロジェクトごとに、そのプロジェクトが使うパッケージを管理す るツール • ツール導入時に必要になることも
ローカル開発環境 静的解析 ソースコード
CI
CI? • Continuous Integration • コードに変更が加わるごとにビルドやテストを行う • 早いフィードバックで小さく修正 • 自動トリガーの恩恵(手動だと忘れる)
CIを設定する前に • コードをソースコード管理システムで管理する • サンプルコードのライセンスを要確認 • プライベートリポジトリと連携できるCIシステムもある
CIの設定 • 設定ファイルをソースコードと合わせて管理する • CIシステムがソースコード管理システムからコードを取得できる ようにする • CIシステム上で静的解析が実行されるようにする
ローカル開発環境 静的解析 ソースコード ソースコード管理システム ソースコード 静的解析 CI システム ソースコード
ユニットテスト
ユニットテストを書く • 関数やクラスに勝手にテストを書く • テストが書きづらい場合は、テストが書けるように修正してみる • ユニットテストもCIで流す
ローカル開発環境 静的解析 ユニットテスト ソースコード ソースコード管理システム ソースコード 静的解析 CI システム ユニットテスト
ソースコード
E2E テスト
E2Eテストを書く • ローカル開発環境でWebアプリケーションを立ち上げる • E2Eテストを書いてみる
ローカル開発環境 静的解析 ユニットテスト E2Eテスト ソースコード ビルド デプロイ ソースコード管理システム ソースコード 静的解析
CI システム ユニットテスト ソースコード
E2EテストをCIで動かす • CIシステムがアクセスできるところでWebアプリケーションを動 かす • CIシステム上でテストを実行する
ローカル開発環境 静的解析 ユニットテスト E2Eテスト ソースコード ビルド デプロイ ソースコード管理システム ソースコード 静的解析
CI システム ユニットテスト E2Eテスト デプロイ ビルド ソースコード
最後に
全部やらないといけないの? • やらなくても大丈夫です • 興味のあるところ、開発の効率が上がるところから