-
Notifications
You must be signed in to change notification settings - Fork 0
utUserResponse Manual
Ulrond edited this page Oct 15, 2024
·
1 revision
The utUserResponse
module provides a simple way to obtain user input during test execution, specifically for yes/no questions. This is useful for scenarios where manual confirmation or intervention is required during an automated test process.
class utUserResponse():
"""Reads the user response
"""
def __init__(self, log:logModule=None):
"""
Initializes a configuration reader instance based on the parameters.
Args:
log (class, optional): Parent log class. Defaults to None.
"""
# ... (Initialization logic) ...
def getUserYN(self, query="Please Enter Y or N :"):
"""
Reads Y/N user response to the query.
Args:
query (str, optional): Query to the user. Defaults to ""
Returns:
bool: returns the response
"""
# ... (Implementation) ...
To use the utUserResponse
class, create an instance of it. The constructor takes an optional log
argument, which is a logModule
object for logging purposes. If not provided, a default logger will be created.
The utUserResponse
class has one main method:
-
getUserYN(query="Please Enter Y or N :")
: Prompts the user with the givenquery
and waits for a "Y" or "N" response. ReturnsTrue
if the user enters "Y" or "y", andFalse
otherwise.
# Create an instance of the utUserResponse class
user_response = utUserResponse()
# Ask the user a yes/no question
result = user_response.getUserYN("Do you want to continue? (Y/N): ")
# Act based on the user's response
if result:
print("Continuing...")
else:
print("Exiting...")
This manual provides a basic understanding of the utUserResponse
module and its usage. For more detailed information, refer to the code documentation and examples.