This repository demonstrates how to integrate AskUI automation testing with Java, allowing you to run AskUI TypeScript tests from a Java environment.
- Run AskUI automation tests from Java
- Environment configuration management
- Sample login automation test
- Java JDK 11 or higher
- Node.js and npm
- Visual Studio Code
- Chrome browser
- AskUI account and credentials (workspace id and token) (Login here)
- Install AskUI Suite Download here
-
Clone the repository
git clone https://github.com/askui/askui_java_example.git cd askui_java_example -
Install askui dependencies Open project, In VS-terminal type. (Download AskUI Suite)
askui-shell
-
Set up AskUI configuration
- Go to typescript-askui-project folder in the terminal, Update environment variables and npm install. (Open app.askui.com -> Access Tokens -> Create Token)
# Installes node dependencies npm install AskUI-SetSettings -WorkspaceId <workspace id> -Token <access token>
ASKUI_JAVA_EXAMPLE
├── askui_java
│ ├── .vscode
│ │ └── settings.json
│ ├── src
│ │ └── AskUIJavaRunner.java
│ └── target
│ └── AskUIJavaRunner.class
├── cucumber-java-skeleton
│ └── target
├── typescript-askui-project
│ ├── .askui
│ │ └── Settings
│ │ └── AskuiEnvironmentSettings.json
│ ├── allure-results
│ ├── askui_example
│ │ └── helpers
│ │ ├── askui-helper.ts
│ │ ├── jest.config.ts
│ │ └── sample.test.ts
│ ├── node_modules
│ ├── .eslintignore
│ ├── .eslintrc.json
│ ├── .gitignore
│ ├── package-lock.json
│ ├── package.json
│ ├── tsconfig.json
│ └── README.md
The repository includes a sample test that demonstrates logging into a website, which is what we would call to test in this project:
// See sample.test.ts in repository, place it in your askui folder that is created after you have installed askui in VS code- Start askui-controller
AskUI-StartController -RunInBackground
-
Compile the Java runner
javac -d target askui_java/src/AskUIJavaRunner.java
-
Execute tests
java -cp target AskUIJavaRunner
-
Show Output
<insert start> ... Starting AskUI test execution... PATH: C:\Program Files\askui GmbH\AskUI Suite\DependencyCache\Links\Powershell;C:\Program Files\askui GmbH\AskUI Suite\DependencyCache\Links\NodeJS;C:\Program Files\askui GmbH\AskUI Suite\DependencyCache\Links\Powershell;C:\Program Files\Common................ Working directory: C:\Users\xxxxxt Executing command: npm.cmd run askui > typescript-askui-project@1.0.0 askui > jest --config ./askui_example/jest.config.ts --runInBand<Jest Test Report> ......
- Ensure all environment variables are properly set before running tests
- The Chrome browser must be installed for web automation tests
- Keep your AskUI credentials secure and never commit them to version control
- Make sure the paths in
AskUIJavaRunner.javamatch your local setup
Common issues and solutions:
-
Java Path Issues
- Ensure JAVA_HOME is properly set
- Verify Java version compatibility
-
Node.js Dependencies
- Run
npm installto ensure all dependencies are installed - Check for any conflicting package versions
- Run
-
AskUI Connection Issues
- Verify your workspace ID and token
- Check network connectivity
- Ensure the AskUI controller is running