Post

GoLangGoLang

s
sri kanth

Posted on 21st February 2024|50 views

0
votes

Golang Test Setup

How can I do a test setup by the test package in Golang?

Is there any possible way to do entire test setup processing that is available for every test when utilizing the test package.

Example:

[TestFixture] 

public class SuccessTests { 

[SetUp] public void Init()

 { /* Loads the test data */ } }

 

Answers
P
Aryan Sharma

Posted on 21st February 2024

This can be accomplished by placing a init() function within the _test.go file. That will be run ere the init() function. 

package main

 func init() 

{ /* loads the test data */ }

 

 

Write your answer

STILL GOT QUERIES?

Get a Live FREE Demo
  • Explore the trending and niche courses and learning maps
  • Learn about tuition fee, payment plans, and scholarships
  • Get access to webinars and self-paced learning videos