Re: [GitHub] ScalaTest port [max-l/Squeryl GH-117]

9 views
Skip to first unread message

Maxime Lévesque

unread,
Apr 27, 2011, 12:47:06 PM4/27/11
to samhendley, squeryl-co...@googlegroups.com

Sam, this is awesome !

I have been wanting to do this for a long time :  http://www.assembla.com/spaces/squeryl/tickets/1-convert-all-tests-to-scalatest

I had misunderstood you when you told me your were converting all tests, I thought you were talking about your tests !!!

I have to open myself a beer to celebrate this ! ;-)

Guys, I'll be merging this as soon as I have run it on all DBs, from now on, all tests should take the form of a ScalaTest

ML

On Wed, Apr 27, 2011 at 12:30 PM, samhendley <reply+i-820466-f62de7e1a4c0...@reply.github.com> wrote:
I ported over all the tests to a scalatest framework. I think you will find that this will be easier and less error prone to run all tests across all supported databases. Major changes:

- added org.squeryl.tests.cfg config file with all connection strings, each database connector checks this file to see if the connectionString is specified and if so runs tests, otherwise skips tests using that database. This allows each developer to test against whatever databases they have access to without hacking at Tests.scala. This also means the test output will indicate how many tests were run and skipped.

   [info] == test-finish ==
   [info] Passed: : Total 209, Failed 0, Errors 0, Passed 108, Skipped 101

- scala-test library added. Tests can be run trivially inside intellij. Commands to run using sbt are:

   sbt test
   sbt "test-only *.H2_*"

-  Base classes for tests that handle creating the database sessions and drop/create/initializing the schema under test. (I had to make schema.drop public for this)
- Each test case is run in an isolated transaction that is rolledback at end of test
- Individual tests can be ignored for certain drivers. see Postgresql_SchoolDb for example

Issues:
- Still requires a listing of tests for each driver (see H2_Tests.scala and Postgresql_Tests.scala)
- The tests made heavy use of importing all fields from anonymous classes. You can only import vals and this lead to some uglyness in the test code. I added the prePopulate method late in the port and some of the classes could use that to avoid recreating the test data every for every test case.
    val testInstance = sharedTestInstance; import testInstance._
- I haven't created the db classes for mysql,derby,db2,oracle,ms_sql as I don't have access to any of those dbs right now. It should be a trivial job to copy/paste the H2 example.
- There were a few tests that are failing on both H2 and postgres: SchoolDb:VeryVeryNestedExists and MusicDb:TimestampPartialUpdate
- lots of excess printlns() and (including the now unnecessary "'testcase passed." messages)
- pretty much all symbols can be removed from test cases
- config file probably should be removed from git and use a default that needs to be copied and editted


Not Ported:

- leakTest not ported
- issue14 test not ported
- test of "not" function not ported (left commented out, name collision with not matcher in test code)
- changing name of column type in SchoolDb Schema based on adapter not ported, I think you could subclass the schema for that test case.
- "labo" tests, these mainly seemed to be compilation tests (should be moved to dbagnostic)
- Mysql specific tests and exclusions from: SchoolDb tests

General Notes:

I think the tests need some TLC and pruning. It is very difficult to tell what any given test is actually looking for and a number of the tests seem to just check that a query is constructible without executing and/or checking the results at all.

--
Reply to this email directly or view it on GitHub:
https://github.com/max-l/Squeryl/pull/117

Reply all
Reply to author
Forward
0 new messages