Skip to content

Commit

Permalink
Unit Test(s) Migration (#287)
Browse files Browse the repository at this point in the history
* chore: [test] add BRConstantsTest for unitTest and deprecated ConstantsTests inside androidTest

* chore: [test] remove unused test files

* chore: [test] add todo to fill the tests and change package name

* chore: [test] add basic example

* chore: [test] integrate with ci/cd

* chore: [test][ci] fix Cannot find a definition for command named android/restore-gradle-cache

* chore: [test][ci] fix Cannot find a definition for command named android/run-tests

* chore: [test][ci] fix Unexpected argument(s): test-command

* chore: [test][ci] fix Cannot find a definition for executor named android/android-docker

* chore: [test][ci] add default for gradle.properties

* chore: [test][ci] avoid breaking in build.gradle

* chore: [test][ci] enable androidx and jetifier

* chore: [test][ci] init submodule

* chore: [test][ci] just using run command for execute unit test step

* chore: [test][ci] add env for google-services.json

* chore: [test][ci] add env for google-services.json

* chore: [test][ci] add env for google-services.json

* Major refactor of code to move classes to the ideal location

- Removed cruft
- Moved all tests to the unitTest directory
- Remove poorly placed tests into (AndroidTest)
- Commented  old code into the new Kotlin class(es)
- working in the first test of currency
- Removed the paymentRequest method
- Renamed Classes

* chore: resolve CurrencyTests

* Added notes

---------

Co-authored-by: Kerry Washington <[email protected]>
  • Loading branch information
andhikayuana and kcw-grunt authored Dec 12, 2024
1 parent 771c9ae commit d6ee1f7
Show file tree
Hide file tree
Showing 27 changed files with 1,820 additions and 2,017 deletions.
46 changes: 36 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,51 @@
# See: https://circleci.com/docs/2.0/configuration-reference
version: 2.1

orbs:
android: circleci/[email protected]

# Define a job to be invoked later in a workflow.
# See: https://circleci.com/docs/2.0/configuration-reference/#jobs
jobs:
say-hello:
# Specify the execution environment. You can specify an image from Dockerhub or use one of our Convenience Images from CircleCI's Developer Hub.
# See: https://circleci.com/docs/2.0/configuration-reference/#docker-machine-macos-windows-executor
docker:
- image: cimg/base:stable
# Add steps to the job
# See: https://circleci.com/docs/2.0/configuration-reference/#steps
unit-test:
executor:
name: android/android_machine
resource_class: large
tag: default
steps:
- checkout
- run:
name: "Say hello"
command: "echo Hello, World!"
command: "echo Hello, World! && ls"
- run:
name: "Default for gradle.properties"
command: "echo \"RELEASE_STORE_FILE=/\nRELEASE_STORE_PASSWORD=\nRELEASE_KEY_ALIAS=\nRELEASE_KEY_PASSWORD=\nandroid.useAndroidX=true\nandroid.enableJetifier=true\" >> gradle.properties && ls && cat gradle.properties"
- run:
name: "Initialize submodule"
command: "git submodule init && git submodule update --init --recursive"
- run:
name: "Copy google-services.json"
command: echo "$GOOGLE_SERVICES_JSON" | base64 --decode > app/google-services.json
- android/restore_gradle_cache
- run:
name: "Execute Unit Test"
command: ./gradlew testLitewalletDebugUnitTest
- android/save_gradle_cache
- run:
name: Save test results
command: |
mkdir -p ~/test-results/junit/
find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/test-results/junit/ \;
when: always
- store_test_results:
path: ~/test-results
- store_artifacts:
path: ~/test-results/junit


# Invoke jobs via workflows
# See: https://circleci.com/docs/2.0/configuration-reference/#workflows
workflows:
say-hello-workflow:
test-and-build:
jobs:
- say-hello
- unit-test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,4 @@ app/src/litewalletDebug/google-services.json
/.idea/dictionaries/grunt.xml
androidTestResultsUserPreferences.xml
.idea/deploymentTargetSelector.xml
.idea/inspectionProfiles/Project_Default.xml
3 changes: 3 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ dependencies {
implementation 'org.json:json:20231013'
implementation 'androidx.navigation:navigation-fragment-ktx:2.7.7'
implementation 'androidx.navigation:navigation-ui-ktx:2.7.7'
implementation 'androidx.test.ext:junit-ktx:1.2.1'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'junit:junit:4.12'
androidTestImplementation('androidx.test.espresso:espresso-core:3.5.1')
Expand Down
81 changes: 0 additions & 81 deletions app/src/androidTest/java/com/litewallet/PaperKeyTests.java

This file was deleted.

This file was deleted.

Loading

0 comments on commit d6ee1f7

Please sign in to comment.