运行单元测试的步骤:

  1. 选择您想要测试的资源(单个文件、多个文件或整个项目)的导航节点。
  2. 如果尚未准备好测试套件(或者您想要添加更多自动生成的测试用例),可运行“Generate Unit Tests”测试配置
  3. 如果您想要自动生成桩函数,可运行“Generate Stubs”测试配置。
  4. 确定哪一种启动测试的内建测试配置最符合您的需求:“Run IAR <arch> Tests”或“Run IAR EW Tests (Batch Template)”。请参阅支持概述获取帮助。
  5. 如有必要,可按以下方式修改所选测试配置的测试流程:
    1. 打开测试配置管理器,从内建> Embedded Systems> IAR Systems 中选择测试配置并复制。
    2. 在复制的测试配置中,打开执行选项卡,然后在测试执行流程列表下方的表中调整相应的属性。
    3. 按以下方式编辑属性:
      • 对于“Execute tests on IAR C-SPY Simulator”流程,检查并调整“Toolkit binaries location”和“C-SPY execution backend options”设置。
      • 对于“Execute tests on IAR C-SPY Simulator using EW-generated batch script template”,提供“Original IAR EW project location”并检查“Original IAR EW project name”位置。
      • 对于“Build and run tests on IAR C-SPY Simulator using EW-generated batch script template”或“Build and run application on IAR C-SPY Simulator using EW-generated batch script template”测试流程和更新的 EW 版本,提供“IAR EW project Build Configuration”。
      • 对于“Build and run tests on IAR C-SPY Simulator using EW-generated batch script template”或“Build and run application on IAR C-SPY Simulator using EW-generated batch script template”测试流程和更老的 EW 版本,将“Adjust CSpyBat command”设置为“true”。
  6. 点击应用以应用变更。
  7. 选择您想要测试的资源(单个文件、多个文件或整个项目)的导航节点,然后运行新的测试配置。

调试测试用例

C++test 在此环境下不支持直接进行测试用例调试。

使用“外部构建可执行文件”Embedded Workbench 项目类型,并对所需测试用例手动设置断点。

  • No labels