Documentation
¶
Index ¶
- Constants
- type Activity
- type BaseModel
- type Build
- type BuildItem
- type Category
- type Comment
- type Execution
- type History
- type HistoryTestCaseUnit
- type Issue
- type JSTreeNode
- type JSTreeTestCaseWrapper
- type JSTreeTestSuiteWrapper
- type JSTreeTestSuiteWrapperWithChildren
- type Milestone
- type Project
- type ReqType
- type Requirement
- type Review
- type Section
- type TcReqRelationHistory
- type TestCase
- type TestCaseResult
- type TestPlan
- type User
Constants ¶
const ( ExecStatusReady = 1 + iota ExecStatusInProgress ExecStatusNotAvailable ExecStatusDone ExecStatusDeny ExecStatusPass ExecStatusFail )
status for test execution
const ( HistoryChangeTypeChanged = 1 + iota HistoryChangeTypeSet HistoryChangeTypeNote HistoryChangeTypeDiff )
History change type defined.
const ( MilestoneStatusActive = 1 + iota MilestoneStatusDone )
Milestone status defined.
const ( ProjectStatusActivate = 1 + iota ProjectStatusInactivate ProjectStatusClose )
Project Status enumulations
const ( ReqStatusDraft = 1 + iota ReqStatusInReview ReqStatusRework ReqStatusFinished ReqStatusNotTestable ReqStatusDeprecated )
Status of requirements Draft, In Review, Rework, Finished, Not Testable, Deprecated
const ( ReviewTestcase = 1 + iota ReviewBug )
const ( ReviewStatusReady = 1 + iota ReviewStatusInProgress ReviewStatusReject ReviewStatusDone )
const ( TcReqRelationHistoryLink = 1 + iota TcReqRelationHistoryUnlink )
Kind of this object
const ( PriorityHighest = 1 + iota PriorityHigh PriorityMedium PriorityLow PriorityLowest )
The priority of TestCase
const ( TcStatusActivate = 1 + iota TcStatusInactivate TcStatusDraft )
The status of TestCase
const ( RoleAdmin = 1 + iota RoleManager RoleUser RoleGuest )
const (
HISTORY_TYPE_TC = 1 + iota
)
History type defined. The type may be TC or something else
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseModel ¶
type BaseModel struct {
//gorm handles ID field as identifier of the table automatically
ID int
// belows are also gorm handles field.
CreatedAt time.Time
UpdatedAt time.Time `json:"-"`
DeletedAt *time.Time `json:"-"`
}
BaseModel is base of all models in Ladybug. This depends on GORM package. If GORM library is replaced, consider and define again this struct
func (BaseModel) ValidateEmail ¶
ValidateEmail checks whether the given email is valid or not
type Build ¶
type Build struct {
BaseModel
Name string
Description string
Project Project
Project_id int
BuildUrl string // build url
ToolName string // manual, jenkins, teamcity ....
Status int // 0 : unknown 1 : successful, 2 : failed and so on....
BuildItemNum int // total build items of this build project
BuildItems []BuildItem
}
Build is a set of several BuildItems.
type BuildItem ¶
type BuildItem struct {
BaseModel
BuildProject Build // TODO index.. or something else
BuildProjectID int // id for build. TODO index?
Toolname string // jenkins, .....
IdByTool string // for example, jenkins builds id is string
IdByToolInt int
DisplayName string // for example in jenkins : "#3"
/* for example in jenkins : "cJson #3".
This is the text what user see in test execution, testplan pages */
FullDisplayName string
ItemUrl string
ArtifactsUrl string
ArtifactsName string
Result string // for example in jenkins "SUCCESS"
Status int // 0: failed 1: successful
Seq int // for adding manual build. start from 1
TimeStamp int64
BuildAt time.Time
}
BuildItem is unit of a build. A build may have several BuildItem.
type Comment ¶
type Comment struct {
BaseModel
EntityType int // This field indicates which page will this comment be attached. maybe test case, requirements...
EntityID int
UserID int
User User
Content string `sql:"size:1000"`
Req Requirement
}
Comment model
type Execution ¶
type Execution struct {
BaseModel
Status int // ready, in progress, N/A(if a tester is not assigned), Done
ExecutionType int // manual, automation
Plan TestPlan
PlanID int // TODO add an index
Project Project
ProjectID int
Executor User
ExecutorID int
TargetBuild BuildItem
TargetBuildID int
//Message stores a reason of deny or comment of test execution
Message string
// Test result : Pass Fail if Status is Done
Result bool
TotalCaseNum int
PassCaseNum int
FailCaseNum int
Progress int `sql:"-"`
}
Execution represents an execution test
type History ¶
type History struct {
BaseModel
ChangesJson string `sql:"size:1000"`
Changes []HistoryTestCaseUnit
User User
UserID int
Category int // Testcase or ....
TargetID int
ChangeType int // changed or set
What string
From int
FromStr string
To int
ToStr string
Set string
// TODO find diff library and apply. the other fileds are depend on that.
DiffID int
Note string `sql:"size:512"`
}
History is a model for history of test cases or something stuff.
type HistoryTestCaseUnit ¶
type HistoryTestCaseUnit struct {
ChangeType int
What string // thing to be changed
From int
FromStr string
To int
ToStr string
Set string
DiffID int
Msg string
}
HistoryTestCaseUnit is for storing multiple changement contents via JSON string
type Issue ¶
type Issue struct {
ID int
ProjectId int //Project id which belongs to this issue
Status int // Status. Open, Close, In Progress, In QA Review, Waiting for QA, Resolved, Todo
Summary string `sql:"size:400"` // summary of the issue
Description string `sql:"size:4000"` // description of the issue
Assignee User
AssigneeId int // TODO add foreign key
Reporter User
ReporterId int // TODO add foreign key
Resolution int // fixed or unresolved
Created time.Time
Updated time.Time
Due time.Time
Priority int // Critical, Urgent, High, Low, misc
Progress int // progress. 0~100
Roadmap int // TODO Change to Roadmap object when a Roadmap table is created
Started time.Time
Ended time.Time
Estimated time.Time
Attachment int // TODO change to ....
}
type JSTreeNode ¶
type JSTreeTestCaseWrapper ¶
type JSTreeTestCaseWrapper struct {
Text string `json:"text"`
Id string `json:"id"`
Type string `json:"type"`
}
Wrapper type for print out JSON format used in JSTree
type JSTreeTestSuiteWrapper ¶
type JSTreeTestSuiteWrapper struct {
Text string `json:"text"`
Id string `json:"id"`
Type string `json:"type"`
Children bool `json:"children"`
}
Wrapper type for print out JSON format used in JSTree
type JSTreeTestSuiteWrapperWithChildren ¶
type JSTreeTestSuiteWrapperWithChildren struct {
Text string `json:"text"`
Id string `json:"id"`
Type string `json:"type"`
Children []JSTreeTestCaseWrapper `json:"children"`
}
type Milestone ¶
type Milestone struct {
BaseModel
Name string `sql:"not null;unique"`
ProjectID int
DueDate time.Time
Status int //Active, Close
Description string `sql:"size:1000"` // description of the milestone
}
Milestone represents a model for Milestone
type Project ¶
type Project struct {
BaseModel
Name string `sql:"not null;unique"`
Status int // Activation, Deactivation, closed
Description string `sql:"size:4000"` // description of the issue
Users []User `gorm:"many2many:user_project;" json:"-"`
Prefix string `sql:"size:12"`
// contains filtered or unexported fields
}
Project represents a model for Project
type Requirement ¶
type Requirement struct {
BaseModel
Title string
Description string
// ReqType is type of this requirement
// Requirement type may be one of below
// Use Case, Information, Feature, User Interface, Non Functional, Constraint, System Function...
ReqTypeID int
ReqType ReqType
Status int
// i18n message of status
StatusStr string `gorm:"-"`
Priority int
// Each requirements are belongs to section
SectionID int
// ProjectID represents Project ID of this requirement. Each Requirement are belongs to project
ProjectID int
// Version or history of this Requirement
Version int
// RelatedTestCase stores relationship between this requirement and related testcases
// The relationship has many to many
RelatedTestCases []TestCase `gorm:"many2many:testcases_reqs;"`
}
Requirement Model
type Review ¶
type Review struct {
ID int
Status int // Ready,In progress, Reject, Done
Category int // from issue management system or inhouse testcase review
Comment string `sql:"size:500;"` // description of the issue
Description string `sql:"size:500;"`
ToUser User
ToUserID int
FromUser User
FromUserID int
CreatedAt time.Time
UpdatedAt time.Time
DeletedAt *time.Time
}
type Section ¶
type Section struct {
BaseModel
Prefix string
Seq int // may use...
Title string
Description string // may not used
Status int // may not use
ParentsID int
ProjectID int
RootNode bool
ForTestCase bool //TestCase or Specification
}
Section represents section of test case or requirements
type TcReqRelationHistory ¶
type TcReqRelationHistory struct {
BaseModel
// Indicates this object kind. The kind may be link or unlink
Kind int
RequirementID int
TestCaseID int
ProjectID int
}
TcReqRelationHistory represents the history of relationship between TestCase and Requirement
func (*TcReqRelationHistory) Validate ¶
func (relation *TcReqRelationHistory) Validate() error
Validate check input value and return error
if returned value 'error' is not nil, you may consider invoke 500 internal error.
type TestCase ¶
type TestCase struct {
BaseModel
// Prefix is a unique characters that each project has
// The prefix is used when Human-friendly testcase name is created
// for example, if the prefix is "TC" then a testcase name is "TC-1"
// It is {{Prefix}}-{{ID}}, but will be {{Prefix}}-{{Seq}} soon
Prefix string `sql:"not null"`
// DisplayID represents test case name for displaying.
// The format is looks like "TC-200"
DisplayID string `sql:"not null"`
// Seq is a unique sequence number in the project.
// It is not disabled now, but it will be used to make user-friendly test case name
Seq int `sql:"not null"`
// Title of the test case
Title string `sql:"size:400"`
// A section which this test case belongs to
Section Section
SectionID int `sql:"index"`
// ExecutionType indicates manual execution or automated one.
ExecutionType int //Manual, Automated
// ExTypeStr is string of execution type
ExTypeStr string
// Status indicates status of testcase. This should be one of following : Activation, Deactivation, closed
Status int
Description string `sql:"size:2000"` // description of the issue
Precondition string `sql:"size:1000" `
Priority int // 1 to 5. 1 is highest priority
PriorityStr string `sql:"-"`
Estimated int // unit : min(s)
// Version is current version of this testcase.
// Not implemented now.
Version int
// Steps describes how to run this test step by step
Steps string `sql:"size:1000"`
// Expected describes what the tester wants
Expected string `sql:"size:1000"`
Project Project
ProjectID int
Category Category
CategoryID int
// need many-to-many releationship between requirements and testcases.
RelatedRequirements []Requirement `gorm:"many2many:testcases_reqs;"`
}
TestCase model represents a test case
type TestCaseResult ¶
type TestCaseResult struct {
BaseModel
// Status represents pass or fail of this test execution
Status bool
Plan TestPlan
TestPlanID int
Exec Execution
ExecID int
Case TestCase
TestCaseID int
TestCaseVer int
// Actual describes actual result of this test case.
// It will be if the Status is failed
Actual string `sql:"size:800"`
}
TestCaseResult is a model for test result of each test case A test execution consists of one or more test cases. Test Case(s) <--> TestResult Test Execution <--> TestExecution Test Case(s) ---> Test Execution
type TestPlan ¶
type TestPlan struct {
BaseModel
Title string
Description string
Status int //Active , In Review
ExecutionType int
Project Project
ProjectID int
Creator User
CreatorID int
Executor User
ExecutorID int
ExecCaseNum int
ExecuteCases string // ',' joined string like 1,2,3....
TargetBuild BuildItem
TargetBuildID int
}
TestPlan represents a plan of test
type User ¶
type User struct {
BaseModel
Name string
Email string `sql:"not null;unique"`
Password string `json:"-"` // to be removed
HashedPassword []byte `json:"-"`
Language string
Region string
Projects []Project
Message string
Location string
Photo string // TODO URL
Roles int
Notes string
LastLoginAt time.Time
PasswordUpdatedAt time.Time `json:"-"`
}
User is a model represents a user