func TestAddDailyReport(t *testing.T) { d := new(models.DailyReport) d.Date = "2015-06-30" d.Work = "work" d.Plan = "my plan" d.Remark = "hehe" d.UserId = userId if AddDailyReport(d) == nil { t.Log("add daily report") } else { t.Error("") } if AddDailyReport(d) != nil { t.Log("test duplicated") } else { t.Error("should not allow duplicated report") } }