Automation Anywhere 설명서 읽기 및 검토

Automation 360

콘텐츠 닫기


콘텐츠 열기

Standard coding practices and guidelines for developing packages

  • 업데이트: 2022/05/19
    • Automation 360 v.x
    • 구축
    • RPA Workspace

Standard coding practices and guidelines for developing packages

This topic covers standard coding practices and guidelines that help to ensure the development of high quality packages.

Ensure high quality code. Write sufficient unit tests and integration tests for your package.
Set proper icon for your package.
Setting the version manually
The SDK package build version gets updated automatically every time a build happens. However, you can set it manually in the command project of a common build.gradle file.
  • Update the build.gradle file before a build.
  • Enter up to four digits numbers, separated my a period, as shown below:

. . .
ext {
    version '2.0.8'
dependencies {...}
Embed all the dependencies in your package JAR. Load the dependencies at run time by extracting them to a temporary location. Be sure to clean the temporary location after the dependencies are loaded.
Dependent JAR files
Add dependent JAR files under dependencies in the build.gradle file as implementation so that the dependant JAR files are packaged.
. . .
dependencies {
		compileOnly name: 'command-annotations'
		compileOnly name: 'bot-runtime'
		compileOnly name: 'bot-api'
		implementation name: 'i18n-api'
              implementation name: 'mydependentjavafile.jar'
		apt name: 'command-processor'
		compileOnly group: 'org.apache.logging.log4j', name: 'log4j-core', version: "$loggerVersion"
		testImplementation "org.testng:testng:$testNgVersion"
		testImplementation name: 'bot-runtime'
		testImplementation name: 'bot-api'
. . . 
Add new actions to the exiting package
When adding new actions to an existing package, make sure to do clean before packaging. It is always a good practice to do clean build - gradlew.bat clean build shadowJar.
Error messages
Provide meaningful error messages.
  • Do throw meaningful error messages. For example, in local language using i18n APIs with BotCommandException, throw a new exception BotCommandException(MESSAGES.getString("Run.Exception.InvalidWorkingDirPath")).
  • Do not throw generic error messages, such as ex.message.
Basic validation
Use the validation annotation rules, such as @NotEmpty included with this development kit. Do not add basic validations for your code. See Validation annotations.
Avoid long running loops in your code. Long running loops can cause high CPU usage, leading to errors such as, "Bot is unresponsive."
Add logging
Use the default log4J logger provided in the bot run time framework. Do not add your own logger. See the sample code for details.
Logging levels
  • ERROR/FATAL: Severe error event that the user is affected and there is no workaround.
  • WARN : Unexpected error occurred but the system has recovered from it.
  • INFO: Informational messages about state change, for example, an accepted request.
  • DEBUG: Detailed diagnostic information that will be required to debug when something goes wrong.
  • TRACE: All information is captured about an application behavior.

    If you are not sure of the log level, set it to TRACE.

Loading resources
All resources should be loaded using current thread context class loader, as shown in the following example:
피드백을 보내주십시오