KEMBAR78
AUTOMATED TESTING USING PYTHON (ATE) | PPT
1
YUVARAJA.R - M.TECH EMBEDDED SYSTEMS TECHNOLOGIES
REG NO - 13PEES1005
PROJECT INCHARGE - K.Bhaskar.,B.Tech.,M.E.(Ph.D)
COLLEGE - VEL TECH Dr.RR & Dr.SR TECHNICAL UNIVERSITY
AUTOMATED HARDWARE TESTING
USING PYTHON
ABSTRACT
2
Design a Embedded Prototype test hardware
interact with Python software shows presence of
defects in UUT. Python test script can download
the test cases to the target system one by one,
receive test output, compare with specifications
then verify it, and generate log files. Log files inside
test steps results are stored as PASS/FAIL.
It’s a cost effective test system for SS Electronic
hardware manufacturers
TESTING
3
Testing is an organized process to verify the
behavior, performance, and reliability of a device
It ensures a device or system to be as defect-free as
possible
Testing is a manufacturing step to ensure that the
manufactured device is defect free.
Manual Testing
Automated Testing
Manual & Automated Testing
4
Testing is carried out manually by test engineers.
Consuming a lot of time and effort huge for spending the
time for manual testing.
Automated test equipment need a special fixture to place
the board and test the device using instruments
EXISTING SYSTEM
5
Testing is carried out manually by test engineers.
Consuming a lot of time and effort huge for spending the
time for testing.
NI Lab View designing a ATE .But measurements are taken
by reputed instruments or NI PXI only
PXI HW and its software is huge amount.
Certified engineer only able to access the software
Add-on software needed for Test case and Report
generation .
PROPOSED SYSTEM
6
 To overcome the existing problem, we construct
Embedded hardware test module to measure the
 Resistance test applied to signal traces (short/open)
 Voltage /current measure with help of analog pins.
 IO pins used to trigger the on/off or control the hw.
 Protocols testing are done by the test hardware.
Tested data packets serially communicated to the
Python scripts
 Python scripts collect the complied data's then
compare with test case input and generate the test
reports..
PROJECT – ENTIRE SYSTEM
7
SERIAL INTERFACE
EMBEDDED TEST HW DESIGN
8
Atmega 8-bit AVR controller used for Embedded Test
Hardware system.
Necessity to test the every protocols chips, Analog and
Digital IC.
Current, Voltage and Resistance measurements using
10bit ADC
I2C >> | RTC | EEPROM | SENSORS | DEVICES |
UART >> RS232 <<
RS485 >> 75176-IC <<
RS422 >> 75176 TX+ ->>75176 RX+ -<<
PYTHON
9
Python is a clear and powerful object-oriented
programming language, comparable to Perl,
Tcl and Java.
It’s a FOSS Programming language.
Runs on many different computers and
operating systems: Windows, MacOS, many
brands of Unix, OS/2
Python Code can be grouped into modules and
packages
HW DESIGN – VOLTAGE ,CURRENT &
RESISTANCE MEASUREMENT
10
Voltage measured by using AVR Controller 10bit
ADC .
Constant current probing to the voltage net through
voltage divider circuit. Impedance measured by the
ADC.
Current measurement taken by ACS712 Current
sensor IC.
CURRENT MEASURMENT USING ACS712
AUTOMATED HARDWARE TESTING
11
Hall-effect sensor ICs (especially the ratio metric
linear types) are superb devices for 'open-loop'
current-sensing designs
HW DESIGN – PROTOCOLS TESTING-I2C
12
I2C (Inter-Integrated Circuit, pronounced "I squared C") is
also a synchronous protocol.I2C uses only 2 wires, one for
the clock (SCL) and one for the data (SDA). That means
that master and slave send data over the same wire, again
controlled by the master.
I2C PROTOCOLS TESTING –SCANNER
METHOD
AUTOMATED HARDWARE TESTING
13
Sequence of 7-bit address send to the slave device .
Wire.beginTransmission(address);
ack = Wire.endTransmission();
ACK=‘0’ device found.
>I2C Device found at adress 0x48,0x57,0x67
>[3 device found ]
HW DESIGN – PROTOCOLS TESTING-
UART / RS232 SERIAL
14
 Serial communication is the process of sending
