You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by er...@apache.org on 2021/07/27 05:56:05 UTC

[cordova-android] branch ci/connectedAndroidTest updated (c16e5d0 -> 789577d)

This is an automated email from the ASF dual-hosted git repository.

erisu pushed a change to branch ci/connectedAndroidTest
in repository https://gitbox.apache.org/repos/asf/cordova-android.git.


    from c16e5d0  fix: add androidx.test:rules library
     new 363ab36  refactor: java test runner
     new 789577d  refactor: rename java_unit_tests command & test runner file

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 package.json                                       |  6 +++---
 test/clean.js                                      |  2 +-
 ...{run_java_unit_tests.js => java_test_runner.js} | 25 ++++++++++++++++------
 3 files changed, 22 insertions(+), 11 deletions(-)
 rename test/{run_java_unit_tests.js => java_test_runner.js} (78%)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[cordova-android] 01/02: refactor: java test runner

Posted by er...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

erisu pushed a commit to branch ci/connectedAndroidTest
in repository https://gitbox.apache.org/repos/asf/cordova-android.git

commit 363ab369ebb1b2a7dc233e4bb845c8f1360707f1
Author: Erisu <el...@gmail.com>
AuthorDate: Tue Jul 27 14:52:54 2021 +0900

    refactor: java test runner
---
 test/run_java_unit_tests.js | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/test/run_java_unit_tests.js b/test/run_java_unit_tests.js
index d118477..4e0df3e 100644
--- a/test/run_java_unit_tests.js
+++ b/test/run_java_unit_tests.js
@@ -46,9 +46,13 @@ class AndroidTestRunner {
         return new ProjectBuilder(this.projectDir).runGradleWrapper('gradle');
     }
 
+    _log (...args) {
+        console.log.apply(console, [`[${this.testTitle}]`, ...args])
+    }
+
     run () {
         return Promise.resolve()
-            .then(_ => console.log(`[${this.testTitle}] Preparing Gradle wrapper for Java unit tests.`))
+            .then(_ => this._log('Staging Project Files'))
             .then(_ => {
                 // TODO we should probably not only copy these files, but instead create a new project from scratch
                 fs.copyFileSync(path.resolve(this.projectDir, '../../framework/cdv-gradle-config-defaults.json'), path.resolve(this.projectDir, 'cdv-gradle-config.json'));
@@ -57,28 +61,35 @@ class AndroidTestRunner {
                     path.join(this.projectDir, 'app/src/main/assets/www/cordova.js')
                 );
             })
+
+            .then(_ => this._log('Creating Gradle Wrapper'))
             .then(_ => this._createProjectBuilder())
+
+            .then(_ => this._log('Getting Gradle Wrapper Version Info'))
             .then(_ => this._gradlew('--version'))
-            .then(_ => console.log(`[${this.testTitle}] Gradle wrapper is ready. Running tests now.`))
+
+            .then(_ => this._log('Running Java Unit Tests'))
             .then(_ => this._gradlew('test'))
-            .then(_ => console.log(`[${this.testTitle}] Java unit tests completed successfully`))
+            .then(_ => this._log('Finished Java Unit Test'))
+
+            .then(_ => this._log('Running Java Instrumentation Tests'))
             .then(_ => this._gradlew('connectedAndroidTest'))
-            .then(_ => console.log(`[${this.testTitle}] Java instrumentation tests completed successfully`));
+            .then(_ => this._log('Finished Java Instrumentation Tests'))
     }
 }
 
 Promise.resolve()
-    .then(_ => console.log('Starting to run all android platform tests'))
+    .then(_ => console.log('Starting Android Platform Java Tests'))
 
     // AndroidX Test
     .then(_ => new AndroidTestRunner('AndroidX Project', path.resolve(__dirname, 'androidx')))
     .then(test => test.run())
 
-    .then(_ => console.log('Finished running all android platform tests'));
+    .then(_ => console.log('Finished Running Android Platform Java Tests'));
 
 process.on('unhandledRejection', err => {
     // If err has a stderr property, we have seen the message already
     if (!('stderr' in err)) console.error(err.message);
-    console.error('JAVA UNIT TESTS FAILED!');
+    console.error('JAVA TESTS FAILED!');
     process.exitCode = err.code || 1;
 });

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[cordova-android] 02/02: refactor: rename java_unit_tests command & test runner file

Posted by er...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

erisu pushed a commit to branch ci/connectedAndroidTest
in repository https://gitbox.apache.org/repos/asf/cordova-android.git

commit 789577d92991a48df618fb6ef8e5ce0307164c4e
Author: Erisu <el...@gmail.com>
AuthorDate: Tue Jul 27 14:55:46 2021 +0900

    refactor: rename java_unit_tests command & test runner file
---
 package.json                                         | 6 +++---
 test/clean.js                                        | 2 +-
 test/{run_java_unit_tests.js => java_test_runner.js} | 0
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/package.json b/package.json
index 26a26ce..b6db22a 100644
--- a/package.json
+++ b/package.json
@@ -12,13 +12,13 @@
   ],
   "scripts": {
     "prepare": "cordova-js build > templates/project/assets/www/cordova.js",
-    "test": "npm run lint && npm run cover && npm run java-unit-tests",
+    "test": "npm run lint && npm run cover && npm run java-tests",
     "lint": "eslint lib spec test \"templates/cordova/**/!(*.*)\"",
     "unit-tests": "jasmine --config=spec/unit/jasmine.json",
     "cover": "nyc jasmine --config=spec/coverage.json",
     "e2e-tests": "jasmine --config=spec/e2e/jasmine.json",
-    "java-unit-tests": "node test/run_java_unit_tests.js",
-    "clean:java-unit-tests": "node test/clean.js"
+    "java-tests": "node test/java_test_runner.js",
+    "clean:java-tests": "node test/clean.js"
   },
   "author": "Apache Software Foundation",
   "license": "Apache-2.0",
diff --git a/test/clean.js b/test/clean.js
index 88148cd..16cc18c 100644
--- a/test/clean.js
+++ b/test/clean.js
@@ -21,7 +21,7 @@ const fs = require('fs-extra');
 const path = require('path');
 
 /**
- * This script is to be run manually (e.g. by npm run clean:java-unit-tests) if
+ * This script is to be run manually (e.g. by npm run clean:java-tests) if
  * you want to upgrade gradlew or test its proper generation.
  */
 
diff --git a/test/run_java_unit_tests.js b/test/java_test_runner.js
similarity index 100%
rename from test/run_java_unit_tests.js
rename to test/java_test_runner.js

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org