本章节:

引言

您可以将 Selenic 分析的测试结果发送到 Parasoft DTP,后者收集、处理和生成数据的可视化。DTP 将高级开发和测试分析应用于其收集的数据,以便开发经理和项目成员可以评估其软件的状态。有关查看发送到 DTP 的数据的信息,请参阅查看 DTP 中的结果


从命令行运行 selenic_analyzer.jar 以将测试结果发送到 DTP(请参阅命令行)。

全局配置 

必须在 selenic.properties 文件(请参阅许可证)中配置与 DTP 的连接,才能将数据发送到 DTP  如果您使用从 DTP 提供的网络许可证,Selenic 会将测试结果报告给您连接到的同一 DTP 实例,以检索许可证如果您不想使用 DTP 的网络许可证,您可以配置本地许可证以启用 Selenic 功能,但仍必须配置与 DTP 的连接以发送测试结果。 

在 DTP 中连接到项目

除了配置与 DTP 的连接外,您还需要指定应接收数据的 DTP 项目。打开位于 Selenic 安装目录中的 selenic.properties 文件,并在 DTP SERVER SETTINGS 部分中指定您的项目名称:

# Specifies host name of the DTP server.
dtp.server=<host where DTP is running>

# Specifies port number of the DTP server.
# Commonly used values are 443 and 8443.
dtp.port=<port where DTP is running>

# Specifies user name for DTP server authentication.
dtp.user=<user name to log into DTP>

# Specifies password for DTP server authentication - use java -jar selenic_analyzer.jar -encodepass <PASSWORD> to encode the password, if needed.
dtp.password=<password to log into DTP>

# Specifies name of the DTP project (optional).
dtp.project=<name of your project on DTP>

启用报告到 DTP

将 REPORTING 部分中的 report.dtp.publish 属性设置为 true

# === REPORTING ===

# Enables reporting test results to DTP server - be sure to configure DTP server settings.
report.dtp.publish=true

当启用 report.dtp.publish 选项时,默认情况下,Selenic 还将测试代码源文件的副本发布到 DTP。有关更改此行为的详细信息,请参阅发布源文件至 DTP。 

发布源文件至 DTP

如果启用了 report.dtp.publish 选项,Selenic 将默认发布  JUnit 或 TestNG 源文件的副本。将源码发布到 DTP 后,您可以在测试资源管理器视图中查看它们以及测试详细信息。有关使用测试资源管理器视图的更多信息,请参阅 DTP 文档。

如果您的测试文件存储在源代码管理中,您也可以通过配置 Selenic 与 DTP 共享源代码管理设置来启用 DTP 以显示源代码。有关详细信息,请参阅配置源代码管理设置

使用 REPORTING 部分中的 report.dtp.publish.src 设置指定发布模式,以控制如何将源代码发布到 DTP:

# === REPORTING ===

# Enables reporting test results to DTP server - be sure to configure DTP server settings.
report.dtp.publish=true

# Specifies whether the tested source code is published to the DTP server. Options are "full", "min", and "off"
report.dtp.publish.src=full

您可以指定以下模式:

full 指定范围内的所有源代码都发布到 DTP。 这是启用 report.dtp.publish 选项时的默认设置。
min 发布的源代码最少。在大多数情况下,将发布自动生成的代码和其他没有源代码管理引用的源代码。
off 源代码未发布到 DTP。

默认情况下,Selenic 将检查当前目录中的源文件。如果您的源文件存储在另一个目录中,请在运行 selenic_analyzer.jar 文件时使用 -source 选项指定源的位置。有关用法的详细信息,请参阅 命令行

设置自定义构建 ID

每个测试执行都与一个构建 ID 相关联,这是用于对一组测试运行进行分组的唯一标识符。有关构建 ID 的更多信息,请参阅 DTP 文档。默认情况下,项目名称和执行日期用作构建 ID,但您可以取消注释 build.id 属性并指定您自己的值:

# === REPORTING ===

# Enables reporting test results to DTP server - be sure to configure DTP server settings.
report.dtp.publish=true

# Specifies whether the tested source code is published to the DTP server. Options are "full", "min", and "off"
# report.dtp.publish.src=full

# Specifies a build identifier used to label results. It may be unique for each build
# but may also label more than one test sessions that were executed during a specified build.
build.id=<your custom build ID>

设置会话标签

您可以通过取消注释 session.tag 属性并指定一个值来区分执行环境、测试模块等:

# === REPORTING ===

# Enables reporting test results to DTP server - be sure to configure DTP server settings.
report.dtp.publish=true

# Specifies a build identifier used to label results. It may be unique for each build
# but may also label more than one test sessions that were executed during a specified build.
build.id=<your custom build ID>

# Specifies a tag which represents an unique identifier for the run, used to distinguish it from similar runs.
# It could be constructed as minimal combination of following variables that will make it unique or specified manually.
# e.g. ${dtp_project}-${exec_env}
 session.tag=<your custom session tag>

默认情况下,使用 DTP 项目名称和执行环境(操作系统和体系结构)。

会话标签与会话 ID

不要将会话标签与会话 ID 混淆。会话标签是用于在 DTP 报告界面中分割数据的标识符,而会话 ID 是 Selenic 分析器用来区分 Selenic 代理收集的测试运行数据的标识符。 

从命令行发布结果

您还可以在命令行中使用 -publish 标志来配置 Selenic,以便在每次执行 selenic_analyzer.jar 文件时将结果发布到 DTP(请参阅 命令行)。但是,您仍必须配置与 DTP 的连接以及 selenic.properties 文件中的 dtp.project 属性。     


  • No labels