使用 Cucumber 测试 Highcharts(JS 图表库)

发布于 2024-10-29 03:08:45 字数 904 浏览 0 评论 0原文

我有一个应用程序,我们可以在其中帮助客户通过使用 highcharts 呈现的图表来可视化数据。数据处理和可视化是我们的应用程序提供的主要价值,换句话说,它很重要并且应该进行测试。

我正在使用 Cucumber 为应用程序编写集成测试,我想包括我们的 highcharts 实现的一些基本测试。我特别热衷于测试是否绘制了正确的数据以及自定义 ajax 交互是否正常工作。示例功能可能如下所示:

Feature: Plot Related Alarm Data
  As an project owner
  I want to see antecedent data plotted around the time of the alarm
  So that I can diagnose the issue and save gobs of money.

  Background:
    Given a bunch of stuff is set up
    And I am logged in
    # ...

  Scenario: Alarm data is plotted
    Given I have an alarm
    # ...
    When I visit the alarm show page
    Then I should see 5 days of data in my graph

  Scenario: Alarm data is clicked
    Given # ...
    When # ...
    And I click on a data point
    Then I should be on the data page

任何测试此类内容以及使用 Selenium、Watir 等工具的经验都将受到赞赏。

I have an application in which we help our clients visualize data via graphs rendered with highcharts. The data processing and visualization is the primary value our application provides, in other words its important and should be tested.

I am using cucumber to write integration tests for the application, I would like to include some basic tests of our highcharts implementation. I am especially keen to test that the correct data is being plotted as well as that custom ajax interactions are working correctly. An example feature might look something like this:

Feature: Plot Related Alarm Data
  As an project owner
  I want to see antecedent data plotted around the time of the alarm
  So that I can diagnose the issue and save gobs of money.

  Background:
    Given a bunch of stuff is set up
    And I am logged in
    # ...

  Scenario: Alarm data is plotted
    Given I have an alarm
    # ...
    When I visit the alarm show page
    Then I should see 5 days of data in my graph

  Scenario: Alarm data is clicked
    Given # ...
    When # ...
    And I click on a data point
    Then I should be on the data page

Any experience testing things like this and which tool Selenium, Watir, etc was used would be appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

尘世孤行 2024-11-05 03:08:46

我使用的策略:

  1. 在 HTML 表中呈现数据,
  2. 在 JavaScript 中生成图表
    使用该表中的数据(例如 http://www.highcharts.com/demo/column-parsed
  3. 使用 Cucumber 只是为了
    验证该表包含
    使用 通过 tableish 进行表差异的预期数据

A strategy that I've used:

  1. render the data in an HTML table
  2. generate the chart in JavaScript
    using the data from that table (e.g. http://www.highcharts.com/demo/column-parsed)
  3. use Cucumber just to
    verify that the table contains the
    expected data using table diffs via tableish
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文