Skip to main content

チャレンジ

ルールの単体テスト

This content will be archived in 16 days. ここをクリックして to continue your progress in the latest version.

シナリオ

Assistance Requestケースでは、ユーザーが車両メーカーを入力すると、Modelドロップダウンに、関連付けられたモデルが1つ以上表示されます。 Submit requestプロセスで車両情報を入力するときに、一部の車両メーカーについて、関連付けられたモデル名がドロップダウンに表示されないことがユーザーから時々報告されています。 利害関係者は、関連付けられたモデルがなくても、車両メーカーを簡単に特定できる必要があります。

また、利害関係者はアプリケーションのパフォーマンスについても懸念しています。 顧客がAssistance Request ケースを効率的に完了できるように、車両モデルリストが200ミリ秒以内に生成されることを求めています。

以下の表は、チャレンジに必要なログイン情報をまとめたものです。

ロール ユーザー名 パスワード
アプリケーションデベロッパー author@gogoroad pega123!

 

チャレンジ ウォークスルー

このチャレンジを完了するには、Pegaインスタンスを起動する必要があります。

起動には5分ほどかかることがありますので、しばらくお待ちください。

詳細なタスク

1 Run the List Vehicle models data page and test different Make values

  1. In the navigation pane of Dev Studio, click Data types to open the Data types explorer.
  2. Click Vehicle models, and then click List Vehicle models to edit the D_VehiclemodelsList data page.
    Screenshot showing the data type available to the user
  3. In the upper right, click Actions > Run. The Run Data Page window is displayed.
  4. In the Value field, enter Tesla as the test value. 
  5. In the upper right, click Run. The pxResultCount returns a value of 1 record.
    Screenshot showing result count.
  6. In the Value field, enter Opel, and then click Run. The pxResultCount returns a value of 0 records, which confirms that not all vehicle makes have at least one associated model.
    Screenshot showing result count.

 

2 Create a unit test

  1. In the Run Data Page window, in the Value field, enter Tesla.
  2. In the upper right, click Run. The Convert to test button is displayed.
  3. Click Convert to test to close the Run Data Page window and create a test case record for the data page that uses the results of your test.
    Screenshot showing how to convert to a test case.
    補足: The parameter value entered in the Run Data Page window is automatically populated in the Test Case form.
    Parameter value on unit test record populated with Make = Tesla
  4. On the Test Case form, in the Expected results section, verify that the Assertion type drop-down value is Expected run time.
  5. In the Value field, enter 0.2 to set the passing threshold for the unit test to 0.2 seconds.
    Unit test expected run time 0.2 seconds
  6. In the second Assertion type list, select Result count
  7. In the of object field, enter or select .pxResults.
  8. In the Comparator list, select is greater than.
  9. In the Value field, enter 0. The unit test validates that at least 1 record is returned from the data page when the Make parameter value is Tesla.
    Screenshot of config for expected result 2
  10. Click Save.
  11. In the Label field, enter VehicleModelsList_Tesla to name the test case record.
  12. In the Add to ruleset and version lists, verify that the highest ruleset version is selected.
    Screenshot showing how to save new test case rule.
  13. Click Submit.

3 Create unit tests for different vehicle makes

  1. In the VehicleModelsList_Tesla test case, to the right of Save, click the down arrow
    Save down arrow
  2. Click Save as.
  3. In the Label field, enter VehicleModelsList_Ford.
  4. Click Create and open to save a copy of the test case.
  5. To the right of Class, click the Gear icon to open the Edit details window and update the rule parameters.
    Screenshot showing where the settings gear icon is.
  6. In the Parameter(s) sent section, in the Make field, enter Ford.
    Screenshot showing how to modify test case parameters.
  7. Click Submit to close the Edit details window.
  8. In the Description field, click the Pencil icon to edit the vehicle make.
  9. Following the text parameters, <Make: update Tesla with Ford.
    Test case for VehicleModelsList_Opel
  10. In the VehicleModelsList_Tesla test case, click Save.
  11. Repeat steps 1-10, using VehicleModelsList_Opel as the test case label and Opel as the Make parameter.
    Test case for VehicleModelsList_Opel

4 Confirm your work

  1. From the Configure menu, click Application > Quality > Automated testing > Unit testing > Test cases to display all the unit tests that you created for the GoGoRoad application.
  2. To the left of the Test case name column, select the check box to select all the test cases.
  3. Click Run selected to execute the unit tests.
    Screenshot showing how to run test cases.
  4. In the Result column verify that the Tesla and Ford unit test cases passed and the Opel unit test case failed.
    Screenshot showing successful and unsuccessful test cases.
  5. To the right of Failed, click View to see additional information and investigate why the Opel Test Case failed. The Test Runs Log dialog box is displayed.
  6. Click the test result. The test results for VehicleModelsList_Opel are displayed.
    Screenshot showing failed test case info.


下記のミッションにも含まれています。

トレーニングを受講中に何か問題がありましたら、こちらをご覧ください: Pega Academy サポートのよくある質問 (FAQ).

このコンテンツは役に立ちましたか?

このコンテンツは 33% のユーザーにとって役に立ちました。

改善できるところはありますか?

We'd prefer it if you saw us at our best.

Pega Academy has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice