当前位置:网站首页>ECU test modify test case
ECU test modify test case
2022-06-25 21:21:00 【Pingshan 888 male technician】
In the use of ECU TEST When software is tested automatically , Due to lack of previous testing experience , It is often impossible to test a function completely . For example, the function of switching lights . When the light is on , The relevant signals returned by the controller to the bus are 1, When the light is turned off, the relevant signal is 2, At the same time, the controller has a hard line to output signals to the board . Early test engineers only focus on message interaction and ignore hard line detection , Therefore, develop relevant scripts to add hard wire detection signals at specific locations of the original cases , Ensure that the hardwire signal is detected every time the message value is read , Other functions can also be used .
Correlation function / The explanation of class has been pointed out in previous articles , You can read it yourself .
import os
import sys
sys.path.append(r'D:\ECU_TEST 2020.4\Templates\ApiClient') # You can also put all .py The file is placed in the project folder for direct import
path = r'D:\ECU_TEST 2020.4\Packages' # The folder where the test cases are stored
from ApiClient import ApiClient
api = ApiClient
def get_pkg(path):
pkg_list = []
for root, dirs, files in os.walk(path):
for filename in files:
if '.pkg' in filename:
pkg_list.append(root + '\\' + filename)
# print(pkg_list)
return pkg_list
def add_head_light_hardline(pkg):
PKG = api.PackageApi.OpenPackage(pkg)
TEST_BLOCK = PKG.GetTestSteps()
for block in TEST_BLOCK:
if block.GetType == 'TsBlock':
i = 0
for step in block.GetTestSteps():
i = i + 1
if 'XXXXXXXX' in step.GetActionColumnText(): # Read the value of the message
mapping1 = api.PackageApi.MappingApi.CreateGenericMappingItem(variable=None, referenceName=' Hardwire signal ') # Create a mapping The signal
add_step = api.PackageApi.TestStepApi.CreateTsRead(mapping1) # Create a step
if step.GetActionColumnText() == 'value == 1': # Light on signal
add_step.SetExpectationExpression('value == 1')
else:
add_step.SetExpectationExpression('value == 0')
block.InsertTestStep(add_step, i) # Insert the step at the specified position
else:
print(block.GetType())
PKG.Save()
if __name__ == '__main__':
for pkg in get_pkg(path):
add_head_light_hardline(pkg)
# Please indicate the source of the original works
边栏推荐
- OLED driven learning based on ssd1306 (II): addressing mode of ssd1306
- Jingxi Pinpin wechat applet -signstr parameter encryption
- Basic knowledge of software engineering required for soft test
- [important notice] developer document update (12.13-12.19)
- Yolov4 improved version comes out! Yolov4 extended edition! Yolov4 launched scaled-yolov4: scaling cross stage partial network
- [machine learning] machine learning from zero to mastery -- teach you to recognize handwritten digits using KNN
- 1.0-mq getting started and using
- Those high-frequency and real software test interview questions sorted out by the test director in 7 days, come to get
- Record some questions about MySQL (DNS reverse resolution in Linux)
- Command 'GCC' failed with exit status 1 when PIP install mysqlclient
猜你喜欢

Openocd adds third-party device support: ht32f52352 Cortex-M0+

Getting started and using postman

Working principle and experimental analysis of DHCP

Yolov4 reading notes (with mind map)! YOLOv4: Optimal Speed and Accuracy of Object Detection

C language dynamic memory allocation

What is DNS (domain name server)? (Powercert animated videos)

Unable to connect to the server remotely locally using the Jupiter notebook

Volatile qualifier

How to solve the problem of flash write protection in STM32?
![[nailing scenario capability package] manage the on-the-job / off-the-job situation of employees](/img/ec/c2f342a54ab69d8b834a8a1c8f8a01.jpg)
[nailing scenario capability package] manage the on-the-job / off-the-job situation of employees
随机推荐
[opencv] opencv from introduction to mastery -- detailed explanation of input and output XML and yaml files
How testers write functional test cases
CANoe. Diva operation guide - establishment of operation environment
Install JDK, MySQL and nexus under Linux (tar package installation)
Jmeter- (II) basic interface and common components for interface testing
[summary] 2021unctf Campus (cry & MISC)
[buucry] sensor (Manchester code)
Docker failed to remotely access 3306 after installing MySQL
Insert and update each database
Talking about the foundation of function test today
Unable to connect to the server remotely locally using the Jupiter notebook
What is a server? (Powercert animated videos)
XMIND to excel test case
Get parameters in URL
js(3)
Is it safe for qiniu school to open a securities account?
Big end and small end
JS__ Inheritance mode, namespace, object enumeration__ Duyi
Lesson 1 Preparation
Differences between modems and routers (powercert animated videos)