Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duration in HTML report is wrong #1438

Closed
vincent-psarga opened this issue Jul 1, 2020 · 3 comments
Closed

Duration in HTML report is wrong #1438

vincent-psarga opened this issue Jul 1, 2020 · 3 comments
Labels
🐛 bug Defect / Bug ⌛ stale Will soon be closed by stalebot unless there is activity

Comments

@vincent-psarga
Copy link
Contributor

vincent-psarga commented Jul 1, 2020

Describe the bug

When running cucumber -f html, the html report has a duration field with incorrect data (sometimes even a negative duration).

Not sure if this comes from the cucumber/react lib or the values generated in the messages.

Expected behavior

Have a valid duration for the run.

Extra would be a readable format too (not like 1234567890ms but 14d 6h 56min 7s 890ms)

Context & Motivation

How has this issue affected you? What are you trying to accomplish? Providing context helps us come up with a solution that is most useful in the real world.

Screenshots
If applicable, add screenshots to help explain your problem.

Your Environment

  • Versions used: 4.1.0
  • Operating System and version [e.g. * Operating System and version:]
  • Build tool (if applicable)

Additional context
Add any other context about the problem here

@vincent-psarga vincent-psarga added the 🐛 bug Defect / Bug label Jul 1, 2020
@vincent-psarga
Copy link
Contributor Author

I've made some tests about that:

require 'cucumber/formatter/io'
require 'cucumber/formatter/message_builder'

module Cucumber
  module Formatter
    # The formatter used for <tt>--format message</tt>
    class TestRunDuration < MessageBuilder
      include Io

      def initialize(config)
        @io = ensure_io(config.out_stream)
        super(config)
      end

      def output_envelope(envelope)
        if envelope.test_run_started
          Kernel.puts "Started at: #{timestamp_to_time(envelope.test_run_started.timestamp)}"
        end

        if envelope.test_run_finished
          Kernel.puts "Finished at: #{timestamp_to_time(envelope.test_run_finished.timestamp)}"
        end
      end
    end
  end
end

Which outputs:

bundle exec cucumber -f Cucumber::Formatter::TestRunDuration                                  

WARNING: Nokogiri was built against LibXML version 2.9.10, but has dynamically loaded 2.9.4
Started at: 2020-07-01 11:31:06 +0200
Finished at: 2020-07-01 11:31:10 +0200

So that looks good or the Ruby side (at least, Ruby is able to recreate a Date which seems more than plausible from the Timestamps of the TestRunStarted and TestRunFinished messages.

Now when feeding that to Javascript (in cucucmber/react), I'm unable to translate that to a real date.

@stale
Copy link

stale bot commented Aug 31, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in a week if no further activity occurs.

@stale stale bot added the ⌛ stale Will soon be closed by stalebot unless there is activity label Aug 31, 2020
@stale
Copy link

stale bot commented Sep 7, 2020

This issue has been automatically closed because of inactivity. You can support the Cucumber core team on opencollective.

@stale stale bot closed this as completed Sep 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Defect / Bug ⌛ stale Will soon be closed by stalebot unless there is activity
Projects
None yet
Development

No branches or pull requests

1 participant