LoginSignup
0
0

More than 5 years have passed since last update.

AppVeyor 設定項目 - Tests編

Posted at

AppVeyor

.NET開発者向けのCI&デプロイツール
Continuous Integration and Deployment service for Windows developers - Appveyor

AppVeyor 設定項目 - General編 - Qiita

AppVeyor 設定項目 - Environment編 - Qiita

AppVeyor 設定項目 - Build編 - Qiita

Tests

テスト設定
以下の3タイプから選ぶ

  • AUTO:AppVeyorが自動でいい感じにやってくれる設定
  • SCRIPT:PowerShellかCmdでビルドスクリプトを記述
  • OFF:そもそもテストしない

MSBUILD以外は特に記述することはないので、以下MSBUILDについて記載する

AUTO

Test assemblies

デフォルトではAppVeyorが自動でテスト用のアセンブリを見つけて実行してくれる。
大規模なプロジェクトになると時間がかかるので、対象のアセンブリを指定してやる。(ワイルドカード使用可能)

**\*.tests.dll

Test categories

実行するテストの対象を以下から指定する

  • All categories : すべてのカテゴリのテストを実施
  • Only categories below : 指定したカテゴリのみテストを実施
  • All except categories below : 指定したカテゴリ以外のテストを実施

カテゴリは複数指定可能

テストフレームワーク別カテゴリ指定方法
Visual Studio unit tests
[TestMethod, TestCategory("A")]
public void TestA()
{
}
xUnit
[Fact, Trait("Category", "A")]
public void TestA()
{
}
NUnit
// TestFixture単位
[TestFixture, Category("A")]
public class Tests
{
}

// メソッド単位
[TestFixture]
public class Tests
{
    [Test, Category("A")]
    public void TestA()
    {
    }
}
MSpec
// Tagsで指定
[Subject(typeof(Hoge), "Hoge")]
[Tags("A")]
public class TestA
{
}

Parallel testing groups

グループ毎に並列でテストジョブを実行できる。
グループにはカテゴリを指定できる。

Before tests script

テスト前に実行するスクリプトを記述
PowerShellかCmdが選べる

After tests script

テスト後に実行するスクリプトを記述
PowerShellかCmdが選べる

SCRIPT

カスタムスクリプトを用いてテストする場合に記述。

テストフレームワーク別テスト実行コマンド

Visual Studio Unit Testing framework
vstest.console /logger:Appveyor <assembly> [options]

VSTest.Console.exe のコマンド ライン オプション

NUnit 2.x
# 64bit
nunit-console <assembly> [options]

# 32bit
nunit-console-x86 <assembly> [options]
NUnit 3.x
nunit3-console <assembly> [options] --result=myresults.xml;format=AppVeyor
xUnit
xunit.console <assembly> /appveyor

# .NET 4.0
xunit.console.clr4 <assembly> /appveyor
MSpec
mspec [options] <assemblies>
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