Saturday, September 9, 2024
Your first AI-Driven testing flow with Magic Inspector
How to Write a Browser Testing Flow with AI
When it comes to browser testing, AI can take the complexity out of the process. With Magic Inspector, you can create, run, and schedule automated browser tests using just a few clicks. Here’s how you can write a complete browser testing flow with AI, all without touching a single line of code.
1. Create a New Test on Magic Inspector
First, log in to Magic Inspector and head to the dashboard. Click on "Create a New Test" and add your website's URL along with a test name. This is the first step toward setting up your AI-driven test flow.
2. Create Your First Instruction
Now that your test is created, it's time to add the first instruction. Magic Inspector allows you to use natural language commands to create different types of instructions.
2.1 How to Choose Among Instruction Action Types?
There are several instruction types you can use based on what you want to test. Here’s a quick rundown of each:
- clickElement: This is perfect when you need to simulate clicking a button, link, or any clickable element on the page.
- chooseFiles: Use this action to test file uploads. Simply specify the file path, and Magic Inspector will handle the rest.
- selectDropdown: When you need to select an option from a dropdown menu, this action makes it simple. Just specify the option you want.
- AI Visual Assertion: This feature is a game-changer. It allows you to visually verify that certain elements (like text or images) appear as expected on the page.
- fillInput: Whether it's a text field, search box, or form input, use this instruction to enter specific values.
- setCheckbox: Perfect to set or unset the value of a checkbox item.
- waitForDelay: Wait for a specific delay (in ms).
Note: we constantly add more action types. Each action type has a tooltip that helps you to understand how it works.
Each of these instructions can be added in plain English, making it incredibly easy to create a flow that tests various user interactions on your app.
3. Run Your Test and Verify in Real Time
Once you've set up your instructions, it’s time to run the test.
Hit "Run Scenario", and Magic Inspector will start executing the steps you created. The best part? You can monitor the test in real time. The right pane in the dashboard shows screenshots and logs for every step, so you can immediately see what the AI is doing and verify if things are working as expected.
4. Schedule It by Adding to a Suite
You can also schedule your test to run automatically at regular intervals by adding it to a suite.
Click on "Schedule in a suite". Then create a new suite or select an existing one.
During the suite creation process, you can choose to run the suite manually or schedule it at a given interval.
If you choose "Scheduled" in the suite settings, you can check how often you want your test to run. Whether it’s daily, weekly, or monthly, you can easily configure it to fit your needs.
Conclusion
And that’s it! With Magic Inspector, creating a browser testing flow is quick and easy, even if you’re not a developer. From setting up tests with natural language instructions to running and scheduling them, AI makes browser automation accessible to everyone.