2016-09-21 3 views
2

私はe2eテスト用の分度器を使用しています。 私が覚えていること:私は、1つの設定ファイルを使用して異なるスイートを実行し、異なるディレクトリにレポートを格納できるようにします。 cmd protractor test.js --params.suite = Name1 ** - params.suite = Name2 *を実行するとName1フォルダにレポートが保存され、Name2フォルダにレポートが保存されます。 私は設定機能からのパスを取得し、それを使用する上で、私はコードでhttps://www.npmjs.com/package/jasmine2-protractor-utils#htmlreportdir分度器、pa​​ramsを使用してレポートディレクトリを設定する方法はありますか?

var configuration = new function() { 
this.reportPath = "C:/xxx/ProtractorTests/"; 
this.reportFileName = "reportName.html"; 
this.screenshotPath = "C:/xxx/Screenshots/"; }; 

exports.config = { 

... 

params: { 
    suite: "SuiteName" 
}, 

plugins: [ 
    { 
     path: 'node_modules/jasmine2-protractor-utils', 
     disableHTMLReport: false, 
     disableScreenshot: false, 
     screenshotPath: configuration.screenshotPath, 
     screenshotOnExpectFailure: true, 
     screenshotOnSpecFailure: true, 
     clearFoldersBeforeTest: true, 
     htmlReportDir: configuration.reportPath, 
     failTestOnErrorLog: { 
      failTestOnErrorLogLevel: 900 
     } 
    } 
], 

を使用しています。 exports.config.params.suite変数を使用してレポートパス文字列を連結できますか?それとも、私はそれをすべて間違ってやっているのですか? アイデアをいただければ幸いです。

答えて

1

あなたは、コマンドライン引数を取得するためにyargsを使用することができます。

configuration.screenshotPath += '/' + require('yargs').argv.suite 

だけnpm install yargs --save yargsを取得します。

関連する問題