以下の内容はhttps://www.sakatakoichi.com/entry/20080827/1219819221より取得しました。


@TableAssertでクエリをファイルに書けます

TestNG+DbUnitライブラリであるDbUnitNGで、DbUnitライブラリ@TableAssertでDBとアサートできます - Fight the Future じゅくのblogにある@TableAssertに機能を追加しました。

結果をDBから取得するクエリをプロパティファイルに記述できるようにしました。

@TableAssert(names = "dept", pathname = "insert_expected.xml", propertyFilePath="query.properties", keys="test")
@SetUpOperation(pathname = "dept.xml", value = DatabaseOperationType.DELETE_ALL)
public void testTableAssert3() {
	insert();
}

クエリを直接Javaコードに記述すると読みづらいので。


@TableAssertのpropertyFilePath属性がプロパティファイルへのパスです。
「/」がない場合、テストクラスと同じパッケージにあるファイルを探します。
「/」があればクラスパスのルートからの位置になります。
keysに指定したキーの値としてクエリを書きます。

test = select dname, deptno, loc from dept

namesはクエリの結果を格納するDbUnitのITableのテーブル名です。




以上の内容はhttps://www.sakatakoichi.com/entry/20080827/1219819221より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14