Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Error ¶
type Error struct { Message string `xml:"message,attr,omitempty"` Type string `xml:"type,attr,omitempty"` Content string `xml:",chardata"` }
Error corresponds to an error tag inside testcase and should be added every time an error happens during testing. A test case can have several errors. It has three fields: Message, Type, and Content. Message maps to the message optional attribute, which can take the error message. Type maps to the type optional attribute, which can take the error type, and Content maps to the tag's content text, which can be a detailed representation of the error, eg: message and stack trace.
func NewAnonymousError ¶
NewAnonymousError returns an Error with the given content, but no message and type
type Failure ¶
type Failure struct { Message string `xml:"message,attr,omitempty"` Type string `xml:"type,attr,omitempty"` Content string `xml:",chardata"` }
Failure corresponds to a failure tag inside testcase and should be added every time a failure happens during testing. A test case can have several failures. It has three fields: Message, Type, and Content. Message maps to the message optional attribute, which can take the failure message. Type maps to the type optional attribute, which can take the failure type, and Content maps to the tag's content text, which can be a detailed representation of the failure, eg: message, class, and file.
func NewAnonymousFailure ¶
NewAnonymousError returns a Failure with the given content, but no message and type
type TestCase ¶
type TestCase struct { ID string `xml:"id,attr,omitempty"` Name string `xml:"name,attr,omitempty"` Time time.Duration `xml:"time,attr,omitempty"` Classname string `xml:"classname,attr,omitempty"` Content string `xml:",chardata"` Failures []*Failure `xml:"failure"` Errors []*Error `xml:"error"` // contains filtered or unexported fields }
TestCase maps to a testcase tag which represents a test case. It has the following fields: ID: optional test case ID. Maps to the id attribute. The attribute is omitted if empty. If given, an ID must be unique in the test suite. Name: optional test case name. Maps to the name attribute. The attribute is omitted if empty. Time: optional duration of the test. Maps to the time attribute. Omitted if empty. Classname: optional name of the module beiong tested. Maps to the classname attribute. Omitted if empty. Content: optional text content of the test. Maps to the content of the tag. Failures: test failures. Each element maps to its own failure tag. Errors: test errors. Each element maps to its own error tag.
func NewAnonymousTestCase ¶
func NewAnonymousTestCase() *TestCase
NewAnonymousTestCase returns an empty test case
func NewTestCase ¶
NewTestCase returns a test case with the given id, name, and classname
func (*TestCase) AddFailure ¶
AddFailure adds a failure to the test case
func (*TestCase) SetContent ¶
SetContent sets the test case content
type TestSuite ¶
type TestSuite struct { ID string `xml:"id,attr,omitempty"` Name string `xml:"name,attr,omitempty"` Time time.Duration `xml:"time,attr,omitempty"` Tests int `xml:"tests,attr"` Failures int `xml:"failures,attr"` Errors int `xml:"errors,attr"` TestCases []*TestCase `xml:"testcase,omitempty"` }
TestSuite maps to a testsuite tag which represents a set of test cases. It has the following fields: ID:optional test suite ID. Maps to the id attribute. The attribute is omitted if empty. If given, an ID must be unique in the test suites. Name: optional test suite name. Maps to the name attribute. The attribute is omitted if empty. Time: optional duration of the suite. Maps to the time attribute. Omitted if empty. This field is calculated automatically by Testsuites.MakeReport(). Tests: total amount of test cases in the suite. Maps to the tests attribute. This field is calculated automatically by Testsuites.MakeReport(). Failures: total amount of failures cases in the suite. Maps to the failures attribute. This field is calculated automatically by Testsuites.MakeReport(). Errors: total amount of errors in the suite. Maps to the errors attribute. This field is calculated automatically by Testsuites.MakeReport(). TestCases: test cases in the suite. Each element maps to its own testcase tag.
func NewAnonymousTestSuite ¶
func NewAnonymousTestSuite() *TestSuite
NewAnonymousTestSuite returns a new empty TestSuite
func NewTestSuite ¶
NewTestSuite returns a new TestSuite with the given id and name
func (*TestSuite) AddTestCase ¶
AddTestCase adds a TestCase to the suite. If the test case has an ID, it must be unique within the suite. If it isn't an error is returned.
func (*TestSuite) RemoveTestCase ¶
RemoveTestCase removes a test case with the given id from the suite if it exists
type TestSuites ¶
type TestSuites struct { XMLName xml.Name `xml:"testsuites"` ID string `xml:"id,attr,omitempty"` Name string `xml:"name,attr,omitempty"` Tests int `xml:"tests,attr"` Failures int `xml:"failures,attr"` Errors int `xml:"errors,attr"` Time time.Duration `xml:"time,attr,omitempty"` TestSuites []*TestSuite `xml:"testsuite,omitempty"` }
TestSuites maps to a testsuites tag which represents a set of test suites. It has the following fields: ID: optional ID. Maps to the id attribute. The attribute is omitted if empty. Name: optional name. Maps to the name attribute. The attribute is omitted if empty. Tests: total amount of test cases. Maps to the tests attribute. This field is calculated automatically by Testsuites.MakeReport(). Failures: total amount of failures. Maps to the failures attribute. This field is calculated automatically by Testsuites.MakeReport(). Errors: total amount of errors. Maps to the errors attribute. This field is calculated automatically by Testsuites.MakeReport(). Time: optional duration of the test. Maps to the time attribute. Omitted if empty. TestSuites: test suites. Each element maps to its own testsuite tag.
func NewAnonymousTestSuites ¶
func NewAnonymousTestSuites() *TestSuites
NewAnonymousTestSuites returns an empty TestSuites
func NewTestSuites ¶
func NewTestSuites(id string, name string) *TestSuites
NewTestSuites creates a new TestSuites with the given id and name
func (*TestSuites) AddTestSuite ¶
func (suites *TestSuites) AddTestSuite(suite *TestSuite) error
AddTestSuite add a TestSuite to the TestSuites. If the test suite has an ID, it must be unique within the suites. If it isn't an error is returned.
func (*TestSuites) MakeReport ¶
func (suites *TestSuites) MakeReport() ([]byte, error)
MakeReport generates the report XML as a slice of bytes. It is useful for any output other than generating a file. For saving the report as a file you should use SaveReport instead. All values are automatically calculated when calling this method.
func (*TestSuites) RemoveTestSuite ¶
func (suites *TestSuites) RemoveTestSuite(id string)
RemoveTestSuite removes a suite with the given id if it exists.
func (*TestSuites) SaveReport ¶
func (suites *TestSuites) SaveReport(filename string) error
SaveReport saves the report XMl in the given file name with the 644 permission settings. All values are automatically calculated when calling this method.