data one bit one by one sequentially, over a
communication channel.
UART communication of Full duplex TX and RX
communication through the COM devices.
HW DESIGN – PROTOCOLS TESTING – RS422
15
 The RS422 Standard defines a serial communications standard.
RS422 is a high speed and long distance data transmission. Each signal
is carried by a pair of wires and is thus a differential data transmission
system.
HW DESIGN – PROTOCOLS TESTING – RS485
16
 RS-485 is a superset of RS-422; thus, all RS-422 devices
may be controlled by RS-485. RS-485 hardware may be
used for serial communication with up to 4000 feet of
cable.
The main difference is that up to 32 transmitter receiver
pairs may be present on the line at one time. RS485
Differential communication A <-> B Signal lines.
SOFTWARE DESIGN - PYTHON
AUTOMATED HARDWARE TESTING
17
An open source software used to Automate the
Hardware Testing
UNITTEST module supports test automation,
sharing of setup and shutdown code for tests,
aggregation of tests into collections, and
independence of the tests from the reporting
framework.
PySerial module supports serial communication
between device to pc data transmission.
File handling function used to generate the log
file report.
UNIT TEST MODULE CONCEPTS
AUTOMATED HARDWARE TESTING
18
 Test Fixture : It represents the preparation needed to
perform one or more tests, and any associate cleanup
actions. This may involve, for example, creating temporary
or proxy databases, directories, or starting a server
process.
 Test Case: is the smallest unit of testing. It checks for a
specific response to a particular set of inputs. Unit test
provides a base class, Test Case which may be used to
create new test cases.
 Test Suite: Test suite is a collection of test cases, test
