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

Add execution time in test run response #612

Merged
merged 5 commits into from
Jun 1, 2022
Merged

Add execution time in test run response #612

merged 5 commits into from
Jun 1, 2022

Conversation

schoren
Copy link
Collaborator

@schoren schoren commented Jun 1, 2022

This PR adds execution time to the api response. It returns the diff in seconds from createdAt to either completedAt if the test completed, or time.Now() if the test is not completed.

To ensure that run dates and other info is correctly set, I've centralized the state updating into functions within the model.

Changes

  • add executionTime field to openapi RestRun
  • add ExecutionTime() func to model.Run
  • move run state change logic to encapsulated functions

Checklist

  • tested locally
  • added new dependencies
  • updated the docs
  • added a test


func (r Run) Copy(testVersion int) Run {
r.Results = nil
r.Trace = nil
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trace should be kept. This is being called by the rerun command and today it doesn't (and shouldn't) retrigger the transaction to run the test, it assumes the trace didn't change and only re-execute the assertion engine using the latest test definition.

@schoren schoren requested a review from mathnogueira June 1, 2022 16:49
Copy link
Member

@mathnogueira mathnogueira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@schoren schoren linked an issue Jun 1, 2022 that may be closed by this pull request
@schoren schoren merged commit af44643 into main Jun 1, 2022
@schoren schoren deleted the add-execution-time branch June 1, 2022 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Execution time is showing negative
2 participants