Closed mattetti closed 11 years ago
Hey @mattetti Goblin is a self tested framework, that means that all Goblin tests use Goblin. That being said, it's normal that whenever you run go test
you'll see a couple of failures as we need to test failures as well :smile:.
If you want to write and execute a new test, you can just add your test to the goblin_test.go file and then run that only test by calling go test -test.run {your test name}.
ie: go test -test.run TestAddNumbersSucceed
. This will only run that test only.
Anyways, the way to find out if the tests are running ok is by looking at the last line of the test run. If it says something like ok _/home/mlilljedahl/Projects/goblin 0.598s
then everything's file. On the other hand, if a test failed you'll see something like FAIL _/home/mlilljedahl/Projects/goblin 0.553s
.
If you have more questions, please ask.
Marcos.
BTW, what are you looking forward to incorporate to Goblin?. If it's something that our users will find useful we can work to implement it together.
Thanks Marcos, I'm looking at adding some basic assertions to Assertion
. I don't think that having to use Gomega for a few basic assertions makes sense. I was thinking about adding BeTrue()
and BeFalse()
and/or potential Check()
:
g.Assert(x.IsEnabled).BeTrue()
g.Assert(x.IsAdmin).BeFalse()
g.Assert(err == nil).BeTrue()
g.Assert(x.IsEnabled).Check()
g.Assert(!x.IsAdmin).Check()
g.Assert(err == nil).Check()
Check()
would simply verify that the assertion source is true
which is often the way assert
is used in other languages/test frameworks.
Finally, I was wondering if you'd consider adding an alias for Equal
that was shorter to type, maybe Eq
or Eql
?
Matt,
I do agree that we should expand our assertion library. We didn't put a lot of effort on doing that as we think Gomega is ok and saved us a lot of time when releasing Goblin.
Anyways i've added the BeTrue and BeFalse assertions you mentioned as I think those are very useful. You can take a look at the change in #32
As soon as some other contributor ( @xetorthio ) approves the change, you'll be able to use it in your Goblin tests.
As a bonus, I've also added the Eql shorthand as well.
:+1: thanks
I'm running
go test
in this repo and the test suite reports a bunch of failures but I'm not sure if they are related to actual bugs or part of the testing. I'd like to add a new simple feature but the fact that I'm not sure if the test suite is passing or failing is a bit worrying.