suites, or both. It is used to aggregate tests that should be
executed together.
REQUIREMENTS & TEST CASE
RELATIONSHIP
AUTOMATED HARDWARE TESTING
19
UUT CODE SAMPLE
AUTOMATED HARDWARE TESTING
20
Def ScaledInput(data):
rc = NO_ERR
scaled_data = data
if data >= DATA_MIN and data <= DATA_MAX:
scaled_data = (data * data_scale) + data_offset
if scaled_data > SCALE_MAX:
scaled_data = SCALE_MAX
rc = ERR_MAXSCALE
elif scaled_data < SCALE_MIN:
scaled_data = SCALE_MIN
rc = ERR_MINSCALE
else:
rc = ERR_OVER
return (rc, scaled_data)
Function code getting one input argument
Function Returning two o/p values
Function with argument code table
AUTOMATED HARDWARE TESTING
21
A unit test is constructed such that all possible inputs are
used to force the execution to traverse all possible paths. In
the case of ScaledInput(), we can see that there are three
obvious input test cases. Too low,
Too high,
Within range.
PYSERIAL MODULE
AUTOMATED HARDWARE TESTING
22
This module encapsulates the access for the serial
port. The module named “serial” automatically
selects the appropriate backend
Same class based interface on all supported
platforms.
Access to the port settings through Python
properties.
Support for different byte sizes, stop bits, parity and
flow control with RTS/CTS and/or Xon/Xoff.
Working with or without receive timeout.
PY SERIAL COM PORT CODE
AUTOMATED HARDWARE TESTING
23
class AHT_Serial(object):
def __init__(self, serial_port='COM3',
baud_rate=9600,read_timeout=5):
self.serial = serial.Serial(serial_port, baud_rate)
self.serial.timeout = read_timeout
def read_line(self):
"""Reads the serial buffer"""
return self.serial.readline()
Rxvalue=AHT_Serial.readline()
FILE HANDLING IN PYTHON
24
Python generally divide files into two categories, text file
and binary file. Text files are simple text where as the
binary files contain binary data which is only readable by
computer.
File opening
To open a file we use open() function. It requires two
arguments, first the file path or file name, second which
mode it should open. Modes are like
“r” -> open read only,
“w” -> open with write power, means if the file exists
then delete all content and open it to write
“a” -> open in append mode
LOG FILE GENERATION CODE
AUTOMATED HARDWARE TESTING
25
class fileHand(object):
tMess=""
curTime=[]
def fileWrite(self,varlnk):
lp=0
tMess=""
varlnk=list(varlnk)
selfvarcall=fileHand()
tm=selfvarcall.write_dummy()
for lp in varlnk:
print(lp)
tMess+=time.ctime()+" >> "+ "Voltage test{}n".format(lp)
fileOpen = open('LogfileV1.2.txt','w',encoding='utf-8',errors='ignore')
fileOpen.write("########## AHT LOG FILE ############"'n')
fileOpen.close()
return 'writed'
TEST RESULT REPORT
AUTOMATED HARDWARE TESTING
26
############################ AHT LOG FILE ############################
Wed Apr 27 10:16:52 2016 >> Testing Started....
Wed Apr 27 10:16:52 2016 >> Tester Initialization done..
Wed Apr 27 10:16:52 2016 >> TH Version 1.0
Wed Apr 27 10:16:52 2016 >> Test Sequence Started -> || PS UNIT || I2C Protocols ||
Wed Apr 27 10:16:52 2016 >> Test Case Loaded Successfully
##########################################################################
Wed Apr 27 10:16:52 2016 >> Voltage test 3.3V => 3.25V =>Pass
Wed Apr 27 10:16:53 2016 >> Voltage test 5v => 4.85V =>Pass
Wed Apr 27 10:16:53 2016 >> Resistance test 3.3V => 120E =>Pass
Wed Apr 27 10:16:54 2016 >> Resistance test 5V => 0E =>Fail
Wed Apr 27 10:16:54 2016 >> Current Test 3.3V => .55A =>Pass
Wed Apr 27 10:16:55 2016 >> Current Test 5V => .85A =>Pass
Wed Apr 27 10:16:56 2016 >> I2C Test Device Found=> 0x30,0x48,0x54 =>Pass
Wed Apr 27 10:16:56 2016 >> RTC INC Test => - =>Pass
Wed Apr 27 10:16:57 2016 >> Temp Test =>29.1c =>Pass
Wed Apr 27 10:16:58 2016 >> EEPROM Test => - =>Pass
Wed Apr 27 10:16:58 2016 >> RS232 Test => ABCD =>Pass
Wed Apr 27 10:16:58 2016 >> RS422- RS485 => ABCD =>Pass
###########################################################################
Wed Apr 27 10:16:59 2016 >> Test Sequence Stopped >>FAIL
ADVANTAGES
27
Boards, components and interface cable separately
tested in modes of test case.
Manual testing has been reduced
Locating the Hardware(components) and software
bugs using test reports.
Low Cost (Pursuing software’s are Open source)
Reduced human efforts
DISADVANTAGES
28
Embedded controllers are single task at a instant.
So measuring data goes to the pc with delay. Output
data packets compared with test case help of
Python Script. So report generating time taken
more.
29
Automatic hardware testing using Python is a ATE
technique to increase throughput without a
corresponding increase in cost, by performing tests on
protocols are handling and test without error. It has been
quantitatively to reduce test cost more effectively than
low-cost ATE. Because it reduces all test cost
contributors, and not only capital cost of ATE.
 In this paper, we described the AHT using python
strategy adopted for hardware testing and protocols
testing without measuring instruments .
CONCULSION
FUTURE ENHANCEMENT
30
In this project in future we can add a FPGA or CPLD
used to get the data packets at instant of time
without delay.
Parallel Testing method introduces to test the
multiple boards at same instant time.
BASE PAPERS
31
 [1] Jambunatha, K .,Design and implement Automated Procedure to upgrade remote
network devices using Python, Advance Computing Conference (IACC), 2015 IEEE
International, Bangalore, June 2015.
 [2] H.J. Zainzinger and S.A. Austria, "Testing embedded systems by using C++ script
interpreter," in Proceedings of the 11 th Asian Test Symposium(ATS’02), 2002, pp.380 –
385
 [3] Kovacevic, M.; Kovacevic, B.; Pekovic, V.; Stefanovic, D., Framework for automatic
testing of Set-top boxes., Telecommunications Forum Telfor (TELFOR), 22ndYear: 2014
 [4] Karmore, S.P.; Mabajan, A.R., Universal methodology for embedded system testing.,
Computer Science & Education (ICCSE), 2013 8th International Conference on Year:
2013,IEEE Conference Publications, 26-28 April 2013
 [5] Kim H. Pries, Jon M. Quigley-Testing Complex and Embedded Systems-CRC Press
(2010)
 [6] Python software Foundation https://www.python.org/
