From 160ccbb220425e242016a3b7d675ca8fe26038e4 Mon Sep 17 00:00:00 2001 From: Carlosokumu Date: Thu, 5 Dec 2024 14:05:32 +0300 Subject: [PATCH] read test file from test run arg --- menutraversal_test/menu_traversal_test.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/menutraversal_test/menu_traversal_test.go b/menutraversal_test/menu_traversal_test.go index d79b771..28d88db 100644 --- a/menutraversal_test/menu_traversal_test.go +++ b/menutraversal_test/menu_traversal_test.go @@ -3,6 +3,7 @@ package menutraversaltest import ( "bytes" "context" + "flag" "log" "math/rand" "os" @@ -15,14 +16,15 @@ import ( ) var ( - testData = driver.ReadData() - testStore = ".test_state" - groupTestFile = "group_test.json" - sessionID string - src = rand.NewSource(42) - g = rand.New(src) + testData = driver.ReadData() + testStore = ".test_state" + sessionID string + src = rand.NewSource(42) + g = rand.New(src) ) +var groupTestFile = flag.String("test-file", "group_test.json", "The test file to use for running the group tests") + func GenerateSessionId() string { uu := uuid.NewGenWithOptions(uuid.WithRandomReader(g)) v, err := uu.NewV4() @@ -337,7 +339,7 @@ func TestMainMenuSend(t *testing.T) { } func TestGroups(t *testing.T) { - groups, err := driver.LoadTestGroups(groupTestFile) + groups, err := driver.LoadTestGroups(*groupTestFile) if err != nil { log.Fatalf("Failed to load test groups: %v", err) }