PeopleSoft 测试 - 捕获 CreateProcessRequest 错误

PeopleSoft Testing - Catch CreateProcessRequest error

我目前正在进行组件测试rn,测试条件之一是捕获CreateProcessRequest的错误。我有这个代码:

/define run control parameters – see code below/

Local ProcessRequest &RQST;

&RUN_PO_BU = PO_HDR.BUSINESS_UNIT;

&RUN_PO_ID = PO_HDR.PO_ID;

&RUN_OPRID = PO_PNLS_WRK.OPRID;

&RunCntlID = "PS_PO_" | &RUN_PO_BU | &RUN_PO_ID | "_" | UniqueRunCntlID();

&MI_SQRProcess = "Test";

&RQST = CreateProcessRequest("SQR Process", &MI_SQRProcess);

&RQST.RunControlID = &RunCntlID;

&RQST.Schedule();

&instanceList = &RQST.ProcessInstance;

If &RQST.Status = 0 Then

    <do something>;

Else

 Error MsgGet(99999, 99999, "%1 process with instance %2 returned a non->zero exit code(%3)", &MI_SQRProcess, &instanceList, &RQST.Status);

End-If;

所以,我的问题是我要做什么(处理)让 CreateProcessRequest 运行 错误(或 return 非零退出代码)或者它是如何工作的,所以我可以创建条件并测试它。谢谢:)

What I'm trying to do is to let my code ran to error so that I can catch it for my testing. How would I let the CreateProcessRequest return a non-zero exit code.

如果我没理解错的话,听起来您想知道如何使 &RQST.Status 包含非零值(即错误)。

您是否尝试过在实例化对象时传入错误的参数?

查看 PeopleBooks,CreateProcessRequest() is followed by Schedule(),成功后 returns 值为 0。

schedule() 文档说

  • If you’re scheduling a single process, you must assign values to the following properties:
    • RunControlID
    • ProcessName
    • ProcessType

您是否尝试过 运行 不设置 RunControlID 的计划?

注释掉这一行会怎样?

&RQST.RunControlID = &RunCntlID;