INTERNATIONAL CONFERENCE
CERTIFICATE
AUTOMATED HARDWARE TESTING
32
THANK YOU
33

AUTOMATED TESTING USING PYTHON (ATE)

  • 1.
    1 YUVARAJA.R - M.TECHEMBEDDED SYSTEMS TECHNOLOGIES REG NO - 13PEES1005 PROJECT INCHARGE - K.Bhaskar.,B.Tech.,M.E.(Ph.D) COLLEGE - VEL TECH Dr.RR & Dr.SR TECHNICAL UNIVERSITY AUTOMATED HARDWARE TESTING USING PYTHON
  • 2.
    ABSTRACT 2 Design a EmbeddedPrototype test hardware interact with Python software shows presence of defects in UUT. Python test script can download the test cases to the target system one by one, receive test output, compare with specifications then verify it, and generate log files. Log files inside test steps results are stored as PASS/FAIL. It’s a cost effective test system for SS Electronic hardware manufacturers
  • 3.
    TESTING 3 Testing is anorganized process to verify the behavior, performance, and reliability of a device It ensures a device or system to be as defect-free as possible Testing is a manufacturing step to ensure that the manufactured device is defect free. Manual Testing Automated Testing
  • 4.
    Manual & AutomatedTesting 4 Testing is carried out manually by test engineers. Consuming a lot of time and effort huge for spending the time for manual testing. Automated test equipment need a special fixture to place the board and test the device using instruments
  • 5.
    EXISTING SYSTEM 5 Testing iscarried out manually by test engineers. Consuming a lot of time and effort huge for spending the time for testing. NI Lab View designing a ATE .But measurements are taken by reputed instruments or NI PXI only PXI HW and its software is huge amount. Certified engineer only able to access the software Add-on software needed for Test case and Report generation .
  • 6.
    PROPOSED SYSTEM 6  Toovercome the existing problem, we construct Embedded hardware test module to measure the  Resistance test applied to signal traces (short/open)  Voltage /current measure with help of analog pins.  IO pins used to trigger the on/off or control the hw.  Protocols testing are done by the test hardware. Tested data packets serially communicated to the Python scripts  Python scripts collect the complied data's then compare with test case input and generate the test reports..
  • 7.
    PROJECT – ENTIRESYSTEM 7 SERIAL INTERFACE
  • 8.
    EMBEDDED TEST HWDESIGN 8 Atmega 8-bit AVR controller used for Embedded Test Hardware system. Necessity to test the every protocols chips, Analog and Digital IC. Current, Voltage and Resistance measurements using 10bit ADC I2C >> | RTC | EEPROM | SENSORS | DEVICES | UART >> RS232 << RS485 >> 75176-IC << RS422 >> 75176 TX+ ->>75176 RX+ -<<
  • 9.
    PYTHON 9 Python is aclear and powerful object-oriented programming language, comparable to Perl, Tcl and Java. It’s a FOSS Programming language. Runs on many different computers and operating systems: Windows, MacOS, many brands of Unix, OS/2 Python Code can be grouped into modules and packages
  • 10.
    HW DESIGN –VOLTAGE ,CURRENT & RESISTANCE MEASUREMENT 10 Voltage measured by using AVR Controller 10bit ADC . Constant current probing to the voltage net through voltage divider circuit. Impedance measured by the ADC. Current measurement taken by ACS712 Current sensor IC.
  • 11.
    CURRENT MEASURMENT USINGACS712 AUTOMATED HARDWARE TESTING 11 Hall-effect sensor ICs (especially the ratio metric linear types) are superb devices for 'open-loop' current-sensing designs
  • 12.
    HW DESIGN –PROTOCOLS TESTING-I2C 12 I2C (Inter-Integrated Circuit, pronounced "I squared C") is also a synchronous protocol.I2C uses only 2 wires, one for the clock (SCL) and one for the data (SDA). That means that master and slave send data over the same wire, again controlled by the master.
  • 13.
    I2C PROTOCOLS TESTING–SCANNER METHOD AUTOMATED HARDWARE TESTING 13 Sequence of 7-bit address send to the slave device . Wire.beginTransmission(address); ack = Wire.endTransmission(); ACK=‘0’ device found. >I2C Device found at adress 0x48,0x57,0x67 >[3 device found ]
  • 14.
    HW DESIGN –PROTOCOLS TESTING- UART / RS232 SERIAL 14  Serial communication is the process of sending data one bit one by one sequentially, over a communication channel. UART communication of Full duplex TX and RX communication through the COM devices.
  • 15.
    HW DESIGN –PROTOCOLS TESTING – RS422 15  The RS422 Standard defines a serial communications standard. RS422 is a high speed and long distance data transmission. Each signal is carried by a pair of wires and is thus a differential data transmission system.
  • 16.
    HW DESIGN –PROTOCOLS TESTING – RS485 16  RS-485 is a superset of RS-422; thus, all RS-422 devices may be controlled by RS-485. RS-485 hardware may be used for serial communication with up to 4000 feet of cable. The main difference is that up to 32 transmitter receiver pairs may be present on the line at one time. RS485 Differential communication A <-> B Signal lines.
  • 17.
    SOFTWARE DESIGN -PYTHON AUTOMATED HARDWARE TESTING 17 An open source software used to Automate the Hardware Testing UNITTEST module supports test automation, sharing of setup and shutdown code for tests, aggregation of tests into collections, and independence of the tests from the reporting framework. PySerial module supports serial communication between device to pc data transmission. File handling function used to generate the log file report.
  • 18.
    UNIT TEST MODULECONCEPTS AUTOMATED HARDWARE TESTING 18  Test Fixture : It represents the preparation needed to perform one or more tests, and any associate cleanup actions. This may involve, for example, creating temporary or proxy databases, directories, or starting a server process.  Test Case: is the smallest unit of testing. It checks for a specific response to a particular set of inputs. Unit test provides a base class, Test Case which may be used to create new test cases.  Test Suite: Test suite is a collection of test cases, test suites, or both. It is used to aggregate tests that should be executed together.
  • 19.
    REQUIREMENTS & TESTCASE RELATIONSHIP AUTOMATED HARDWARE TESTING 19
  • 20.
    UUT CODE SAMPLE AUTOMATEDHARDWARE TESTING 20 Def ScaledInput(data): rc = NO_ERR scaled_data = data if data >= DATA_MIN and data <= DATA_MAX: scaled_data = (data * data_scale) + data_offset if scaled_data > SCALE_MAX: scaled_data = SCALE_MAX rc = ERR_MAXSCALE elif scaled_data < SCALE_MIN: scaled_data = SCALE_MIN rc = ERR_MINSCALE else: rc = ERR_OVER return (rc, scaled_data) Function code getting one input argument Function Returning two o/p values
  • 21.
    Function with argumentcode table AUTOMATED HARDWARE TESTING 21 A unit test is constructed such that all possible inputs are used to force the execution to traverse all possible paths. In the case of ScaledInput(), we can see that there are three obvious input test cases. Too low, Too high, Within range.
  • 22.
    PYSERIAL MODULE AUTOMATED HARDWARETESTING 22 This module encapsulates the access for the serial port. The module named “serial” automatically selects the appropriate backend Same class based interface on all supported platforms. Access to the port settings through Python properties. Support for different byte sizes, stop bits, parity and flow control with RTS/CTS and/or Xon/Xoff. Working with or without receive timeout.
  • 23.
    PY SERIAL COMPORT CODE AUTOMATED HARDWARE TESTING 23 class AHT_Serial(object): def __init__(self, serial_port='COM3', baud_rate=9600,read_timeout=5): self.serial = serial.Serial(serial_port, baud_rate) self.serial.timeout = read_timeout def read_line(self): """Reads the serial buffer""" return self.serial.readline() Rxvalue=AHT_Serial.readline()
  • 24.
    FILE HANDLING INPYTHON 24 Python generally divide files into two categories, text file and binary file. Text files are simple text where as the binary files contain binary data which is only readable by computer. File opening To open a file we use open() function. It requires two arguments, first the file path or file name, second which mode it should open. Modes are like “r” -> open read only, “w” -> open with write power, means if the file exists then delete all content and open it to write “a” -> open in append mode
  • 25.
    LOG FILE GENERATIONCODE AUTOMATED HARDWARE TESTING 25 class fileHand(object): tMess="" curTime=[] def fileWrite(self,varlnk): lp=0 tMess="" varlnk=list(varlnk) selfvarcall=fileHand() tm=selfvarcall.write_dummy() for lp in varlnk: print(lp) tMess+=time.ctime()+" >> "+ "Voltage test{}n".format(lp) fileOpen = open('LogfileV1.2.txt','w',encoding='utf-8',errors='ignore') fileOpen.write("########## AHT LOG FILE ############"'n') fileOpen.close() return 'writed'
  • 26.
    TEST RESULT REPORT AUTOMATEDHARDWARE TESTING 26 ############################ AHT LOG FILE ############################ Wed Apr 27 10:16:52 2016 >> Testing Started.... Wed Apr 27 10:16:52 2016 >> Tester Initialization done.. Wed Apr 27 10:16:52 2016 >> TH Version 1.0 Wed Apr 27 10:16:52 2016 >> Test Sequence Started -> || PS UNIT || I2C Protocols || Wed Apr 27 10:16:52 2016 >> Test Case Loaded Successfully ########################################################################## Wed Apr 27 10:16:52 2016 >> Voltage test 3.3V => 3.25V =>Pass Wed Apr 27 10:16:53 2016 >> Voltage test 5v => 4.85V =>Pass Wed Apr 27 10:16:53 2016 >> Resistance test 3.3V => 120E =>Pass Wed Apr 27 10:16:54 2016 >> Resistance test 5V => 0E =>Fail Wed Apr 27 10:16:54 2016 >> Current Test 3.3V => .55A =>Pass Wed Apr 27 10:16:55 2016 >> Current Test 5V => .85A =>Pass Wed Apr 27 10:16:56 2016 >> I2C Test Device Found=> 0x30,0x48,0x54 =>Pass Wed Apr 27 10:16:56 2016 >> RTC INC Test => - =>Pass Wed Apr 27 10:16:57 2016 >> Temp Test =>29.1c =>Pass Wed Apr 27 10:16:58 2016 >> EEPROM Test => - =>Pass Wed Apr 27 10:16:58 2016 >> RS232 Test => ABCD =>Pass Wed Apr 27 10:16:58 2016 >> RS422- RS485 => ABCD =>Pass ########################################################################### Wed Apr 27 10:16:59 2016 >> Test Sequence Stopped >>FAIL
  • 27.
    ADVANTAGES 27 Boards, components andinterface cable separately tested in modes of test case. Manual testing has been reduced Locating the Hardware(components) and software bugs using test reports. Low Cost (Pursuing software’s are Open source) Reduced human efforts
  • 28.
    DISADVANTAGES 28 Embedded controllers aresingle task at a instant. So measuring data goes to the pc with delay. Output data packets compared with test case help of Python Script. So report generating time taken more.
  • 29.
    29 Automatic hardware testingusing Python is a ATE technique to increase throughput without a corresponding increase in cost, by performing tests on protocols are handling and test without error. It has been quantitatively to reduce test cost more effectively than low-cost ATE. Because it reduces all test cost contributors, and not only capital cost of ATE.  In this paper, we described the AHT using python strategy adopted for hardware testing and protocols testing without measuring instruments . CONCULSION
  • 30.
    FUTURE ENHANCEMENT 30 In thisproject in future we can add a FPGA or CPLD used to get the data packets at instant of time without delay. Parallel Testing method introduces to test the multiple boards at same instant time.
  • 31.
    BASE PAPERS 31  [1]Jambunatha, K .,Design and implement Automated Procedure to upgrade remote network devices using Python, Advance Computing Conference (IACC), 2015 IEEE International, Bangalore, June 2015.  [2] H.J. Zainzinger and S.A. Austria, "Testing embedded systems by using C++ script interpreter," in Proceedings of the 11 th Asian Test Symposium(ATS’02), 2002, pp.380 – 385  [3] Kovacevic, M.; Kovacevic, B.; Pekovic, V.; Stefanovic, D., Framework for automatic testing of Set-top boxes., Telecommunications Forum Telfor (TELFOR), 22ndYear: 2014  [4] Karmore, S.P.; Mabajan, A.R., Universal methodology for embedded system testing., Computer Science & Education (ICCSE), 2013 8th International Conference on Year: 2013,IEEE Conference Publications, 26-28 April 2013  [5] Kim H. Pries, Jon M. Quigley-Testing Complex and Embedded Systems-CRC Press (2010)  [6] Python software Foundation https://www.python.org/
  • 32.
  • 33.