The Future of UI Testing? - AI automated testing with AskUI
Tags: tutorial, automatedtesting, testing, askui
Published: 2023-03-02 12:04:38

---
title: The Future of UI Testing? - AI automated testing  with AskUI
published: true
date: 2022-07-12 12:37:48 UTC
tags: Tutorial,automatedtesting,Testing,askui
canonical_url: 
---

 ![The Future of UI Testing? - AI automated testing with AskUI](https://codesphere.ghost.io/content/images/2022/07/ui-illust.png)

UI testing can be an incredibly difficult task. Your tests need to be able to adapt to slight changes in sizes and devices in a way that usually requires an incredibly in depth integration with your web app.

Ideally, you could have the cognitive flexibility of a human to test your interfaces, but that kind of manual solution is simply not feasible at scale.

So how can you conduct UI testing with the intelligence of a human but without the massive investment of automated testing? That’s where AskUI comes in

* * *

### What is Ask UI  

[AskUI](https://www.askui.com/) is an automated UI testing tool that doesn’t go under the hood of your web app. Instead it sits in the same position as a user and uses artificial intelligence to identify and test out different UI elements.

Tests for AskUI can be written with an incredibly readable, but also highly-customizable, API.

AskUI is currently in early access, but you can get setup with their demo in just a couple minutes.

* * *

### Setting up the Demo  

If you want to get a sense of how AskUI works, we can set up an empty project with:

_`npm init -y`_

Install AskUI:

_`npm i -D askui`_

While AskUI provides the API for controlling your operating system to interact and scan the UI, it doesn’t provide a way to organize, write, and execute tests. However, it integrates well with libraries like Jest:

_`npm i -D jest`_

And then let’s use Typescript in this example:

_`npm i -D @types/jest ts-jest ts-node typescript`_

We can then setup the demo AskUI test suite with:

_`npx askui init`_

The default test in this demo will find some text and move the cursor to the text to click on it:

<!--kg-card-begin: html--><script src="https://gist.github.com/LiorB-D/d56ba600a399298ea278ce1c95267e52.js"></script><!--kg-card-end: html-->

Of course, you can customize this to target specific text, buttons, forms, as well as interact with the page in all kinds of ways.

Before we can run this, make sure you give your IDE permission to control your cursor and record your screen.

To run this test:

_`npx jest test/my-first-askui-test-suite.test.ts --config ./test/jest.config.ts`_

If everything is setup correctly, you should see your mouse move over to a piece of text and click on it:

![The Future of UI Testing? - AI automated testing with AskUI](https://lh6.googleusercontent.com/AEsqu0IVtRJFRu1_O-0E7EM7mYrt-r9Ojfv9HE7CwPNn-WhYNHujKOqDvud82dQSQprYZV52uG-FsVOzdgarcvx3dF3d-b0GOM8LFzybu3hj0xYRzA9tsScbkCyoaNxafSvUixDxZZZwWuMEzTh_R0o)

* * *

### Stay Tuned  

Again, AskUI is in early access so this is only the start of what AI powered front-end testing is capable of.

Nevertheless, the ease at which you can set up UI tests with AskUI is incredibly exciting! Tools like this allow robust testing to be a feasible process for startups who don’t have the resources for full on QA teams.