Skip to content

Install Test System

Nishimura edited this page May 13, 2013 · 2 revisions

テスト機能のインストール

定期実行による各サービスのテスト機能のインストールについて述べます. これは他言語工房に登録されている各サービスを定期的に実行し,それぞれのサービスが正しく動作しているか確かめるものです. 以下ではサーバにphpがインストールされていることを前提にしています. また,phpのバージョンは5.3.17にて動作確認を行っています.

phpunitのインストール

テスト機能はphpunitを用いて実行しますので,まずpearを用いてphpunitをインストールします.

pear channel-discover pear.phpunit.de
pear install phpunit/PHPUnit

これでphpunitはインストールされますが,実行にはYAMLパッケージが必要ですのでそれもインストールします.

pear install symfony/YAML
pear channel-discover pear.symfony-project.com

これでphpunitが実行可能になります.

MySQL

MySQLについての設定を行います. まず,MySQLにmlstudio@localhostというユーザを作成します.パスワードはmlstudioとします. 続いて,mlstudioという名前のデータベースを作成します. 以上でMySQLについての設定は完了です.

言語グリッドアカウントの設定

/langrid-php-library/test_settings.phpを編集し,言語グリッドのIDとパスワードを入力してください.

task.shの編集

/langrid-php-library/testディレクトリにtask.shがあり,これを実行することでテスト機能が実行されます. task.shのデフォルトの場所は

/srv/langrid-php-library/test/

となっているので,変更する場合は,task.shを書き換えます.

また,task.sh内のメールアドレスの箇所に,カンマ区切りでメールアドレスを追加していただければ, 後述の定期実行の結果を確認することが出来るようになります.

定期実行の設定

cronを設定することで,定期的にtask.shを実行し,その結果をメールで受け取ることが出来るようになります. テストの実行のためにはカレントディレクトリを/langrid-php-library/testディレクトリにする必要があります.

langriduser@langrid:/srv/langrid-php-library/test> crontab -e
10 1 * * * cd /srv/langrid-php-library/test/ && /bin/sh task.sh

実行結果

cronによる定期実行で,以下のようなメールが来るようになります. 前半部分には各サービスを実行した結果発生したエラーの内容が記述されています. この例ではDependencyParserにエラーが発生しています. 後半部分に各サービスに対して行ったテストの中で成功したものにチェックが入っています.

PHPUnit 3.7.9 by Sebastian Bergmann.

...............................................................  63 / 169 ( 37%)
............................................................... 126 / 169 ( 74%)
...........................F..EII......FIF.

Time: 05:49:12, Memory: 16.50Mb

There was 1 error:

1) KyotoLangridResourceTest::testDependencyParserResource with data set "kyoto1.langrid:MaltParser"     ('http://langrid.org/service_manager/wsdl/kyoto1.langrid:MaltParser', 'en', 'this is test.')
LangridException: jp.go.nict.langrid.service_1_2.InvalidParameterException: morphs: must not be empty 

/srv/langrid-php-library/client/impl/ServiceClientImpl.php:110
/srv/langrid-php-library/client/impl/ServiceClientImpl.php:103
/srv/langrid-php-library/client/impl/DependencyParserClientImpl.php:19
/srv/langrid-php-library/test/resource/KyotoLangridResourceTest.php:86

Caused by
SoapFault: jp.go.nict.langrid.service_1_2.InvalidParameterException: morphs: must not be empty 

/srv/langrid-php-library/client/impl/ServiceClientImpl.php:103
/srv/langrid-php-library/client/impl/DependencyParserClientImpl.php:19
/srv/langrid-php-library/test/resource/KyotoLangridResourceTest.php:86

--


There were 3 failures:

1) Warning
No tests found in suite "KyotoLangridResourceTest::testConceptDictionaryResource".


2) Warning
The data provider specified for KyotoLangridResourceTest::testTranslationWithInternalDictionaryResource     is invalid.
undefined index when service resource test


3) Warning
The data provider specified for KyotoLangridResourceTest::testDictionaryResource is invalid.
undefined index when service resource test


FAILURES!
Tests: 169, Assertions: 244, Failures: 3, Errors: 1, Incomplete: 3.

DictionaryContent
 [x] Hoge
 [x] Validate presense dictionary record id
 [x] Validate presense language
 [x] Validate presense text
 [x] Validate unique language
 [x] Update with attribute
 [x] Update with attributes
 [x] Update with save
 [x] testFind all by dictionary id
 [x] testDelete all by resource id and language

DictionaryDeployment
 [x] Validate presense dictionary id
 [x] Validate unique dictionary id

DictionaryLanguage
 [x] Validate presense language
 [x] Validate unique language

