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 3 years have passed since last update.

Coberturaでのカバレッジ計測で嵌った経路作成

Last updated at Posted at 2021-04-03

はじめに

Coberturaを導入しカバレッジを計測しようと思ったのですが、なかなか実行できなかったので、解決するまでに必要な手順をまとめておこうと思います。

環境

  • macOS 11.0.1
  • VSCode 1.54.3
  • JDK 11.0.10
  • Cobertura 2.1.1

Homebrew で dos2unix をインストール

dos2unix はファイルの改行コード(CRLF -> LF)に変更するためのコマンドです。

brew install dos2unix

cobertura-instrument.sh をUNIX (LF) 形式に変換

シェルスクリプトはDOS(CRLF)形式なので、UNIX(LF)形式に変換します。

dos2unix cobertura-instrument.sh

Cobertura でカバレッジを計測の経路を作成

カバレッジの計測を行う、テストクラスを指定

cobertura-instrument.sh Test.class

以下が表示されると成功です。

Cobertura 2.1.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
[INFO] Cobertura: Saved information on 0 classes.
[INFO] Cobertura: Saved information on 0 classes.

さいごに

エラーが発生した際は、cobertura-instrument.shCould not find or load main classが表示されたため、問題点を理解するのに苦労しました。
まさか、改行コードが悪さをしていたとは思いもしなかったので、次回に同様の問題が起きたときは改善方法の一つとして試してみようと思いました。

参考文献

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?