mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 02:21:29 +08:00
31 lines
508 B
Go
31 lines
508 B
Go
package ga
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestSendEvents(t *testing.T) {
|
|
event := EventTracking{
|
|
Category: "unittest",
|
|
Action: "SendEvents",
|
|
Value: 123,
|
|
}
|
|
err := gaClient.SendEvent(event)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
|
|
func TestStructToUrlValues(t *testing.T) {
|
|
event := EventTracking{
|
|
Category: "unittest",
|
|
Action: "convert",
|
|
Label: "v0.3.0",
|
|
Value: 123,
|
|
}
|
|
val := structToUrlValues(event)
|
|
if val.Encode() != "ea=convert&ec=unittest&el=v0.3.0&ev=123" {
|
|
t.Fail()
|
|
}
|
|
}
|