Your First Test
Let's walk through creating a complete login test for a web application.
Prerequisites
- A Bug0 account (sign up here)
- A project with your application's base URL configured
- A test suite to hold your test
Example: Testing a Login Flow
We'll create a test that:
- Navigates to the login page
- Enters credentials
- Submits the form
- Verifies successful login
Step 1: Create the Test Case
- Open your project and navigate to a test suite
- Click New Test
- Name it "User Login"
- Choose Generate from Text
Step 2: Describe the Flow
Enter a description of what the test should do:
Login Flow:
1. Click on the "Sign In" link in the navigation
2. Enter the email address in the email field
3. Enter the password in the password field
4. Click the "Log In" button
5. Wait until the user dashboard is visible
Click Generate and the AI will create structured steps.
Step 3: Review Generated Steps
The AI will generate steps like:
| Step | Description | Wait Until |
|---|---|---|
| 1 | Click on the "Sign In" link in the navigation | Sign in form is visible |
| 2 | Enter the email address in the email field | - |
| 3 | Enter the password in the password field | - |
| 4 | Click the "Log In" button | - |
| 5 | Wait until the user dashboard is visible | Dashboard heading visible |
Step 4: Add Test Data
For steps that need input data, add the data field:
Step 2 - Email: {{run.email}}
Step 3 - Password: testpassword123
Using the {{run.email}} placeholder generates a unique email for each test run. See Dynamic Placeholders for more options.
Step 5: Add Assertions
Assertions verify your test passed. Add assertions like:
- "User should see the dashboard"
- "Welcome message should be displayed"
- "Logout button should be visible"
Step 6: Run the Test
- Click the Run button
- A live browser preview opens showing the test execution
- Watch as each step is executed
- Green checkmarks indicate successful steps
- Review the AI's reasoning for each action
Step 7: Publish the Test
Once your test passes:
- Click Publish to move steps from draft to published
- Published tests can be run in CI/CD pipelines
- Draft changes don't affect CI/CD runs until published
Common Patterns
Using Authentication Settings
Instead of hardcoding credentials in steps, configure them in project or suite settings:
- Go to Project Settings or Suite Settings
- Add Email and Password under Authentication
- The AI will use these credentials when steps mention "enter email" or "enter password"
Creating a Login Suite
For apps requiring authentication:
- Create a suite named "Login" (or similar)
- Mark it as a Login Suite in settings
- After successful run, cookies are saved automatically
- Other test suites can reuse this authenticated state
Handling Wait Conditions
Add waitUntil to steps that trigger navigation or loading:
Step: Click the "Submit" button
Wait Until: Success message appears
The AI will poll until the condition is met (30 second timeout).