Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

failing test suite #31

Closed
mattetti opened this issue Nov 16, 2013 · 5 comments
Closed

failing test suite #31

mattetti opened this issue Nov 16, 2013 · 5 comments

Comments

@mattetti
Copy link

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.

@marcosnils
Copy link
Member

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 😄.

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.

@marcosnils
Copy link
Member

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.

@mattetti
Copy link
Author

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?

@marcosnils
Copy link
Member

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.

@mattetti
Copy link
Author

👍 thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants