Skip to content

ryanilhamsept/gatling

Repository files navigation

icip

Let's taste some software!

need

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 maven

babashka

brew install borkdude/brew/babashka
# alternative
bash < <(curl -s https://raw.githubusercontent.com/babashka/babashka/master/install)

How to run

Sync first everytime

    bb sync

Run 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/dry

icip help

    bb icip -h

utilities

    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 folder

System Properties

Use 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

mvn migration-back notes

  • com.charleskorn.kaml:kaml library changed to org.yaml:snakeyaml because kaml dependency in pom.xml always 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
  • we are deleting playgrounds (*.ws.kts files) because it breaks compilation but still keeping the script-runtime deps because without it, it breaks the build
    • actually it doesn't break now, don't know why, deleting script-runtime again
  • 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.xml for local use
      • settings-docker.xml for Builder.Dockerfile
      • settings-pipeline.xml for .gitlab-ci.yml
      • settings-gelato.xml for gelato
    • it is possible that I tripped up somewhere creating unecessary xml pipeline here but currently I can't figure it out with less
  • 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:

name changes and refactory

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....

conventions/decision/reasoning made during devs

  1. module name starting with _ so it's sorted earlier in folder view
    1. also _ for space in names, this one doesn't have particular reason other than aesthetic consistency
  2. the root package name tests so JunitMain can find them ❌ this mess up resource folder so will change this
    1. reverting root source and this package naming, now attempting
      • sourceDirectory code
      • resource resource
  3. use unique folder naming instead of deeply nested folder
    1. one reason for this: currently bb sync and maven dependencies assumes all folder names are unique
  4. 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
  5. some _util uses kotlin package naming without folder, in spirit of reason 3.
    1. downside, need to manually write package name. I personally think this is a small tradeoff
  6. deleting Globals backward compat
    1. add effort to rename globals calls
  7. prevent hardcoded authorization in rest packages (specifying header with variable inside fun is still considered hardcoded because it becomes hard to not use them)
  8. need to set up BeforeLaunch task in run configuration,
    1. run the external task
      • bb install --mvn/modules $ModuleFileDir$ --mvn/intellij
      • project dir $ProjectFileDir$
    2. limitation
      • running the task while the file is not open will error (just need to run via play button directly)
  9. the term modules and projects is interchangeable in mvn-orchestra.clj. it is that way because in pom.xml it is called module while in mvn cli, the flag is --projects. we chose the term modules here.
  • also it was initally called submodule but it was confusing, we dropped that.

TODO

  1. shared proto variable in pom.xmls
  2. inter deps with bb as well?
  3. 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

weirdness

  • 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 to TestLoginBE made it work, why??
  • mvn dependency:purge-local-repository
  • modules in intelliJ might go awry, deleting .idea folder might help
  • relativePath in parent was actually necessary, it worked before because previously mvn found them in localRepo. bb purge helped 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 got NoMethodFoundException error 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
  • 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

notable changes on migration

  • 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

links

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages