FAQ
I've had a number of projects where I needed to test logic that utilizes a
number of database calls, and I needed to test that my code would react to
specific results, or error conditions that could take place. Go's test
driver just really didn't fit in well for what I was trying to do.

I've created a library that allows you to create your own driver, and stub
connection failures, errors returned from queries, results returned from
queries, including a helper method to turn a CSV string into a Rows object.
You also have the ability to stub out the Query function altogether in case
you need to do custom logic like comparing the SQL call to a regular
expression, or just creating an assertion that a particular SQL call was
made.

Please check it out and share any feedback you have, let me know if it's
useful to you as well, and if there are any other use cases you have that I
have not accounted for.

https://github.com/erikstmartin/go-testdb

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Kamil Kisiel at Feb 8, 2013 at 11:57 pm
    Hi Eric,

    This looks incredibly useful and I think the API is well designed. I
    actually have a direct need for something like this in one of my projects.
    The github README shows some good examples too.

    What would be great is if the examples were also available in the godoc and
    the API itself was documented. Currently we see
    this: http://godoc.org/github.com/erikstmartin/go-testdb

    On Friday, February 8, 2013 8:02:39 AM UTC-8, Erik St. Martin wrote:

    I've had a number of projects where I needed to test logic that utilizes a
    number of database calls, and I needed to test that my code would react to
    specific results, or error conditions that could take place. Go's test
    driver just really didn't fit in well for what I was trying to do.

    I've created a library that allows you to create your own driver, and stub
    connection failures, errors returned from queries, results returned from
    queries, including a helper method to turn a CSV string into a Rows object.
    You also have the ability to stub out the Query function altogether in case
    you need to do custom logic like comparing the SQL call to a regular
    expression, or just creating an assertion that a particular SQL call was
    made.

    Please check it out and share any feedback you have, let me know if it's
    useful to you as well, and if there are any other use cases you have that I
    have not accounted for.

    https://github.com/erikstmartin/go-testdb
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Erik St. Martin at Feb 8, 2013 at 11:50 pm
    Thanks for the feedback. That's a very good point. I had originally just
    spiked this out to solve an immediate need I had, now that it's evolved and
    has become pretty useful I should definitely do godoc for it. I'll get that
    out here in the next couple days.

    Erik
    On Friday, February 8, 2013 2:52:02 PM UTC-5, Kamil Kisiel wrote:

    Hi Eric,

    This looks incredibly useful and I think the API is well designed. I
    actually have a direct need for something like this in one of my projects.
    The github README shows some good examples too.

    What would be great is if the examples were also available in the godoc
    and the API itself was documented. Currently we see this:
    http://godoc.org/github.com/erikstmartin/go-testdb

    On Friday, February 8, 2013 8:02:39 AM UTC-8, Erik St. Martin wrote:

    I've had a number of projects where I needed to test logic that utilizes
    a number of database calls, and I needed to test that my code would react
    to specific results, or error conditions that could take place. Go's test
    driver just really didn't fit in well for what I was trying to do.

    I've created a library that allows you to create your own driver, and
    stub connection failures, errors returned from queries, results returned
    from queries, including a helper method to turn a CSV string into a Rows
    object. You also have the ability to stub out the Query function altogether
    in case you need to do custom logic like comparing the SQL call to a
    regular expression, or just creating an assertion that a particular SQL
    call was made.

    Please check it out and share any feedback you have, let me know if it's
    useful to you as well, and if there are any other use cases you have that I
    have not accounted for.

    https://github.com/erikstmartin/go-testdb
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Erik St. Martin at Feb 13, 2013 at 1:47 pm
    I've updated the godocs and added examples for different use cases. I'll be
    working over the next few days to make it support prepared statements, and
    transactions.

    Erik
    On Friday, February 8, 2013 2:58:42 PM UTC-5, Erik St. Martin wrote:

    Thanks for the feedback. That's a very good point. I had originally just
    spiked this out to solve an immediate need I had, now that it's evolved and
    has become pretty useful I should definitely do godoc for it. I'll get that
    out here in the next couple days.

    Erik
    On Friday, February 8, 2013 2:52:02 PM UTC-5, Kamil Kisiel wrote:

    Hi Eric,

    This looks incredibly useful and I think the API is well designed. I
    actually have a direct need for something like this in one of my projects.
    The github README shows some good examples too.

    What would be great is if the examples were also available in the godoc
    and the API itself was documented. Currently we see this:
    http://godoc.org/github.com/erikstmartin/go-testdb

    On Friday, February 8, 2013 8:02:39 AM UTC-8, Erik St. Martin wrote:

    I've had a number of projects where I needed to test logic that utilizes
    a number of database calls, and I needed to test that my code would react
    to specific results, or error conditions that could take place. Go's test
    driver just really didn't fit in well for what I was trying to do.

    I've created a library that allows you to create your own driver, and
    stub connection failures, errors returned from queries, results returned
    from queries, including a helper method to turn a CSV string into a Rows
    object. You also have the ability to stub out the Query function altogether
    in case you need to do custom logic like comparing the SQL call to a
    regular expression, or just creating an assertion that a particular SQL
    call was made.

    Please check it out and share any feedback you have, let me know if it's
    useful to you as well, and if there are any other use cases you have that I
    have not accounted for.

    https://github.com/erikstmartin/go-testdb
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedFeb 8, '13 at 4:03p
activeFeb 13, '13 at 1:47p
posts4
users2
websitegolang.org

2 users in discussion

Erik St. Martin: 3 posts Kamil Kisiel: 1 post

People

Translate

site design / logo © 2021 Grokbase