Hi,
I have a function which takes a struct as argument. This struct contains int64 variables.
I have used go mock for mocking unitest cases.
But the problem is when I pass int64 variables it says Got and Want are different at function level.(In arguments).
Running tool: /usr/local/go/bin/go test -timeout 30s -run ^Test_queryResolver_SellersByStatus$ query/gty_qry_bo/graph
=== RUN Test_queryResolver_SellersByStatus
=== RUN Test_queryResolver_SellersByStatus/TestCase_1
sam_id:"2" status:"PFA" per_page:2 page_no:1 count:true
=== CONT Test_queryResolver_SellersByStatus
graph/schema.resolvers.go:56: Unexpected call to *mocks.MockBoQueryClient.GetSellersByStatus([context.Background sam_id:"2" status:"PFA" per_page:2 page_no:1 count:true]) at gty_qry_bo/graph/schema.resolvers.go:56 because:
expected call at /gty_qry_bo/graph/internal_schema.resolvers_test.go:52 doesn't match the argument at index 1.
Got: sam_id:"2" status:"PFA" per_page:2 page_no:1 count:true (*generated.SellersByStatusRequest)
Want: is equal to sam_id:"2" status:"PFA" per_page:2 page_no:1 count:true (*generated.SellersByStatusRequest)
expected call at /graph/internal_schema.resolvers_test.go:64 doesn't match the argument at index 1.
Got: sam_id:"2" status:"PFA" per_page:2 page_no:1 count:true (*generated.SellersByStatusRequest)
Want: is equal to sam_id:"2" status:"PFA" per_page:2 page_no:2 count:true (*generated.SellersByStatusRequest)
=== CONT Test_queryResolver_SellersByStatus/TestCase_1
/graph/testing.go:1169: test executed panic(nil) or runtime.Goexit: subtest may have called FailNow on a parent test
=== CONT Test_queryResolver_SellersByStatus
gty_qry_bo/graph/controller.go:137: missing call(s) to *mocks.MockBoQueryClient.GetSellersByStatus(is equal to context.Background (*context.emptyCtx), is equal to sam_id:"2" status:"PFA" per_page:2 page_no:1 count:true (*generated.SellersByStatusRequest)) gty_qry_bo/graph/internal_schema.resolvers_test.go:52
gty_qry_bo/graph/controller.go:137: missing call(s) to *mocks.MockBoQueryClient.GetSellersByStatus(is equal to context.Background (*context.emptyCtx), is equal to sam_id:"2" status:"PFA" per_page:2 page_no:2 count:true (*generated.SellersByStatusRequest)) gty_qry_bo/graph/internal_schema.resolvers_test.go:64
gty_qry_bo/graph/controller.go:137: aborting test due to missing call(s)
--- FAIL: Test_queryResolver_SellersByStatus (0.00s)
--- FAIL: Test_queryResolver_SellersByStatus/TestCase_1 (0.00s)
FAIL
FAIL gateway_msvc/query/gty_qry_bo/graph 0.464s
But test cases are passed when I add fmt.Println(arg1) in Recorder function.
Does fmt.Println does any thing?
Running tool: /usr/local/go/bin/go test -timeout 30s -run ^Test_queryResolver_SellersByStatus$ golang/gateway_msvc/query/gty_qry_bo/graph
=== RUN Test_queryResolver_SellersByStatus
sam_id:"2" status:"PFA" per_page:2 page_no:1 count:true
sam_id:"2" status:"PFA" per_page:2 page_no:2 count:true
=== RUN Test_queryResolver_SellersByStatus/TestCase_1
sam_id:"2" status:"PFA" per_page:2 page_no:1 count:true
=== RUN Test_queryResolver_SellersByStatus/TestCase_2
sam_id:"2" status:"PFA" per_page:2 page_no:2 count:true
--- PASS: Test_queryResolver_SellersByStatus (0.00s)
--- PASS: Test_queryResolver_SellersByStatus/TestCase_1 (0.00s)
--- PASS: Test_queryResolver_SellersByStatus/TestCase_2 (0.00s)
PASS
ok golang/gateway_msvc/query/gty_qry_bo/graph 0.415s
Thanks,
Akhil