¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io
Re: unit test condition on sql statement
Hi, A few stats about our codebase in this 14 months old Java project: - we have almost 800 classes of production code with ~32K LOC (empty lines excluded) - we have almost 500 classes of tests with
By Erik J?gi · #36002 ·
Re: unit test condition on sql statement
If you are using Views, there is also the possibility to shift the unit tests to the database layer to ensure some of its logic (at least with some databases, e.g. MS SQL using tSQLt or Oracle using
By Pesse · #36001 ·
Re: unit test condition on sql statement
What does "almost as fast" mean in practice? 20 ms is "almost as fast" as 0.5 ms for the first hundred or so tests. That said: *sometimes* in the case of tricky dynamically built sql (for example:
By Dave Foley · #36000 ·
Re: unit test condition on sql statement
Indeed. I would only become concerned about this if we found ourselves copying and pasting the same set of integrated tests for every new table that we introduce. After a while, we can trust ourselves
By J. B. Rainsberger · #35999 ·
Re: unit test condition on sql statement
On Fri, Apr 9, 2021 at 3:36 AM Arnaud Bailly <arnaud.oqube@...> wrote: > HI Tony, > > You most certainly don't want to create SQL queries "by hand", > concatenating strings. I have worked a
By J. B. Rainsberger · #35998 ·
Re: unit test condition on sql statement
wrote: Indeed! After a few months, I would probably be reaching for a library like this one, especially if I noticed that we had already built 15% of it. :) -- J. B. (Joe) Rainsberger ::
By J. B. Rainsberger · #35997 ·
Re: unit test condition on sql statement
Indeed, if Tony tries to move the business decisions up a level, then eventually he'll probably want to move other related code up a level, tool, resulting in the same structure as would have resulted
By J. B. Rainsberger · #35996 ·
Re: unit test condition on sql statement
On Thu, Apr 8, 2021 at 6:18 PM Tony Vo <ttrung.vo@...> wrote: > Hi everyone, > > I'm running into a scenario where I need to add extra condition in sql > statement like this >
By J. B. Rainsberger · #35995 ·
Re: unit test condition on sql statement
I practice this quite a bit too. I call them contract-tests or integration-tests, depending on which terminology mood I am in that day. I do my best to keep the number of such tests low, and the
By Gu?laugur Egilsson · #35994 ·
Re: unit test condition on sql statement
Hi Tony, Although purists would not call them unit tests, we have this kind of code inside repository classes and the tests of those classes are executing against a real database. It is almost as
By Erik J?gi · #35993 ·
Re: unit test condition on sql statement
Alternatively, write the adapter and test against one of the in-memory databases. That might get you a surprising distance.
By Steve Freeman · #35992 ·
Re: unit test condition on sql statement
Tony, I wouldn't test that the sqlStatement is what I expect. I would test that it returns the right results. I generally put such SQL-building logic into a data access object--an adapter class to
By George Dinwiddie · #35991 ·
Re: unit test condition on sql statement
HI Tony, You most certainly don't want to create SQL queries "by hand", concatenating strings. I have worked a full year with a codebase that's been doing this kind of stuff for >15 years and it's
By Arnaud Bailly · #35990 ·
Re: unit test condition on sql statement
Hi Tony and all On the matter of building SQL queries, I successfully tried the JOOQ library in the past (supposing you're using Java, I don't see any mention of the language). I don't know if it's
By Giorgio Vespucci · #35989 ·
Re: unit test condition on sql statement
Perhaps, instead of moving the business decisions up a level, try moving the sql string generation, down a level? This way the existing api is the same, but internally the strings can have a level of
By Avi Kessner · #35988 ·
Re: unit test condition on sql statement
Hi Tony, have you considered creating a class that takes whose sole responsibility it to generate the SQL strings? ?Have the existing class rely on the SQL generator, then unit test the
By Bob Graffagnino · #35987 ·
unit test condition on sql statement
Hi everyone, I'm running into a scenario where I need to add extra condition in sql statement like this sqlStatement.sql("select id from table_a") if (conditionA == true) { sqlStatement.sql("AND
By Tony Vo · #35986 ·
Re: Swift Extension on Array - not working ... hmmm
David, If I understand what you're doing, you should just be able to say return lineup[n % lineup.count] The line you have: let indexWrapped = n % indexMax already sets the indexWrapped to a number
By Bill Wake · #35985 ·
Re: Swift Extension on Array - not working ... hmmm
I'm learning & sharing... if you have critique of this... I could learn more!
By David Koontz · #35984 ·
Re: Swift Extension on Array - not working ... hmmm
*class* LineUp { *var* lineup = [ "Bob" , "Tony" , "Iris" , "Jane" , "Nan" , "Dave" , "George" , "Ringo" , "Shannon" ] *subscript* (n: Int ) -> String { *var* index = 0 *let* indexMax = lineup.
By David Koontz · #35983 ·