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

4-2.RPGUnitをインストールする

1
Posted at

■前提

*RPGUnitはRPGLE製のオープンソーステストフレームワークです
 RPG3はテストできません
*Bobでソースコードを分析してRPGUnitのテストコードを自動生成できます

BobでRPG3のコードをFFRPGに自動変換し、RPGUnitのテストコードも自動生成します
そのためにRPGUnitをインストールしておきます

■RPGUnitのインストール

RPGUnitのインストール手順はrpgunit.sourceforge.netとcodefori.github.ioの2種類がありました
内容が違うようで今回はrpgunit.sourceforge.netを採用しています
codefori.github.ioを使ったテストコードの書き方がわかる方はぜひ教えてください

*rpgunit.sourceforge.net
URL : https://rpgunit.sourceforge.net/install.html

標準インストール手順ではftpでアップしますがPVSではftpが使えません
RPGUnitは111メンバーもあるので、CPYFRMSTMFをbashスクリプトにしてアップロードしました

1) IBMiにsshしファイル作成

もしRPGUNITライブラリが未作成なら以下でライブラリを作成しましょう

$ system "CRTLIB LIB(RPGUNIT) TEXT('RPGUNIT Lirary')"
$ cd RPGUNIT
$ ./mkfiles.bash
mkfiles.bash
system "CRTSRCPF FILE(RPGUNIT/RPGUNIT1)  RCDLEN(112) TEXT('RPGUnit - Framework.')"
system "CRTSRCPF FILE(RPGUNIT/RPGUNITC1) RCDLEN(112) TEXT('RPGUnit - Commands.')"
system "CRTSRCPF FILE(RPGUNIT/RPGUNITF1) RCDLEN(112) TEXT('RPGUnit - Test Fixtures.')"
system "CRTSRCPF FILE(RPGUNIT/RPGUNITT1) RCDLEN(112) TEXT('RPGUnit - Self-Test.')"
system "CRTSRCPF FILE(RPGUNIT/RPGUNITY1) RCDLEN(112) TEXT('RPGUnit - Prototypes.')"

2) PCでrpgunit-x.x.x-src.zipをダウンロードしscp

ダウンロード : https://sourceforge.net/projects/rpgunit/
2026/07/24現在 0.3.2 でした

PS C:\Users\{ユーザ名}> scp rpgunit-0.3.2-src.zip pvs:~/RPGUNIT

3) IBMiにsshしメンバー取込

$ cd RPGUNIT
$ unzip rpgunit-0.3.2-src.zip
$ cd rpgunit-0.3.2-src/rpgunit-0.3.2
$ ./copymembers.bash
copymembers.bash
!/bin/bash
#
FROM="/home/{ユーザ名}/RPGUNIT/rpgunit-0.3.2/"
TO="/QSYS.LIB/RPGUNIT.LIB/"

members=(
"RPGUNIT1.FILE/ASSERT.MBR"
… 111メンバーあり
"RPGUNITY1.FILE/USRSPC.MBR"
)
for mbr in "${members[@]}"; do
    STMF=$FROM$mbr
    MEMBER=$TO$mbr
    system "CPYFRMSTMF FROMSTMF('$STMF') TOMBR('$MEMBER') MBROPT(*REPLACE)"
done

4) IBMiに5250ログインしメタデータ復旧

CRTBNDCL PGM(QTEMP/MKMETADATA) SRCFILE(RPGUNIT/RPGUNIT1)
CALL PGM(QTEMP/MKMETADATA) PARM(RPGUNIT)

5) IBMiに5250ログインしコンパイル

CRTBNDCL PGM(RPGUNIT/MKRPGUNIT) SRCFILE(RPGUNIT/RPGUNIT1)
SBMJOB CMD(CALL PGM(RPGUNIT/MKRPGUNIT) PARM(RPGUNIT)) JOB(MKRPGUNIT)

*[未使用]Code for IBMi掲載のRPGUnitインストール方法
構造が違う…
URL : https://codefori.github.io/docs/developing/testing/overview/

  1. Bobを起動しCode for IBM iでサーバに接続します
  2. 画面下の歯車アイコン→[settings]を選択します
  3. Settings画面で[Components]→[Install component]を選択します
  4. RPGUnitを選択して[OK]

目次へ

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