[Generate Function Call Flow Contents by Test case]功能以表格和树形格式输出测试用例执行过程中调用的函数。

  1. 在单元测试视图中,右键单击测试或测试用例,然后选择[Generate Function Call Flow Contents by Test case]。测试和测试用例可以多选。
  1. 执行[Generate Function Call Flow Contents by Test case]后,弹出[Execute Test Success]窗口。
  1. 单击 [Execute Test Success] 窗口中的 [Open Folder] 按钮。包含函数调用流程内容文件的目录将被打开。
  • 该文件包括函数的名称和参数。显示函数调用流程有两种类型。
    • Table
      • 调用关系显示在两列中。
      • 调用方函数在第一列,被调用方函数在第二列。
    • Tree
      • 函数调用信息根据调用深度分多列显示。
      • 如果调用位于不同位置,功能调用信息会显示在不同行上。
  • 如果同一个函数被多次调用,则会以缩略方式打印调用信息。
    • 在函数签名后添加 [called # times] ,表示调用次数。
    • 例如,如果一个函数被连续调用 5 次,则 [called 5 times] 会被附加到第一个函数签名上。
  • 在项目的 [Properties] > [Test] > [Other option]中,启用 [Hide functions excluded in coverage measurement when generating function call flow]可防止出现排除函数的节点。

示例

// 示例代码
void callee() { /*doing something*/ }
void callee2() { /*doing something*/ }
void func1() { callee(); callee2(); }
void func2() { callee(); callee(); callee(); }
void caller() { func1(); func2(); }
  • Table
    调用函数 被调用函数
    caller() func1()
    func1() callee()
    func1() callee2()
    caller() func2()
    func2() callee() [调用3次]
  • 覆盖范围测量中排除了隐藏函数的表格
    • 覆盖范围测量中不包括的函数: func1()
      调用函数 被调用函数
      caller() callee()
      caller() callee2()
      caller() func2()
      func2() callee() [调用3次]
  • Tree
    caller() func1() callee()
    callee2()
    func2() callee() [调用3次]
  • 覆盖范围测量中不包括隐藏函数的树
    • 覆盖范围测量中不包括的函数: func1()
      caller() callee()
      callee2()
      func2() callee() [调用3次]

Need more help with this?
Don’t hesitate to contact us here.

Thanks for your feedback.