How to use tapLogger method in fMBT

Best Python code snippet using fMBT_python

client_sc_establish_timeout.py

Source:client_sc_establish_timeout.py Github

copy

Full Screen

1#!/usr/bin/env python32# -*- coding: utf-8 -*-3# Licensed to Systerel under one or more contributor license4# agreements. See the NOTICE file distributed with this work5# for additional information regarding copyright ownership.6# Systerel licenses this file to you under the Apache7# License, Version 2.0 (the "License"); you may not use this8# file except in compliance with the License. You may obtain9# a copy of the License at10#11# http://www.apache.org/licenses/LICENSE-2.012#13# Unless required by applicable law or agreed to in writing,14# software distributed under the License is distributed on an15# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY16# KIND, either express or implied. See the License for the17# specific language governing permissions and limitations18# under the License.19"""20Freeopcua based test client to validate the SOPC server.21Tests that HEL/ACK and SecureChannel timeouts are respected by the server.22"""23from time import sleep24import sys25from common import sUri, create_client26from tap_logger import TapLogger27if __name__=='__main__':28 # tests with one connexion29 print('Connecting to', sUri)30 client = create_client()31 logger = TapLogger("sc_establish_timeout.tap")32 headerString = "******************* {0} *********************"33 logger.begin_section("SC establishment timeout")34 # secure channel connection35 print(headerString.format("Connect socket"))36 client.connect_socket()37 print(headerString.format("Wait SC establishment timeout (10 seconds)"))38 sleep(11)39 print(headerString.format("Attempt to send HEL after timeout"))40 try:41 client.send_hello()42 except:43 logger.add_test('- HEL refused after timeout', True)44 else:45 logger.add_test('- HEL refused after timeout', False)46 client.disconnect_socket()47 print(headerString.format("Connect socket + Send HEL"))48 client.connect_socket()49 client.send_hello()50 print(headerString.format("Wait SC establishment timeout (10 seconds)"))51 sleep(11)52 print(headerString.format("Attempt to send OPN after timeout"))53 try:54 client.open_secure_channel()55 except:56 logger.add_test('- OPN refused after timeout', True)57 else:58 logger.add_test('- OPN refused after timeout', False)59 client.close_secure_channel()60 client.disconnect_socket()61 logger.finalize_report()...

Full Screen

Full Screen

client_sc_renew.py

Source:client_sc_renew.py Github

copy

Full Screen

1#!/usr/bin/env python32# -*- coding: utf-8 -*-3# Copyright (C) 2018 Systerel and others.4#5# This program is free software: you can redistribute it and/or modify6# it under the terms of the GNU Affero General Public License as7# published by the Free Software Foundation, either version 3 of the8# License, or (at your option) any later version.9#10# This program is distributed in the hope that it will be useful,11# but WITHOUT ANY WARRANTY; without even the implied warranty of12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13# GNU Affero General Public License for more details.14#15# You should have received a copy of the GNU Affero General Public License16# along with this program. If not, see <http://www.gnu.org/licenses/>.17"""18Simple client to launch sc renew degraded tests19"""20from opcua import ua, Client21from opcua.ua import SecurityPolicy22from safety_secure_channels import secure_channels_connect23from sc_renew import secure_channel_renew24from common import sUri25from tap_logger import TapLogger26from opcua.crypto import security_policies27import re28import sys29if __name__=='__main__':30 # tests with one connexion31 print('Connecting to', sUri)32 client = Client(sUri)33 logger = TapLogger("sc_renew.tap")34 # tests of SC renew with degraded cases35 headerString = "******************* Beginning {0} test of degraded SC renew *********************"36 for sp in [SecurityPolicy, security_policies.SecurityPolicyBasic256]:37 logger.begin_section("security policy {0}".format(re.split("#",sp.URI)[-1]))38 # secure channel connection39 print(headerString.format(re.split("#",sp.URI)[-1]))40 secure_channels_connect(client, sp)41 secure_channel_renew(client, logger)42 logger.finalize_report()...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run fMBT automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful