LoginSignup
1
1

More than 5 years have passed since last update.

shunit2をsubmoduleとして登録しCircleCIで実行する

Posted at

CircleCIの使い方やShunit2でのテストの書き方については素晴らしいQiitaエントリがたくさんあるので割愛します

Shunit2

https://code.google.com/archive/p/shunit2/
GoogleCode上のプロジェクトですが

NOTICE(2015-06-26): shunit2 has moved to GitHub! http://github.com/kward/shunit2
とあるので

こちら使わせていただくことにします

submodule追加

上記GitリポジトリにあるShunit2をサブモジュールとして追加します

[submodule "shunit2"]
    path = shunit2
    url = git@github.com:kward/shunit2.git

circle.yml

circle.ymlは

checkout:
  post:
    - git submodule sync
    - git submodule update --init

test:
  override:
    - bash test/bl_test.sh

こんな感じにしておきます

テストの内容

#!/bin/bash

testMain(){
  assertEquals 1 1
}

. ./shunit2/source/2.1/src/shunit2

任意のテストを書いたあと、最終行にshunitのパスを記載しておきます

実際にこちらのプロジェクトで使ってみました

スクリーンショット 0028-11-30 13.00.36.png

スクリーンショット 0028-11-30 13.01.03.png

各ファイルの置き場所や、相対パスの関係がどうなっているのかなどの参考になれば幸いっす

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