DictionaryRecord
 [x] Validate presense dictionary id
 [x] testGet contents
 [x] testCount by resource id each languages
 [x] testGet contentsWithProperty
 [x] testCount by dictionary id and language
 [x] testGet contents as ordered array1
 [x] testGet contents as ordered array2
 [x] testUpdate contents basic
 [x] testUpdate contents append
 [x] testUpdate contents basic with user
 [x] testUpdate contents append with user
 [x] Create error
 [x] Cascade delete

Dictionary
 [x] Find
 [x] Find with deleted
 [x] All
 [x] All with deleted
 [x] Create
 [x] Update 1
 [x] Update 2
 [x] Update 3
 [x] Find include
 [x] Remove
 [x] testAll without delete flag on
 [x] Remove force
 [x] Remove force count all
 [x] testAdd language
 [x] testAdd language validate unique
 [x] testGet languages
 [x] testRmove language
 [x] testUpdate language validate minimum
 [x] testUpdate language
 [x] testUpdate language force
 [x] testRmove language force
 [x] testAdd record
 [x] testIs deploy
 [x] testIs not deploy
 [x] Deploy
 [x] Undeploy
 [x] testCount records each language
 [x] testCount records by language
 [x] testRecords count
 [x] testGet records
 [x] testCan view any
 [x] testCan view only user
 [x] testCan edit any
 [x] testCan edit only user
 [x] testIs owner
 [x] testCreate with records
 [x] testTransation create with records language
 [x] testTransation create with records unidentified language
 [x] testTransation create with records count record

ParallelTextContent
 [x] Hoge
 [x] Validate presense parallel text record id
 [x] Validate presense language
 [x] Validate presense text
 [x] Validate unique language
 [x] Update with attribute
 [x] Update with attributes
 [x] Update with save
 [x] testFind all by resource id
 [x] testDelete all by resource id and language

ParallelTextDeployment
 [x] Validate presense parallel text id
 [x] Validate unique parallel text id

ParallelTextLanguage
 [x] Validate presense language

ParallelTextRecord
 [x] Validate presense parallel text id
 [x] testGet contents
 [x] testCount by parallel text id each languages
 [x] testGet contentsWithProperty
 [x] testCount by parallel text id and language
 [x] testGet contents as ordered array1
 [x] testGet contents as ordered array2
 [x] testUpdate contents basic
 [x] testUpdate contents append
 [x] testUpdate contents basic with user
 [x] testUpdate contents append with user
 [x] Create error
 [x] Cascade delete

ParallelText
 [x] Find
 [x] Find with deleted
 [x] All
 [x] All with deleted
 [x] Create
 [x] Update 1
 [x] Update 2
 [x] Update 3
 [x] Find include
 [x] Remove
 [x] testAll without delete flag on
 [x] Remove force
 [x] Remove force count all
 [x] testAdd language
 [x] testAdd language validate unique
 [x] testGet languages
 [x] testRmove language
 [x] testUpdate language validate minimum
 [x] testUpdate language
 [x] testUpdate language force
 [x] testRemove language force
 [x] testAdd record
 [x] testIs deploy
 [x] testIs not deploy
 [x] Deploy
 [x] Undeploy
 [x] testCount records each language
 [x] testCount records by language
 [x] testRecords count
 [x] testGet records
 [x] testCan view any
 [x] testCan view only user
 [x] testCan edit any
 [x] testCan edit only user
 [x] testIs owner
 [x] testCreate with records
 [x] testTransation create with records language
 [x] testTransation create with records unidentified language
 [x] testTransation create with records count record

DictionaryLegacyBridge
 [x] Get permission
 [x] Do create
 [x] Do download
 [x] Get all dictionaries by type id
 [x] Get all dictionaries by type id with offset limit
 [x] Count all dictionary contents by dictionary id
 [x] Get all dictionary contents by dictionary id
 [x] Get all dictionary contents by dictionary id offset limit
 [x] Can delete
 [x] Remove dictionary
 [x] Do update

KyotoLangridResource
 [x] Parallel text resource
 [x] Morphological analysis resource

PHPUnit_Framework_Warning
 [ ] Warning

KyotoLangridResource
 [x] Bilingual dictionary resource
 [x] Bilingual dictionary with longest match search resource
 [ ] Dependency parser resource
 [ ] Keyphrase extraction resource
 [ ] Language identification resource
 [x] Similarity calculation resource
 [x] Speech recognition resource
 [x] Template parallel text resource
 [x] Text to speech resource
 [x] Translation resource
 [x] Adjacency pair resource

PHPUnit_Framework_Warning
 [ ] Warning

KyotoLangridResource
 [ ] Translation selection resource

PHPUnit_Framework_Warning
 [ ] Warning

KyotoLangridResource
 [x] Pictogram dictionary resource
Clone this wiki locally