LoginSignup
3
2

More than 5 years have passed since last update.

Robot Frameworkのテストケースの指針「How to write good test case」について

Posted at

この記事は「Robot Framework Advent Calendar 2017 - Qiita」の24日目の記事です。

Robot Framworkのテストケースを書いていると、この書き方で良いのかと悩むことがあります。

Lint面では、以前紹介した Robot Framework Lint を試すのが良さそうです。

それ以外で何か良い資料がないかを探したところ、Robot Frameworkのリポジトリに How to write good test case がありました。
robotframework/HowToWriteGoodTestCases: General guidelines for writing good test cases using Robot Framework

How to write good test case では、Robot Frameworkのテストケースの

  • Introduction
  • Naming
  • Documentation
  • Test suite structure
  • Test case structure
  • User keywords
  • Variables
  • Avoid sleeping

について、良い書き方と悪い書き方について書かれています。

 

個人的に参考になった部分は

  • 英語でテストケースやキーワードを書く場合は、Pascal Case & 単語の区切りは半角スペースで書く
  • テストスイートには [Document] 設定を書くが、テストケースには書かない
  • テストケースの書き方は、 Workflow testsData-driven tests の2種類がある
    • Workflow testsでは、テストケースのステップ数は最大10とする
    • Workflow testsでは、forループやif/elseなどのロジックがあるものはユーザキーワードに書き、テストケースには書かない
  • 変数名を英語で書く場合の指針
    • ローカル変数名は小文字のみで構成する
    • テストスイート変数名とグローバル変数名は大文字のみで構成する

などでした1

Robot Frameworkのテストを書く場合には良い指針となりそうです。

 

なお、 How to write good test case のIntroductionでは他の参考資料として、

もあげられています。

こちらにも目を通しておくと良さそうです。


  1. 意訳な内容なので、詳細は原文を確認してください。また、誤りがあったらご指摘ください。 

3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2