Return-Path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=profusion-mobi.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=nrrjbxCZpxLzbvkcTl+in8G+k6BmtUyNGHG6l0Faw30=; b=Pp15MvPHtG6aqmiRO9UzgulLMymye1aLG+T07sNQqrRHHlI0OsI1B4iyvTe+bToxm1 YomUMIjXhDXPx9QfU3S/9hRBXXhWbhxFpyc9/KMUcLgfqsxjy5DES4bk2TEIuwyLyanN QrOM+/ZiiQhJDuASkNS06lPxz1YUdcdBD4mv6VPgLOD6XoXkQ+Zn8Dp9gbX34OMq+lre FFqPzyeDFBIw1DTC9JtJdjpsFLPE9ak4OXjuFg4Rujk5XdrNFh+XhF9eo5Q2bzvSNY0t IWZTHajeF1tke2nUAS3r0mzwXzblH9r45lMwkWKDqZqJEiG5gMjtgvFT9YqrymHxbZLl NNQQ== From: Guilherme Campos Camargo Date: Wed, 2 May 2018 11:20:50 -0300 Message-Id: <20180502142052.29544-7-guicc@profusion.mobi> In-Reply-To: <20180502142052.29544-1-guicc@profusion.mobi> References: <20180502142052.29544-1-guicc@profusion.mobi> Subject: [Fuego] [PATCH 6/8] Add `description` optional argument to test cases List-Id: Mailing list for the Fuego test framework List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: fuego@lists.linuxfoundation.org Add a `description` optional argument to test cases, that may be used by execute_tests to print the test description on the final report. Signed-off-by: Guilherme Campos Camargo --- .../Functional.fuego_release_test/test_run.py | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/engine/tests/Functional.fuego_release_test/test_run.py b/engine/tests/Functional.fuego_release_test/test_run.py index 42aa403..e226a96 100755 --- a/engine/tests/Functional.fuego_release_test/test_run.py +++ b/engine/tests/Functional.fuego_release_test/test_run.py @@ -131,10 +131,12 @@ class SeleniumCommand: class Visit(SeleniumCommand): - def __init__(self, url, timeout=10, expected_result=200): + def __init__(self, url, timeout=10, expected_result=200, + description="visit"): self.url = url self.timeout = timeout self.expected_result = expected_result + self.description = description def exec(self, selenium_ctx): super().exec(selenium_ctx) @@ -154,11 +156,13 @@ class Visit(SeleniumCommand): class CheckText(SeleniumCommand): - def __init__(self, locator, pattern, text='', expected_result=True): + def __init__(self, locator, pattern, text='', expected_result=True, + description="check text"): self.pattern = pattern self.locator = locator self.text = text self.expected_result = expected_result + self.description = description def exec(self, selenium_ctx): super().exec(selenium_ctx) @@ -175,7 +179,8 @@ class CheckText(SeleniumCommand): class CheckScreenshot(SeleniumCommand): def __init__(self, ref_img, output_dir='/tmp', locator=None, pattern=None, mask_img=None, expected_result=True, - threshold=0.0, rm_images_on_success=True): + threshold=0.0, rm_images_on_success=True, + description="check screenshot"): def basename_with_suffix(filename, suffix): basename = os.path.basename(filename) head, sep, tail = basename.rpartition('.') @@ -191,6 +196,7 @@ class CheckScreenshot(SeleniumCommand): self.expected_result = expected_result self.threshold = threshold self.rm_images_on_success = rm_images_on_success + self.description = description # Output files self.diff_img_path = os.path.join( @@ -351,9 +357,10 @@ class CheckScreenshot(SeleniumCommand): class Click(SeleniumCommand): - def __init__(self, locator, pattern): + def __init__(self, locator, pattern, description="click"): self.pattern = pattern self.locator = locator + self.description = description def exec(self, selenium_ctx): super().exec(selenium_ctx) @@ -367,6 +374,9 @@ class Click(SeleniumCommand): class Back(SeleniumCommand): + def __init__(self, description="back"): + self.description = description + def exec(self, selenium_ctx): super().exec(selenium_ctx) @@ -386,10 +396,12 @@ class ShExpect(): (COMMAND_OUTPUT_DELIM, COMMAND_OUTPUT_DELIM, BASH_PATTERN), re.M | re.S) - def __init__(self, cmd, expected_output=None, expected_result=0): + def __init__(self, cmd, expected_output=None, expected_result=0, + description=None): self.cmd = cmd self.expected_result = expected_result self.expected_output = expected_output + self.description = description or "sh expect %s" % cmd def exec(self, pexpect_ctx): self.client = pexpect_ctx.client -- 2.17.0