Let's taste some software!
homebrew and sdkman (to help installation)
# sdkman
curl -s "https://get.sdkman.io" | bash
# homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"jdk >17 and maven
# java
sdk install java 17.0.0-tem
# maven
sdk install mavenbabashka
brew install borkdude/brew/babashka
# alternative
bash < <(curl -s https://raw.githubusercontent.com/babashka/babashka/master/install)Sync first everytime
bb syncRun a test module (check available :test-modules in the project-info.edn)
bb icip -m "service_auth"Run multiple test modules (using comma separated list)
bb icip -m "service_auth,service_purchase"Run a test module and providing Tags to run
bb icip -m "service_transaction" -t "Positive & SystemTest"Dry run (showing information of the test that will be run without running them, only total number of tests for now)
bb icip -m "service_transaction" -t "PaymentPartner" --mvn/dryicip help
bb icip -hutilities
bb install # compile all (new structure only)
bb install -m "service_transaction" # compiling a specific module
bb clean # the same as mvn clean
bb purge # delete installed icip in .m2
bb clean-allure # clean all allure-results folderUse the key below with -D (i.e. -Denv=stg)
| key | description | value |
|---|---|---|
| noDebug | show debug messages to console outputs | true / false |
| env | set which env to run | dev / stg |
| os | set which os for mobile app | android / ios |
| browserstack.app | uploaded app on browserstack app-automate | for example bs://93fd38c6fae050f86f143d947f798afd8eb8f59d . if empty, value will be determined by code |
| local.appium | use local appium to run test | true / false |
| fullPix | capture all step for allure report | true / false |
| browserstack.networkLogs | capture network logs on browserstack app-automate | true / false |
- com.charleskorn.kaml:kaml library changed to org.yaml:snakeyaml because kaml dependency in
pom.xmlalways fail to have content in its jar - tokens for accessing gitlab registry is not in the project but in
~/.m2/settings.xml- please heed the comments in
settings.xml
- please heed the comments in
- we are deleting playgrounds (*.ws.kts files) because it breaks compilation but still keeping the
script-runtimedeps because without it, it breaks the build- actually it doesn't break now, don't know why, deleting
script-runtimeagain
- actually it doesn't break now, don't know why, deleting
- Builder.Dockerfile is needed bc of two reasons
- downloading deps in advance
- setting creds to access private gitlab registry
- forgive maven for being so complex, blame gradle for being so resource-hungry and slow
- there are 4 settings.xml
- the
settings.xmlfor local use settings-docker.xmlfor Builder.Dockerfilesettings-pipeline.xmlfor .gitlab-ci.ymlsettings-gelato.xmlfor gelato
- the
- it is possible that I tripped up somewhere creating unecessary xml pipeline here but currently I can't figure it out with less
- there are 4 settings.xml
- will be assisted by babashka!
helpful commands
# compile all code from zero
mvn clean test -DskipTests -Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss -Dorg.slf4j.simpleLogger.showDateTime=true
# compile code
mvn test -DskipTests
# run test
mvn test -Dtags="DummyA"
# helper for debugging
mvn help:effective-settings
mvn help:active-profiles
extras:
- time between maven execution: https://stackoverflow.com/a/49494561/8812880
| old | new |
|---|---|
commons.util |
commons e.g. Util.writeCsv => writeCsv |
Util.sleep(...) |
Thread.sleep(...) |
Util.generateRandomNumericStringA("", 15) |
randomNumeric(15).toString() |
Util.generateRandomNumericStringA("1234", 15) |
"1234" + randomNumeric(15) |
val tokenMerchant = HydraUtil.getClientToken(getSecretOTPDirectClientId(),getSecretOTPDirectSecret()) |
val tokenMerchant = otpDirectClient.getClientCredential()other client might be used e.g qaTestClient |
| some other that I might forgot.... |
- module name starting with
_so it's sorted earlier in folder view- also
_for space in names, this one doesn't have particular reason other than aesthetic consistency
- also
- the root package name
testsso JunitMain can find them ❌ this mess up resource folder so will change this- reverting root source and this package naming, now attempting
- sourceDirectory
code - resource
resource
- sourceDirectory
- reverting root source and this package naming, now attempting
- use unique folder naming instead of deeply nested folder
- one reason for this: currently
bb syncand maven dependencies assumes all folder names are unique
- one reason for this: currently
- made module separation as small possible, thinking that maybe even if this is too much, combining smaller things into a bigger one is easier than breaking down big things into smaller ones
- some _util uses kotlin package naming without folder, in spirit of reason
3.- downside, need to manually write package name. I personally think this is a small tradeoff
- deleting Globals backward compat
- add effort to rename globals calls
- prevent hardcoded authorization in
restpackages (specifying header with variable inside fun is still considered hardcoded because it becomes hard to not use them) - need to set up BeforeLaunch task in run configuration,
- run the external task
bb install --mvn/modules $ModuleFileDir$ --mvn/intellij- project dir
$ProjectFileDir$
- limitation
- running the task while the file is not open will error (just need to run via play button directly)
- run the external task
- the term
modulesandprojectsis interchangeable inmvn-orchestra.clj. it is that way because in pom.xml it is calledmodulewhile in mvn cli, the flag is--projects. we chose the termmoduleshere.
- also it was initally called
submodulebut it was confusing, we dropped that.
- shared proto variable in pom.xmls
- inter deps with bb as well?
- purge only purge com.byorange.qa.icip while all the modules are under com.byorange.qa, so install might work locally but fails in the pipeline
- IntelliJ somehow automatically sync after
bb sync, this is not intended but it's good that it does that- what's worrying that we don't know why
- Junit5 doesn't recognize class that is name
TestLogin, while changing it toTestLoginBEmade it work, why?? mvn dependency:purge-local-repository- modules in intelliJ might go awry, deleting
.ideafolder might help - relativePath in parent was actually necessary, it worked before because previously mvn found them in
localRepo.
bb purgehelped shine a light on this mvn dependency:tree -pl icip/tests/login_be "-Dincludes=com.byorange.*"- sometimes after changing Class name/test fun name, running via IntelliJ will fail (test not found), but via terminal
no problem
- solution that I think works: Reload all Maven Projects, because apparently the classpath is not updated
- sometimes IntelliJ get IndexNotReadyException
- solution: simply rerun, idk why this error shows up
- cool, helpful:
- in mvn repo, you can copy from leiningen part
- just copy module name to :need and it copies only the name
- dry run implemented, but number of test apparently might not count TestData/ParameterizedTest correctly
- I don't remember why I used
<type>pom</type>on the coroutines deps. we found that we gotNoMethodFoundExceptionerror while running TestDummyWeb and removing that fixes it- I think it forces the dependency to match versions across modules, so back to the first weirdness, I don't remember why I used
<type>pom</type>on the coroutines deps
- I think it forces the dependency to match versions across modules, so back to the first weirdness, I don't remember why I used
- Same filename and package across submodules is considered Name Conflict, tho what actually happen is not compile error but Name Shadowing, and will compile error if the shadowed name is used: refer to commit 37f4fbb9a95656d93a7f8baf34d7c24fb9135f92
- Globals.tokenVirgoland -> Tokens class
- a lot of legacy rest fun
- Alfamart and BCA special case using executeRest
- Hydra with selenium is still error
- no virgo specific stuff in Database util, make some ol function instead
- should refactor harcoded "build" folder path