Skip to content
GitHubXDiscord

TestCase

The TestCase resource lets you manage AWS AppTest TestCases for automating application testing.

Create a basic AppTest TestCase with essential properties.

import AWS from "alchemy/aws/control";
const basicTestCase = await AWS.AppTest.TestCase("basicTestCase", {
Name: "BasicTestCase",
Steps: [
{
Action: "Click",
Target: "button#submit"
},
{
Action: "Type",
Target: "input#username",
Value: "testUser"
}
],
Description: "A basic test case for user login"
});

Configure an AppTest TestCase with additional steps and tags for better organization.

const advancedTestCase = await AWS.AppTest.TestCase("advancedTestCase", {
Name: "AdvancedTestCase",
Steps: [
{
Action: "Click",
Target: "button#submit"
},
{
Action: "Type",
Target: "input#username",
Value: "testUser"
},
{
Action: "Type",
Target: "input#password",
Value: "securePassword123"
},
{
Action: "Click",
Target: "button#login"
},
{
Action: "AssertVisible",
Target: "div#dashboard"
}
],
Description: "An advanced test case for user login with validation",
Tags: {
environment: "staging",
priority: "high"
}
});

Create a TestCase that includes logging steps for better debugging during test execution.

const loggingTestCase = await AWS.AppTest.TestCase("loggingTestCase", {
Name: "LoggingTestCase",
Steps: [
{
Action: "Log",
Message: "Starting the login process"
},
{
Action: "Type",
Target: "input#username",
Value: "testUser"
},
{
Action: "Log",
Message: "Username entered, now typing password"
},
{
Action: "Type",
Target: "input#password",
Value: "securePassword123"
},
{
Action: "Click",
Target: "button#login"
},
{
Action: "AssertVisible",
Target: "div#dashboard"
},
{
Action: "Log",
Message: "Login process completed"
}
],
Description: "Test case with logging for each step"
});