feat: report GA4 events for hrp cmd

This commit is contained in:
lilong.129
2023-07-23 23:59:01 +08:00
parent 0a88e3a57f
commit bc65eb9809
24 changed files with 229 additions and 34 deletions

View File

@@ -199,6 +199,7 @@ func (r *HRPRunner) Run(testcases ...ITestCase) (err error) {
defer func() {
// report run event
sdk.SendGA4Event("hrp_run", map[string]interface{}{
"success": err == nil,
"engagement_time_msec": time.Since(startTime).Milliseconds(),
})
}()
@@ -512,6 +513,9 @@ func (r *SessionRunner) inheritConnection(src *SessionRunner) {
// Start runs the test steps in sequential order.
// givenVars is used for data driven
func (r *SessionRunner) Start(givenVars map[string]interface{}) error {
// report GA event
sdk.SendGA4Event("hrp_session_runner_start", nil)
config := r.caseRunner.testCase.Config
log.Info().Str("testcase", config.Name).Msg("run testcase start")