0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

pictの使い方

Posted at

はじめに

2因子網羅によるテストケースを生成するCLIツール「pict」の導入方法、使い方、便利な使い方をまとめる。

環境

macOS Sonoma 14.3
Homebrew 4.2.6
pict 3.7.4

導入

Homebrewを使えば一瞬で導入できる

brew install pict

使い方

因子と水準をまとめたモデルファイルを作成し、それをpictコマンドに渡すことで具体的なテストケースを作成する。

まず、以下のような形でモデルファイルを作成する。

model.txt
<因子A>: <水準1>, <水準2>, <水準3>

作成したモデルファイルをpictに渡す。

pict model.txt

これだけで、2因子網羅したテストケースを作ってくれる。

便利な使い方

非常に便利なpictであるが、出力結果があまり美しくない。そこで、出力結果をソートするために、pictの出力をパイプを使ってsortに渡す。ただし、sortコマンドは出力結果の全てを1行ごとに並び替えてしまうので、因子名を示すヘッダーも一緒に並び替えてしまう。この点を除けば、出力結果が非常に見やすく、整理しやすいものになる。

pict model.txt | sort

また、テストケースが何通りできるのか、具体的な数値が知りたいという場合もあるだろう。その際、出力を1行ずつ数えるのは非現実的である。そこで、/sオプションを使う。

pict model.txt /s

Generated testsとして表示される数値が、生成された2因子網羅のテストケース数である。その上にはCombinationsとして表示される数値があるが、これが何を意味しているのか不明である。少なくとも、全網羅した時のテストケース数ではない。

終わりに

いくつか謎のまま放置している部分がある。ヘッダーをそのままにソートする簡単なやり方や、Combinationsの意味が判明すれば追記・修正を行う。

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?