litehelpers / Cordova-SQLitePlugin-legacy-iOS-broken-bug666

Cordova/PhoneGap SQLitePlugin for iOS as of September 2013, no longer supported - BROKEN due to BUG litehelpers/Cordova-sqlite-storage#666
89 stars 30 forks source link

Automatic testing #4

Closed brodybits closed 12 years ago

brodybits commented 12 years ago

There is some basic testing with the Lawnchair suite but it is still minimal. It would be nice to verify the working of some basic examples, handling of NULL values, and any future enhancements. I like QUnit, and they pointed out some other nice frameworks such as SpecIt (http://github.com/joshuaclayton/specit).

brodybits commented 12 years ago

http://37signals.com/svn/posts/3159-testing-like-the-tsa

brodybits commented 12 years ago

I have added simple but complete testing using QUnit in test-www, and it demonstrates something that is broken on the Android version.

brodybits commented 12 years ago

The testing so far now reproduces #18: insertId broken on Android, affecting the INSERT statement, and #22: rowsAffected not working for Android, which affects INSERT, UPDATE, and DELETE. These tests are working perfectly on iOS. These tests are also working perfectly on the desktop browsers Chrome and Safari with the following patch:

--- test-www/index.html 2012-05-05 23:14:42.000000000 +0200
+++ test-www-pc/index.html  2012-05-05 23:15:42.000000000 +0200
@@ -8,19 +8,15 @@

     <link rel="stylesheet" href="lib/qunit-1.5.0.css" />

-    <script type="text/javascript" charset="utf-8" src="cordova-1.7.0.js"></script>
-    <script type="text/javascript" charset="utf-8" src="SQLitePlugin.js"></script>
     <script type="text/javascript" charset="utf-8" src="lib/qunit-1.5.0.js"></script>

     <script>

-    document.addEventListener("deviceready", doTest, false);
-
     function doTest() {

       test( "db transaction test", function() {

-        var db = window.sqlitePlugin.openDatabase("Database", "1.0", "PhoneGap Demo", 200000);
+        var db = window.openDatabase("Database", "1.0", "PhoneGap Demo", 200000);

         ok(!!db, "db object");

@@ -89,7 +85,7 @@
     </script>

   </head>
-  <body>
+  <body onload="doTest()">
     <div id="qunit"></div>
   </body>
 </html>

So the existing tests for insertId and rowsAffected seem to be compliant with the W3/HTML5 SQL API, and problems #18 and #22 should be fixed for the Android. This issue to add automatic testing is hereby finished and closed.