interfaces.go 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package suite
  2. import "testing"
  3. // TestingSuite can store and return the current *testing.T context
  4. // generated by 'go test'.
  5. type TestingSuite interface {
  6. T() *testing.T
  7. SetT(*testing.T)
  8. }
  9. // SetupAllSuite has a SetupSuite method, which will run before the
  10. // tests in the suite are run.
  11. type SetupAllSuite interface {
  12. SetupSuite()
  13. }
  14. // SetupTestSuite has a SetupTest method, which will run before each
  15. // test in the suite.
  16. type SetupTestSuite interface {
  17. SetupTest()
  18. }
  19. // TearDownAllSuite has a TearDownSuite method, which will run after
  20. // all the tests in the suite have been run.
  21. type TearDownAllSuite interface {
  22. TearDownSuite()
  23. }
  24. // TearDownTestSuite has a TearDownTest method, which will run after
  25. // each test in the suite.
  26. type TearDownTestSuite interface {
  27. TearDownTest()
  28. }
  29. // BeforeTest has a function to be executed right before the test
  30. // starts and receives the suite and test names as input
  31. type BeforeTest interface {
  32. BeforeTest(suiteName, testName string)
  33. }
  34. // AfterTest has a function to be executed right after the test
  35. // finishes and receives the suite and test names as input
  36. type AfterTest interface {
  37. AfterTest(suiteName, testName string)
  38. }