mirror of
https://github.com/Telecominfraproject/wlan-testing.git
synced 2025-11-03 04:18:15 +00:00
Fixed Tear Down and Added XFAIL Support
Signed-off-by: raj-TIP <rpasupathy@perfectomobile.com>
This commit is contained in:
@@ -271,7 +271,7 @@ def set_APconnMobileDevice_android(request, WifiName, WifiPass, setup_perfectoMo
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
report.step_start("Verify if Wifi is Connected")
|
report.step_start("Verify if Wifi is Connected")
|
||||||
WifiInternetErrMsg = WebDriverWait(driver, 35).until(EC.presence_of_element_located((MobileBy.XPATH, "//*[@resource-id='com.android.settings:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']")))
|
WifiInternetErrMsg = WebDriverWait(driver, 60).until(EC.presence_of_element_located((MobileBy.XPATH, "//*[@resource-id='com.android.settings:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']")))
|
||||||
print("Wifi Successfully Connected")
|
print("Wifi Successfully Connected")
|
||||||
|
|
||||||
except NoSuchElementException:
|
except NoSuchElementException:
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ class TestAcessPointConnection(object):
|
|||||||
|
|
||||||
if ssidName not in get_vif_state:
|
if ssidName not in get_vif_state:
|
||||||
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
|
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
|
||||||
|
|
||||||
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
|
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
|
||||||
|
|
||||||
report = setup_perfectoMobile_android[1]
|
report = setup_perfectoMobile_android[1]
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ class TestNatMode(object):
|
|||||||
|
|
||||||
#ForgetWifi
|
#ForgetWifi
|
||||||
ForgetWifiConnection(request, setup_perfectoMobile_android, ssidName, connData)
|
ForgetWifiConnection(request, setup_perfectoMobile_android, ssidName, connData)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.twog
|
@pytest.mark.twog
|
||||||
@pytest.mark.wpa2_personal
|
@pytest.mark.wpa2_personal
|
||||||
@@ -95,6 +96,7 @@ class TestNatMode(object):
|
|||||||
#ForgetWifi
|
#ForgetWifi
|
||||||
ForgetWifiConnection(request, setup_perfectoMobile_android, ssidName, connData)
|
ForgetWifiConnection(request, setup_perfectoMobile_android, ssidName, connData)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.twog
|
@pytest.mark.twog
|
||||||
@pytest.mark.wpa
|
@pytest.mark.wpa
|
||||||
@@ -121,8 +123,7 @@ class TestNatMode(object):
|
|||||||
|
|
||||||
#ForgetWifi
|
#ForgetWifi
|
||||||
ForgetWifiConnection(request, setup_perfectoMobile_android, ssidName, connData)
|
ForgetWifiConnection(request, setup_perfectoMobile_android, ssidName, connData)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.fiveg
|
@pytest.mark.fiveg
|
||||||
@pytest.mark.wpa
|
@pytest.mark.wpa
|
||||||
def test_ClientConnectivity_5g_WPA(self, request, get_vif_state, get_APToMobileDevice_data, setup_perfectoMobile_android):
|
def test_ClientConnectivity_5g_WPA(self, request, get_vif_state, get_APToMobileDevice_data, setup_perfectoMobile_android):
|
||||||
@@ -148,4 +149,3 @@ class TestNatMode(object):
|
|||||||
|
|
||||||
#ForgetWifi
|
#ForgetWifi
|
||||||
ForgetWifiConnection(request, setup_perfectoMobile_android, ssidName, connData)
|
ForgetWifiConnection(request, setup_perfectoMobile_android, ssidName, connData)
|
||||||
|
|
||||||
|
|||||||
@@ -650,14 +650,15 @@ def pytest_runtest_makereport(item, call):
|
|||||||
print("\nUpgrade Python to 3.9 to avoid test_ string in your test case name, see below URL")
|
print("\nUpgrade Python to 3.9 to avoid test_ string in your test case name, see below URL")
|
||||||
#print("https://www.andreagrandi.it/2020/10/11/python39-introduces-removeprefix-removesuffix/")
|
#print("https://www.andreagrandi.it/2020/10/11/python39-introduces-removeprefix-removesuffix/")
|
||||||
|
|
||||||
if result.outcome == "failed":
|
#exception = call.excinfo.value
|
||||||
testCaseFailedStatusValue = "FAILED"
|
#exception_class = call.excinfo.type
|
||||||
exception = call.excinfo.value
|
#exception_class_name = call.excinfo.typename
|
||||||
exception_class = call.excinfo.type
|
|
||||||
exception_class_name = call.excinfo.typename
|
#exception_traceback = call.excinfo.traceback
|
||||||
exception_type_and_message_formatted = call.excinfo.exconly()
|
|
||||||
exception_traceback = call.excinfo.traceback
|
|
||||||
|
|
||||||
|
if result.outcome == "failed":
|
||||||
|
exception_type_and_message_formatted = call.excinfo.exconly()
|
||||||
|
testCaseFailedStatusValue = "FAILED"
|
||||||
reporting_client.test_stop(TestResultFactory.create_failure(str(testCaseErrorMsg)))
|
reporting_client.test_stop(TestResultFactory.create_failure(str(testCaseErrorMsg)))
|
||||||
testCaseNameList.append(TestCaseName)
|
testCaseNameList.append(TestCaseName)
|
||||||
testCaseStatusList.append(testCaseFailedStatusValue)
|
testCaseStatusList.append(testCaseFailedStatusValue)
|
||||||
@@ -677,21 +678,37 @@ def pytest_runtest_makereport(item, call):
|
|||||||
print("\n TestStatus: " + testCasePassedStatusValue)
|
print("\n TestStatus: " + testCasePassedStatusValue)
|
||||||
reportPerfecto(TestCaseName, testCasePassedStatusValue, "N/A", str(reporting_client.report_url()))
|
reportPerfecto(TestCaseName, testCasePassedStatusValue, "N/A", str(reporting_client.report_url()))
|
||||||
|
|
||||||
|
if result.outcome == "skipped":
|
||||||
|
testCaseSkippedStatusValue = "SKIPPED"
|
||||||
|
exception_type_Skipped_message_formatted = call.excinfo.exconly()
|
||||||
|
reporting_client.test_stop(TestResultFactory.create_failure(str(exception_type_Skipped_message_formatted)))
|
||||||
|
testCaseNameList.append(TestCaseName)
|
||||||
|
testCaseStatusList.append("SKIPPED")
|
||||||
|
testCaseErrorMsg.append(str(exception_type_Skipped_message_formatted))
|
||||||
|
testCaseReportURL.append(reporting_client.report_url())
|
||||||
|
print("\n TestStatus: " + testCaseSkippedStatusValue)
|
||||||
|
print(" FailureMsg: " + str(testCaseErrorMsg))
|
||||||
|
reportPerfecto(TestCaseName, testCaseSkippedStatusValue, testCaseErrorMsg, str(reporting_client.report_url()))
|
||||||
|
|
||||||
|
|
||||||
def pytest_sessionfinish(session, exitstatus):
|
def pytest_sessionfinish(session, exitstatus):
|
||||||
|
|
||||||
print()
|
print()
|
||||||
|
skipped_amount = 0
|
||||||
#print('Perfecto TestCase Execution Status:', exitstatus)
|
#print('Perfecto TestCase Execution Status:', exitstatus)
|
||||||
passed_amount = sum(1 for result in session.results.values() if result.passed)
|
passed_amount = sum(1 for result in session.results.values() if result.passed)
|
||||||
failed_amount = sum(1 for result in session.results.values() if result.failed)
|
failed_amount = sum(1 for result in session.results.values() if result.failed)
|
||||||
|
skipped_amount = sum(1 for result in session.results.values() if result.skipped)
|
||||||
# print(f'There are {passed_amount} passed and {failed_amount} failed tests')
|
# print(f'There are {passed_amount} passed and {failed_amount} failed tests')
|
||||||
TotalExecutedCount = failed_amount + passed_amount
|
TotalExecutedCount = failed_amount + passed_amount + skipped_amount
|
||||||
|
|
||||||
print('\n------------------------------------')
|
print('\n------------------------------------')
|
||||||
print('Perfecto TestCase Execution Summary')
|
print('Perfecto TestCase Execution Summary')
|
||||||
print('------------------------------------')
|
print('------------------------------------')
|
||||||
print('Total TestCase Executed: ' + str(TotalExecutedCount))
|
print('Total TestCase Executed: ' + str(TotalExecutedCount))
|
||||||
print('Total Passed: ' + str(passed_amount))
|
print('Total Passed: ' + str(passed_amount))
|
||||||
print('Total Failed: ' + str(failed_amount) + "\n")
|
print('Total Failed: ' + str(failed_amount))
|
||||||
|
print('Total Skipped: ' + str(skipped_amount) + "\n")
|
||||||
|
|
||||||
for index in range(len(testCaseNameList)):
|
for index in range(len(testCaseNameList)):
|
||||||
print(str(index+1) + ") " + str(testCaseNameList[index]) + " : " + str(testCaseStatusList[index]))
|
print(str(index+1) + ") " + str(testCaseNameList[index]) + " : " + str(testCaseStatusList[index]))
|
||||||
|
|||||||
Reference in New Issue
Block a user