Why do all test files show 0.1s or 0s time execution for my CI build in the user dashboard?
If you navigate to the user dashboard, open Build metrics
for your API token, and then open the CI build for your last git commit, you should see information about the collected execution time data from all CI nodes. If you observe that all test files have execution times of 0.1s or 0 seconds, consider the following:
- For
knapsack_pro
versions older than 3.1.0, you should avoid cleaning thetmp
directory in your tests (for example, in RSpec hooks likebefore
orafter
). This is becauseknapsack_pro
needs to publish the measured execution time data to the Knapsack Pro API server. Theknapsack_pro
Queue Mode (versions earlier than 3.1.0) saves temporary files with collected execution time data in theyour_rails_project/tmp/knapsack_pro/queue/
directory. Versions ofknapsack_pro
3.1.0 and above use the.knapsack_pro
directory to store temporary files. - Please ensure that your
rails_helper.rb
orspec_helper.rb
includes the following line to enable measurement of test execution times:
require 'knapsack_pro'
# CUSTOM_CONFIG_GOES_HERE
KnapsackPro::Adapters::RSpecAdapter.bind
A default execution time of 0.1s is used when a test file is empty or contains only pending tests, applicable for knapsack_pro
version 2.11.0 and below.
Since version 2.12.0, knapsack_pro
assigns a default execution time of 0 seconds for tests that are not executed.