Shared Steps
Reusable steps across multiple tests
Create reusable test components that can be used across multiple tests, promoting consistency and reducing duplication.
What are Shared Steps?
Shared steps are test components that can be used in multiple tests. They help maintain consistency across your test suite and make it easier to update common actions.
Benefits of Shared Steps
- Consistency: Same behavior across all tests
- Maintenance: Update once, change everywhere
- Efficiency: Build tests faster with reusable components
- Quality: Well-tested components reduce errors
Creating Shared Steps
Making a Step Shared
- Create a Step: Build your step as usual
- Enable Sharing: Check the "Shared" option
- Add Documentation: Describe how to use the step
- Test Thoroughly: Ensure the step works correctly
- Save as Shared: Make it available to your team
Shared Step Properties
- Name: Clear, descriptive name
- Description: How to use the step
- Parameters: Configurable inputs
- Documentation: Usage examples and notes
Using Shared Steps
Adding to Tests
- Browse Library: Look through available shared steps
- Search Steps: Find steps by name or description
- Preview Step: See what the step does
- Add to Test: Include the step in your test
- Configure Parameters: Set specific values
Parameter Configuration
Pass different values to shared steps for different scenarios:
Example: Login Step
- Username: Set different usernames for different tests
- Password: Use different passwords as needed
- Environment: Test in different environments
Common Shared Steps
Authentication Steps
User Login:
- Purpose: Standard login process
- Parameters: Username, password, environment
- Usage: Use in all tests that require login
User Logout:
- Purpose: Standard logout process
- Parameters: None required
- Usage: Clean up after tests
Navigation Steps
Go to Dashboard:
- Purpose: Navigate to main dashboard
- Parameters: Base URL, user type
- Usage: Start tests from dashboard
Go to Specific Page:
- Purpose: Navigate to any page
- Parameters: Page URL, environment
- Usage: Flexible navigation
Form Steps
Fill Contact Form:
- Purpose: Complete contact forms
- Parameters: Name, email, message
- Usage: Test contact functionality
Submit Form:
- Purpose: Submit any form
- Parameters: Form type, validation
- Usage: Test form submissions
Organizing Shared Steps
Categories
- Authentication: Login, logout, security
- Navigation: Page navigation, menus
- Forms: Form filling, submissions
- Validation: Checking results, assertions
- Utilities: Common helper functions
Naming Conventions
- Descriptive Names: Clear purpose indication
- Consistent Format: Use similar naming patterns
- Version Numbers: Track step versions
- Team Standards: Follow team conventions
Best Practices
Step Design
- Single Purpose: One clear function per step
- Flexible Parameters: Make steps configurable
- Clear Documentation: Explain how to use the step
- Thorough Testing: Test in different scenarios
Organization
- Logical Grouping: Organize by function
- Consistent Naming: Use clear naming patterns
- Regular Review: Keep steps up to date
- Team Collaboration: Share knowledge
Maintenance
- Version Control: Track changes to steps
- Update Notifications: Inform team of changes
- Backward Compatibility: Maintain compatibility when possible
- Deprecation: Remove unused steps
Usage
- Appropriate Use: Use shared steps when they make sense
- Parameter Configuration: Set parameters correctly
- Testing: Test shared steps in your context
- Documentation: Document how you use shared steps