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
950
テストコードを書きたいけどテスト対象がない。どうする? / 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
8.1k
E2E自動テスト導入・運用をめぐる先入観と実際に起きたこと / Preconceptions and What Happened with E2E Testing
ak1210
7
3k
ここからはじめるスクラムQA(増補改訂版) / Getting started with QA in Scrum (revised)
ak1210
2
900
ここからはじめるスクラムQA / Getting started with QA in Scrum
ak1210
2
1.2k
「開発チーム」とQA /"Development Team" and QA
ak1210
1
8.5k
Other Decks in Technology
See All in Technology
サイロ化した金融システムを、packwerk を利用して無事故でリファクタリングした話
coincheck_recruit
3
2.6k
6年の歴史×ペタバイト級のデータ基盤のチームを一体化する開発スタイル
plaidtech
PRO
4
110
AWS CDKで大量のパラメータストアを作りたい
y_kotani
1
150
インシデント対応の 実践と品質文化の醸成
____rina____
2
1.4k
CI/CDやテスト自動化の開発プロジェクトへの適用
megascus
2
300
リファクタリングへの耐性が高いモデルベースの統合テストの紹介 / Model-Base Integration Test for Refactoring
yuitosato
5
1.2k
SwiftSyntaxでUIKitとSwiftUIの使用率を完璧に計測できちゃう件について
ldf_tech
0
160
Mackerelが取り組むオブザーバビリティ - Mackerel Tech Day
mackerelio
0
300
Overview of file type identifiers
ange
0
200
API開発健全性 〜 持続可能で高品質なAPIのためのアプローチ 〜
nagix
2
210
Tokyo dbt Meetup #10 dbt Cloudユーザー会 & パネルディスカッション
dbttokyo
1
160
CAMERA-Suite: 広告文生成のための評価スイート / ai-camera-suite
cyberagentdevelopers
PRO
1
130
Featured
See All Featured
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
41
2.1k
Mobile First: as difficult as doing things right
swwweet
222
8.9k
Side Projects
sachag
452
42k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
41
9.2k
What's in a price? How to price your products and services
michaelherold
243
11k
Art, The Web, and Tiny UX
lynnandtonic
296
20k
Practical Orchestrator
shlominoach
186
10k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
355
29k
Facilitating Awesome Meetings
lara
49
6k
Building Your Own Lightsaber
phodgson
102
6k
Into the Great Unknown - MozCon
thekraken
31
1.4k
Optimizing for Happiness
mojombo
376
69k
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テスト デプロイ ビルド ソースコード
最後に
全部やらないといけないの? • やらなくても大丈夫です • 興味のあるところ、開発の効率が上がるところから