[go test] pure Test Classes.

64 views
Skip to first unread message

sumith s

unread,
Jul 26, 2023, 3:44:12 AM7/26/23
to golang-nuts
Currently, we do not have pure Test Classes defined by us. We are using Golang specific Test Class structure. Each FILENAME_test.go will have its own test class under "Golang Test".
I'm trying to define a  pure Test Classes. how can do that?

Jan Mercl

unread,
Jul 26, 2023, 5:31:19 AM7/26/23
to sumith s, golang-nuts
On Wed, Jul 26, 2023 at 9:44 AM sumith s <sumith...@gmail.com> wrote:

> Currently, we do not have pure Test Classes defined by us. We are using Golang specific Test Class structure. Each FILENAME_test.go will have its own test class under "Golang Test".
> I'm trying to define a pure Test Classes. how can do that?

(Go does not have classes. Go has types and types may have methods attached.)

Anyway, please explain what you mean by "pure" in "pure Test Classes".

The go tool, when invoked like "go test" looks for functions in files
matching '.*_test.go', with name matching 'Test.*' and the signature
func(t *testing.T), "testing" being the stdlib package. Such functions
will be then executed automatically during the test.

It is of course possible to write any other kind of tests and invoke
them independently of the "go test" facility, using any preferred
method of doing so.
Reply all
Reply to author
Forward
0 new messages