Junior — Middle
What types of collections have you used in your projects?
sobes.tech AI
Answer from AI
In QA and test automation projects, various types of collections are often used for storing and processing data:
- Lists — ordered mutable collections, convenient for storing sequences of elements, such as a list of test cases.
- Sets — unordered collections of unique elements, useful for removing duplicates or checking intersections.
- Dictionaries — collections of key-value pairs, often used for storing test parameters or results with quick access by key.
- Tuples — immutable sequences, used for storing fixed sets of data.
Example in Python:
# List of test cases
test_cases = ['test_login', 'test_logout', 'test_signup']
# Set of unique errors
errors = {'404 Not Found', '500 Internal Server Error'}
# Dictionary with test results
results = {'test_login': 'passed', 'test_logout': 'failed'}
# Tuple with parameters
params = ('chrome', 'windows', '1080p')