LoginSignup
3
1

More than 1 year has passed since last update.

UnrealEngineでlibzipを使ったPluginを作ってみてAutomation Specでテストを書いてみた

Posted at

UE5.1.1でlibzipを使ったプラグインを作ってみました(Win64環境のみサポート)。
作成環境や使い方は以下のReadme.mdに記述しています。
https://github.com/mechamogera/UnrealEngineLibzipPlugin

Plugin作成メモ

EditorのNew PluginでThird Party LibraryのTemplateをベースに作成しました。

libzipについて

以下を使ってlibzipをstaticビルドしました。

手順としては、上2つをCloneしてzlib、libzipの順で
 build-VS2022/libzip-static/*.vxcproj
をVisualStudio2022で開いてRelease x64ビルドして以下のファイルをプラグインに配置

  • zlib-win-build/build-VS2022/x64/Release/libz-static.lib
  • libzip-win-build/build-VS2022/x64/Release/libzip-static/libzip-static.lib
  • libzip-win-build/lib/*.h
  • libzip-win-build/win32/*.h

Automation Specテスト

プラグインでは以下のページを参照してAutomation Specのテストを書いてみました。
Automation Spec | Unreal Engine ドキュメント

テストは以下の個所に配置しています。
https://github.com/mechamogera/UnrealEngineLibzipPlugin/tree/master/Plugins/LibzipArchiver/Source/LibzipArchiver/Spec

テストを書いてみた所感

今回初めてがっつりAutomation Specでテストを書いてみたので所感を記録しておきます。

  • エラーケースの挙動を確認してコードを修正できたのが良かった。
  • スタブやモックがないので特定の状況でしか発生しないケースは書けないのが残念。
    以下のページで改善についてはふれられてはいる。
    Mocking for functional and unit tests - Development / Programming & Scripting - Epic Developer Community Forums
  • 実行がEditorを起動してSession Frontendから実行なのでテストのサイクルを回すのに時間がかかるのがつらい。
    Editor起動中にテストを変更しても反映する方法がわからない。一度Editorを閉じてVisualStudioでビルドしてまたEditorを起動するのが大変。Rider for UnrealEngineだとエディタからUnit Testが実行できるらしいのでここら辺のサイクルを早く回せる?
3
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
3
1