This document discusses automated testing of hardware using Python test frameworks. It describes using test frameworks to design broad hardware tests from specifications, control external equipment, and handle test data analysis. As an example, it outlines a phase alignment test between multiple instruments, including setting up the test with a waveform generator, running a sequence of configurations, and calculating the discrete Fourier transform of the results to check for phase differences within a tolerance. The goal is to validate and verify hardware using an automated and flexible test framework approach.
Automated hardware testing system using Python. The system includes an embedded test hardware module that can measure voltage, current, resistance and test protocols. Python scripts control the hardware, run test cases, collect results and generate reports. This provides a low-cost automated solution compared to expensive automated test equipment. Test reports show pass/fail results and help locate hardware and software issues.
This document provides an introduction to unit testing in Python and the Pytest framework. It discusses writing unit test code using the unittest framework and Pytest, how to test functions and handle failures. It also covers features of Pytest like skipping and expected failures, fixture setup/teardown, and distributed testing using the xdist plugin.
This document provides an overview and examples of using the Pytest testing framework. Some key points:
- Pytest allows writing tests in plain Python functions, with test discovery and running. It supports fixtures for dependency injection and parametrizing tests.
- Basic usage involves writing test functions prefixed with "test_" and running pytest to discover and execute them. Fixtures provide a way to inject dependencies into tests.
- Fixtures can be defined and applied at various scopes (function, class, module). They support dependency injection, parameterization, setup/teardown functionality.
- Pytest offers many options for running tests selectively, debugging failures, tracing execution, and extending functionality through plugins. It aims to make
This is continuation of the slide Advanced C part 1. In part 1 you learnt about fundamentals of C - How to build an algorithm, operators. In this module - Advanced C part 2 you will be learning about functions, pointers and standard Input Output functions. This slide will help you to move a further ahead in Advanced C and gain deeper knowledge on it.
This document provides an introduction to FreeRTOS version 6.0.5. It outlines the course objectives, which are to understand FreeRTOS services and APIs, experience different FreeRTOS features through labs, and understand the FreeRTOS porting process. The document describes key FreeRTOS concepts like tasks, task states, priorities, and provides an overview of task management APIs for creation, deletion, delaying, and querying tasks.
Automated hardware testing system using Python. The system includes an embedded test hardware module that can measure voltage, current, resistance and test protocols. Python scripts control the hardware, run test cases, collect results and generate reports. This provides a low-cost automated solution compared to expensive automated test equipment. Test reports show pass/fail results and help locate hardware and software issues.
This document provides an introduction to unit testing in Python and the Pytest framework. It discusses writing unit test code using the unittest framework and Pytest, how to test functions and handle failures. It also covers features of Pytest like skipping and expected failures, fixture setup/teardown, and distributed testing using the xdist plugin.
This document provides an overview and examples of using the Pytest testing framework. Some key points:
- Pytest allows writing tests in plain Python functions, with test discovery and running. It supports fixtures for dependency injection and parametrizing tests.
- Basic usage involves writing test functions prefixed with "test_" and running pytest to discover and execute them. Fixtures provide a way to inject dependencies into tests.
- Fixtures can be defined and applied at various scopes (function, class, module). They support dependency injection, parameterization, setup/teardown functionality.
- Pytest offers many options for running tests selectively, debugging failures, tracing execution, and extending functionality through plugins. It aims to make
This is continuation of the slide Advanced C part 1. In part 1 you learnt about fundamentals of C - How to build an algorithm, operators. In this module - Advanced C part 2 you will be learning about functions, pointers and standard Input Output functions. This slide will help you to move a further ahead in Advanced C and gain deeper knowledge on it.
This document provides an introduction to FreeRTOS version 6.0.5. It outlines the course objectives, which are to understand FreeRTOS services and APIs, experience different FreeRTOS features through labs, and understand the FreeRTOS porting process. The document describes key FreeRTOS concepts like tasks, task states, priorities, and provides an overview of task management APIs for creation, deletion, delaying, and querying tasks.
Effective testing with Pytest focuses on using Pytest to its full potential. Key aspects include using fixtures like monkeypatch and mocker to control dependencies, libraries like factoryboy and faker to generate test data, and freezegun to control time. Tests should be fast, readable, and maintainable by applying best practices for organization, parametrization, markers, and comparing results in an effective manner.
1) Base types in Python include integers, floats, booleans, strings, bytes, lists, tuples, dictionaries, sets, and None. These types support various operations like indexing, slicing, membership testing, and type conversions.
2) Common loop statements in Python are for loops and while loops. For loops iterate over sequences, while loops repeat as long as a condition is true. Loop control statements like break, continue, and else can be used to control loop execution.
3) Functions are defined using the def keyword and can take parameters and return values. Functions allow for code reusability and organization. Built-in functions operate on containers to provide functionality like sorting, summing, and converting between types.
This document discusses unit testing in Python. It explains that unit tests should be written before code to automatically test inputs and outputs. The code is then written to pass the tests. Tests are implemented by creating test classes that inherit from unittest.TestCase and adding test methods with assert statements. The document provides an example test and steps for creating unit tests, including importing unittest and the code to test.
Software Development Best Practices: Separating UI from Business LogicICS
One of the most effective software engineering approaches involves separating the user interface (frontend) from the business logic (backend), especially when it comes to developing embedded-devices. This practice makes it far easier to code for a single specific functionality versus coding an overall product.
In this webinar we’ll explain not only what’s involved in separating the UI from business logic in your next Qt project, but explore some of the key benefits of this approach, including:
Parallel development
Modularity
Enhanced testability
Accelerated development
Architecture that easily accommodates future changes
We’ll also touch on a few of the drawbacks, chief among them the need to implement new strategies for independent testing, build and deployment — tasks that take extra time and resources
An unique module combining various previous modules you have learnt by combing Linux administration, Hardware knowledge, Linux as OS, C/Computer programming areas. This is a complete module on Embedded OS, as of now no books are written on this with such practical aspects. Here is a consolidated material to get real hands-on perspective about building custom Embedded Linux distribution in ARM.
Test-driven development (TDD) is an iterative process where tests are written before code to validate requirements. It follows the "red-green-refactor" cycle: write a failing test, write code to pass the test, refactor code. The document demonstrates TDD with a palindrome checker function, writing multiple tests to handle different cases before refactoring the code. Unit testing frameworks like unittest, py.test, and nose make TDD easier by automating test discovery and providing features like parallel testing and code coverage reports. Nose is currently the most popular alternative to unittest for Python projects.
This document provides an overview of QEMU, including its use of dynamic translation and Tiny Code Generator (TCG) to emulate target CPUs on the host system. It discusses how QEMU translates target instructions into a RISC-like intermediate representation (TCG ops), optimizes and converts them to host instructions. The document also mentions Linaro's work with QEMU and a QEMU monitor tool for debugging ARM systems emulated by QEMU.
The document discusses process management in Linux, including scheduling, context switching, and real-time systems. It defines process scheduling as determining which ready process moves to the running state, with the goal of keeping the CPU busy and minimizing response times. Context switching is described as storing the state of a process when it stops running so the CPU can restore another process's state when it starts running. CPU scheduling decisions occur when a process changes state, such as from running to waiting. Real-time systems must meet strict deadlines, and the document discusses soft and hard real-time systems as well as differences between general purpose, real-time, and embedded operating systems.
This document provides an introduction and overview of queue management in FreeRTOS. It describes the different types of queue APIs for creation, deletion, sending messages, receiving messages, checking queue status, and more. It also distinguishes between regular and ISR-safe queue APIs, and notes there are alternative queue implementations. The document is presented as a course on FreeRTOS with multiple labs, including one focused on queue management.
This document provides an overview of SYCL and Khronos. It announces the release of SYCL 2020 and describes its key features and industry momentum. SYCL is an open standard for parallel programming in C++ that provides performance portability across diverse hardware. The document discusses SYCL implementations, applications in HPC, embedded systems, and how SYCL fits in the broader Khronos standards landscape.
Let's turn the table. Suppose your goal is to deliberately create buggy programs in C and C++ with serious security vulnerabilities that can be "easily" exploited. Then you need to know about things like stack smashing, shellcode, arc injection, return-oriented programming. You also need to know about annoying protection mechanisms such as address space layout randomization, stack canaries, data execution prevention, and more. These slides will teach you the basics of how to deliberately write insecure programs in C and C++.
A PDF version of the slides can be downloaded from my homepage: http://olvemaudal.com/talks
Here is a video recording of me presenting these slides at NDC 2014: http://vimeo.com/channels/ndc2014/97505677
Enjoy!
This document provides an introduction to Linux, including definitions of open source software and its advantages. It discusses the Linux system overview consisting of the kernel, OS services, and applications. It also covers Linux usage basics such as directories, shells, files, users, permissions, and input/output redirection. The document is intended to explain what topics will be covered in an introduction to Linux workshop.
1. Qt is a cross-platform application development framework written in C++ that allows developers to write once and deploy applications across desktop and mobile platforms like Windows, Mac, Linux and embedded systems.
2. Qt provides modules for user interfaces, databases, networking, multimedia and more that have a common API design. It extends C++ with macros and introspection.
3. The presentation demonstrated a simple "Hello World" Qt application and introduced Qt Creator as the IDE for Qt development. It also covered signals and slots, stylesheets, deployment and the Qt Mobility APIs for mobile.
Basic Python Programming: Part 01 and Part 02Fariz Darari
This document discusses basic Python programming concepts including strings, functions, conditionals, loops, imports and recursion. It begins with examples of printing strings, taking user input, and calculating areas of shapes. It then covers variables and data types, operators, conditional statements, loops, functions, imports, strings, and recursion. Examples are provided throughout to demonstrate each concept.
The document discusses three sanitizers - AddressSanitizer, ThreadSanitizer, and MemorySanitizer - that detect bugs in C/C++ programs. AddressSanitizer detects memory errors like buffer overflows and use-after-frees. ThreadSanitizer finds data races between threads. MemorySanitizer identifies uses of uninitialized memory. The sanitizers work by instrumenting code at compile-time and providing a run-time library for error detection and reporting. They have found thousands of bugs in major software projects with reasonable overhead. Future work includes supporting more platforms and detecting additional classes of bugs.
Python Environment Setup and Essentials modified.pptxAnup Kelkar
Python is a clear and powerful object-oriented programming language that is easy to test code snippets interactively. It supports basic data types like numbers, strings, lists, and dictionaries. Python can be installed on Windows by downloading from python.org or is pre-installed on Linux. Python scripts are run by saving files with a .py extension and running them using the shell on Windows or terminal on Linux. Python uses control statements like if/else, for and while loops, and break and continue statements.
This document discusses using Python for test automation. It introduces the author as a senior developer in test automation using Python. The document outlines topics to be covered, including testing, automation, different Python modules for test automation, and demos. It promotes Python for test automation due to its ease of use, readability, cross-platform capabilities, large community and support libraries.
Effective testing with Pytest focuses on using Pytest to its full potential. Key aspects include using fixtures like monkeypatch and mocker to control dependencies, libraries like factoryboy and faker to generate test data, and freezegun to control time. Tests should be fast, readable, and maintainable by applying best practices for organization, parametrization, markers, and comparing results in an effective manner.
1) Base types in Python include integers, floats, booleans, strings, bytes, lists, tuples, dictionaries, sets, and None. These types support various operations like indexing, slicing, membership testing, and type conversions.
2) Common loop statements in Python are for loops and while loops. For loops iterate over sequences, while loops repeat as long as a condition is true. Loop control statements like break, continue, and else can be used to control loop execution.
3) Functions are defined using the def keyword and can take parameters and return values. Functions allow for code reusability and organization. Built-in functions operate on containers to provide functionality like sorting, summing, and converting between types.
This document discusses unit testing in Python. It explains that unit tests should be written before code to automatically test inputs and outputs. The code is then written to pass the tests. Tests are implemented by creating test classes that inherit from unittest.TestCase and adding test methods with assert statements. The document provides an example test and steps for creating unit tests, including importing unittest and the code to test.
Software Development Best Practices: Separating UI from Business LogicICS
One of the most effective software engineering approaches involves separating the user interface (frontend) from the business logic (backend), especially when it comes to developing embedded-devices. This practice makes it far easier to code for a single specific functionality versus coding an overall product.
In this webinar we’ll explain not only what’s involved in separating the UI from business logic in your next Qt project, but explore some of the key benefits of this approach, including:
Parallel development
Modularity
Enhanced testability
Accelerated development
Architecture that easily accommodates future changes
We’ll also touch on a few of the drawbacks, chief among them the need to implement new strategies for independent testing, build and deployment — tasks that take extra time and resources
An unique module combining various previous modules you have learnt by combing Linux administration, Hardware knowledge, Linux as OS, C/Computer programming areas. This is a complete module on Embedded OS, as of now no books are written on this with such practical aspects. Here is a consolidated material to get real hands-on perspective about building custom Embedded Linux distribution in ARM.
Test-driven development (TDD) is an iterative process where tests are written before code to validate requirements. It follows the "red-green-refactor" cycle: write a failing test, write code to pass the test, refactor code. The document demonstrates TDD with a palindrome checker function, writing multiple tests to handle different cases before refactoring the code. Unit testing frameworks like unittest, py.test, and nose make TDD easier by automating test discovery and providing features like parallel testing and code coverage reports. Nose is currently the most popular alternative to unittest for Python projects.
This document provides an overview of QEMU, including its use of dynamic translation and Tiny Code Generator (TCG) to emulate target CPUs on the host system. It discusses how QEMU translates target instructions into a RISC-like intermediate representation (TCG ops), optimizes and converts them to host instructions. The document also mentions Linaro's work with QEMU and a QEMU monitor tool for debugging ARM systems emulated by QEMU.
The document discusses process management in Linux, including scheduling, context switching, and real-time systems. It defines process scheduling as determining which ready process moves to the running state, with the goal of keeping the CPU busy and minimizing response times. Context switching is described as storing the state of a process when it stops running so the CPU can restore another process's state when it starts running. CPU scheduling decisions occur when a process changes state, such as from running to waiting. Real-time systems must meet strict deadlines, and the document discusses soft and hard real-time systems as well as differences between general purpose, real-time, and embedded operating systems.
This document provides an introduction and overview of queue management in FreeRTOS. It describes the different types of queue APIs for creation, deletion, sending messages, receiving messages, checking queue status, and more. It also distinguishes between regular and ISR-safe queue APIs, and notes there are alternative queue implementations. The document is presented as a course on FreeRTOS with multiple labs, including one focused on queue management.
This document provides an overview of SYCL and Khronos. It announces the release of SYCL 2020 and describes its key features and industry momentum. SYCL is an open standard for parallel programming in C++ that provides performance portability across diverse hardware. The document discusses SYCL implementations, applications in HPC, embedded systems, and how SYCL fits in the broader Khronos standards landscape.
Let's turn the table. Suppose your goal is to deliberately create buggy programs in C and C++ with serious security vulnerabilities that can be "easily" exploited. Then you need to know about things like stack smashing, shellcode, arc injection, return-oriented programming. You also need to know about annoying protection mechanisms such as address space layout randomization, stack canaries, data execution prevention, and more. These slides will teach you the basics of how to deliberately write insecure programs in C and C++.
A PDF version of the slides can be downloaded from my homepage: http://olvemaudal.com/talks
Here is a video recording of me presenting these slides at NDC 2014: http://vimeo.com/channels/ndc2014/97505677
Enjoy!
This document provides an introduction to Linux, including definitions of open source software and its advantages. It discusses the Linux system overview consisting of the kernel, OS services, and applications. It also covers Linux usage basics such as directories, shells, files, users, permissions, and input/output redirection. The document is intended to explain what topics will be covered in an introduction to Linux workshop.
1. Qt is a cross-platform application development framework written in C++ that allows developers to write once and deploy applications across desktop and mobile platforms like Windows, Mac, Linux and embedded systems.
2. Qt provides modules for user interfaces, databases, networking, multimedia and more that have a common API design. It extends C++ with macros and introspection.
3. The presentation demonstrated a simple "Hello World" Qt application and introduced Qt Creator as the IDE for Qt development. It also covered signals and slots, stylesheets, deployment and the Qt Mobility APIs for mobile.
Basic Python Programming: Part 01 and Part 02Fariz Darari
This document discusses basic Python programming concepts including strings, functions, conditionals, loops, imports and recursion. It begins with examples of printing strings, taking user input, and calculating areas of shapes. It then covers variables and data types, operators, conditional statements, loops, functions, imports, strings, and recursion. Examples are provided throughout to demonstrate each concept.
The document discusses three sanitizers - AddressSanitizer, ThreadSanitizer, and MemorySanitizer - that detect bugs in C/C++ programs. AddressSanitizer detects memory errors like buffer overflows and use-after-frees. ThreadSanitizer finds data races between threads. MemorySanitizer identifies uses of uninitialized memory. The sanitizers work by instrumenting code at compile-time and providing a run-time library for error detection and reporting. They have found thousands of bugs in major software projects with reasonable overhead. Future work includes supporting more platforms and detecting additional classes of bugs.
Python Environment Setup and Essentials modified.pptxAnup Kelkar
Python is a clear and powerful object-oriented programming language that is easy to test code snippets interactively. It supports basic data types like numbers, strings, lists, and dictionaries. Python can be installed on Windows by downloading from python.org or is pre-installed on Linux. Python scripts are run by saving files with a .py extension and running them using the shell on Windows or terminal on Linux. Python uses control statements like if/else, for and while loops, and break and continue statements.
This document discusses using Python for test automation. It introduces the author as a senior developer in test automation using Python. The document outlines topics to be covered, including testing, automation, different Python modules for test automation, and demos. It promotes Python for test automation due to its ease of use, readability, cross-platform capabilities, large community and support libraries.
Automated Regression Testing for Embedded Systems in ActionAANDTech
This presentation shows a real world example of streamlining the software development for a medical device system, using continuous integration, Behavior Driven Development, and even robotics!
These ideas may be applied to any software project, regardless of budget or technologies.
Automated Testing for Embedded Software in C or C++Lars Thorup
This document discusses automated testing for embedded C software. It introduces Lars Thorup and provides an agenda for the document. It then defines automated testing, describes the Unity testing framework for embedded C, and provides an example of how to handle dependencies in testing. It advocates for continuous integration, breaking dependencies through abstraction and injection, and explains how automated testing can improve software quality through faster development and preventing bugs.
This document provides an overview of the Python unittest module for writing and running automated tests. It discusses how the unittest.TestCase class is used to define test classes with methods named "test_" that contain assertions. The unittest module then handles running the tests and provides features like test organization, discovery of test methods, and integration with other tools.
This document discusses test automation strategies for embedded systems. It outlines key points like developing a test automation framework, defining the testing scope and estimating costs. It also describes challenges like accessing information on an embedded device in real-time and handling different device configurations. An example system architecture is shown using custom hardware, FPGA and drivers to test multiple device under test systems and coordinate the test stand farm from a central server.
Разработка фреймворка на Python для автоматизации тестирования STB боксовdelimitry
Презентация для PiterPy #2, рассказывающая об опыте разработки и использования фреймворка на Python для автоматизированного тестирования STB (Set-Top Boxes).
This presentation demonstrates general guidelines how to create good test cases using Robot Framework. Both good practices and anti-patterns are presented.
The presentation is hosted on GitHub where you can find the original in ODP format: https://github.com/robotframework/DosDontsSlides
Robot Framework is a generic test automation framework for keyword-driven testing. It is implemented with Python and runs on Jython and IronPython as well. It supports test data driven development and has built-in support for reporting, logging, libraries, and integration with tools like Jenkins. The framework is open source and has an active community around it.
Framework for Web Automation Testing presentation shows you all the benefits of useage framework constructions in automation tests development for Web project. all the approaches are shown in images.
As most embedded programming is currently performed using C, it is likely that developers will need to transition their code and their working practice to C++. This session proposes a strategy that enables the benefits of C++ to be realized quickly and incrementally.
Softwarequalitätssicherung mit Continuous Integration ToolsGFU Cyrus AG
Kurzbeschreibung
Automatische Softwaretests rücken immer mehr in den Mittelpunkt. Gerade die derzeit vielfach eingesetzten agilen Vorgehensweisen benötigen ein teamübergreifendes und reproduzierbares Verfahren zur Sicherung der Softwarequalität. In diesem Vortrag legt Dirk Weil, Geschäftsführer der GEDOPLAN GmbH aus Bielefeld, das Augenmerk auf die Werkzeuge, die in Java-Projekten zum fortlaufenden Build und Test von Software genutzt werden können. Anhand einiger Praxisbeispiele zeigt er den Aufbau und Betrieb einer Continuous-Integration-Umgebung, die GEDOPALN für Softwareprojekte betreibt. Dozent: Dirk Weil, Gedoplan
Inhalt
- Grundlagen und Motivation automatischer Softwaretests
- Testziele und Verfahren (Unit-Tests, Regressionstests, Akzeptanztests etc.)
- Build- und Testautomatisierung
- Beispielumgebung auf Basis von Ant, Maven, Subversion und Hudson
- Code-Analyse
- Extreme Feedback
SELENIUM COURSE CONTENT:
Course Description
Within fast moving agile software development teams it becomes important to test user interfaces as they are being coded. Automated Testing techniques using Selenium 2 allow for test replay of important features as development progresses. Selenium IDE and Selenium Web Driver are important tools for any tester or developer to use in ensuring software quality and making changes with confidence. This interactive, hands-on workshop provides an understanding and advanced techniques in the use of Selenium 2 with hands on practice. The practice exercises are tailored to various skill levels and type of application being tested, from simple forms to complex web applications.
Objectives:
The class will teach participants to:
Understand trade-offs of automated vs. manual testing.
Record, edit and play back Selenium IDE tests against multiple types of web applications.
Minimize test failure due to normal changes to code.
Understanding of basic Selenium commands to get through common issue with web applications.
Use of Eclipse to run tests individually and as a group to generate test failure reports.
Learn how to help developers understand the importance of making applications more testable to improve usability.
The document discusses different approaches to mock testing in Python including using the Mocker, PostMonkey, and Mock libraries. It provides examples of replacing dependencies with mocks using Mocker, configuring return values on mocks, and patching modules under test using Mock. The goal of mock testing is to isolate units from external dependencies like databases and networks for reliable isolated testing.
Speech presented on "The Development Conference 2016 - São Paulo" about the development of software in C++ for an Embedded Linux system. The presentation goes through a brief introduction of Linux and its history, the power of C++ and the tools for testing and debugging C++ applications on Embedded Linux Operating Systems.
Python Ireland Nov 2010 Talk: Unit TestingPython Ireland
Unit testing for those seeking instant gratification - Maciej Bliziński
Abstract: Unit testing has long term benefits. However, depending on how you use it, it can have short term benefits too. This is an introductory talk, aimed at both beginner and experienced Python programmers who would like to get started testing their code.
Impact Analysis в тестировании
В непрерывном процессе разработки продукта появляются и реализуются различные фичи, дополнительные возможности, мы работаем с меняющимися требованиями заказчика, наш продукт постоянно улучшается и изменяется.
В таких условиях можно столкнуться с неприятной ситуацией, когда становится трудно отследить последствия производимых изменений и модификаций: оценить, какие же части программы могут быть затронуты и насколько сильно.
В итоге: тестирование проведено в соответствии с лучшими практиками, но какая-то часть продукта, какой-то его модуль или функционал может быть упущен из внимания или недостаточно глубоко проверен.
Но изменения в продукте не всегда являются проблемой, если применять методику анализа этих изменений или Импакт Анализ. В ISTQB данная методика трактуется, как часть планомерной работы с рисками.
Этот анализ помогает отслеживать последствия изменений в продукте. Он помогает выяснить, какие части программы могут быть затронуты, и оценить, насколько сильно скажутся эти изменения непосредственно на измененной функциональности, а также на остальном продукте. Все это дает возможность правильно спланировать процесс тестирования и не упустить из вида никакие части тестируемого продукта.
Я хочу рассказать о своем опыте введения и использования "Impact analysis" в ряде проектов нашей компании:
- о причинах введения этого анализа на проектном уровне;
- о том, как именно и в каком виде мы используем IA в своих проектах;
- о некоторых важных особенностях внедрения подобной методики;
- о полученной практической пользе от этого нововведения.
С помощью "Impact analysis" наша компания смогла решить проблемы, с которыми мы сталкивались достаточно длительное время.
Доклад будет полезен специалистам, которые сталкиваются с необходимостью учитывать и анализировать изменения в продукте. Теперь этот процесс станет проще и удобнее.
This document provides an introduction and overview of the NSubstitute mocking framework. It begins with an agenda that covers test doubles, test driven development, and the key features of NSubstitute. The document then discusses creating substitutes, setting return values, argument matchers, checking received calls, raising events, auto and recursive mocking, and advantages over alternatives like Moq and Rhino Mocks. The goal of NSubstitute is to provide a simple and succinct syntax for writing clearer tests.
Unit testing en iOS @ MobileCon GaliciaRobot Media
This document provides an overview of unit testing in iOS and compares the OCUnit and GHUnit testing frameworks. It discusses the benefits of unit testing, common excuses for not doing it, and when it should be implemented. It then describes how to write unit tests using OCUnit, which is the testing framework integrated natively with Xcode, and GHUnit, an open-source alternative. GHUnit provides additional features like a GUI and asynchronous testing support. The document explains how to set up and run tests with both frameworks.
This document contains code for unit testing in Python. It defines a TestFixture class that sets up test data, and includes TestCases that validate functions by asserting expected results. A TestSuite is built by adding TestCases, and a TestRunner executes the suite and outputs results.
The document discusses Bluespec, a hardware description language that combines features of Haskell and SystemVerilog assertions (SVA). Bluespec models all state explicitly using guarded atomic actions on state. Behavior is expressed as rules with guards and actions. Assertions in Bluespec are compiled into finite state machines and checked concurrently as rules. The document provides an example of using Bluespec to write functional and performance assertions for a cache controller design.
Unit testing in iOS featuring OCUnit, GHUnit & OCMockRobot Media
This document provides an overview and introduction to unit testing in iOS. It discusses OCUnit, GHUnit and OCMock, which are common frameworks for unit testing, mock objects, and assertions in Objective-C and iOS. The key points covered include:
- OCUnit is the default unit testing framework for Objective-C, with built-in support in Xcode.
- GHUnit is an alternative open source framework that provides a GUI runner and additional macros.
- OCMock allows mocking objects to control and isolate dependencies in tests.
- Examples are provided of writing tests with OCUnit, GHUnit and using mock objects with OCMock.
- Reasons for unit testing like fixing bugs early and easier
The document describes how to write unit tests in Python using the unittest module. It includes examples of setting up test fixtures, writing test cases that assert conditions, organizing test cases into test suites, and running the test suites with a test runner.
Lost in Translation: When Industrial Protocol Translation goes Wrong [CONFide...Marco Balduzzi
Protocol gateways are embedded devices used in industrial facilities to integrate legacy equipment such as serial PLCs with modern control networks. Given the importance that these devices play in the operation of manufacturing plants, we conducted a vendor agnostic analysis of the technology behind protocol translation, by identifying new unexplored weaknesses and vulnerabilities. We evaluated five popular gateway products and discovered translation problems that enable potential adversaries to conduct stealthy and difficult-to-detect attacks, for example to arbitrarily disable, or enable a targeted machinery by mean of innocent-looking packets that bypass common ICS firewalls. In this presentation, we share the results of our findings and discuss the impact to the problems that we identified and their potential countermeasures.
Python é uma das mais poderosas ferramentas de prototipação e analise de hipóteses. Mas o que muitos não sabem, é que também podemos ter produtos completos em produção totalmente baseados em Python. Ai vem a pergunta, como garantir a qualidade e eficiência do meu projeto em Python ???
Venha descobrir como aplicar e garantir a qualidade dos seus projetos através de testes eficientes, checagem de cobertura de código, analise estática, índice de mantenabilidade dentre outras técnicas.
Aiming at complete code coverage by unit tests tends to be cumbersome, especially for cases where external API calls a part of the code base. For these reasons, Python comes with the unittest.mock library, appearing to be a powerful companion in replacing parts of the system under test.
This document discusses techniques for testing software in difficult environments, including:
1. Refactoring code into testable components and using mocking to replace dependencies that are hard to control, like network connections.
2. Setting up test databases in memory to isolate tests from the production database.
3. Using mocking frameworks to create fake objects, classes, and modules that replace real dependencies and allow tests to run independently.
4. An example shows mocking smtplib to test email sending without actually sending emails.
TDC2018SP | Trilha Go - Processando analise genetica em background com Gotdc-globalcode
The document discusses using Faktory, an open-source job queue written in Go, to process genetic analysis jobs in the background. It describes setting up Faktory, creating jobs that call the vsa dx command, registering a Go worker to process jobs, and integrating it with an API. This allows asynchronously processing many jobs efficiently using a single lightweight machine.
The document discusses various techniques for testing game code, including:
1. Unit testing frameworks like Google Test and mocking objects to isolate dependencies.
2. Database testing using seed data and frameworks like xDBUnit.
3. Resource validation to check for logical errors in game assets.
4. Various approaches for runtime validation, debugging crashes, and analyzing crash dumps. Testing covers areas like databases, AI, and preventing crashes via assertions.
This document discusses Python assertion and unit testing. It provides an example of using assertions to validate the output of a factorial function. Assertions allow checking conditions and halting the program if a condition is false. The document also covers unit testing frameworks in Python like unittest, and describes common concepts like test fixtures, test cases, test suites, and test runners. It provides an example unittest code to test the factorial function with common assertion methods like assertEqual.
This document summarizes an audio noise cancellation project. It outlines the project schedule, methods used including decoding audio files, applying fast Fourier transforms (FFTs) and inverse FFTs (IFFTs), and developing algorithms to filter noise and find suitable noise profiles to subtract. It discusses challenges faced with data types, filter design, and implementing the inverse FFT. The overall goal is to develop techniques to remove noise from audio signals.
Asynchronous programming done right - Node.jsPiotr Pelczar
This document discusses asynchronous programming and avoiding race conditions. It covers how asynchronous actions allow the main program flow to continue processing without blocking on I/O. It also discusses how asynchronous programming works with callbacks and promises rather than sequential execution. It provides examples of using libraries like Async to control asynchronous flows and common pitfalls to avoid like double callbacks and unexpected asynchronous behavior.
Unit tests validate that individual code units perform as expected. This document discusses unit testing tools in Python like the unittest framework and mocks. Mocks replace real dependencies during testing to isolate the code under test. The unittest.mock module can create mock objects that verify calls and behavior without relying on real dependencies. Mocks allow focusing tests on the code itself rather than external factors.
This document discusses property-based testing with ScalaCheck. It provides an overview of ScalaCheck features like generators, properties, labels, and integration with testing frameworks. Key points include:
- ScalaCheck allows writing tests as properties to be checked against a wide range of random inputs rather than specific test cases. This can find more bugs.
- Generators like Gen.choose, Gen.const, and Gen.listOf are used to randomly generate test input data. Users can also define their own generators.
- Properties are checked using Prop.forAll and predicates on the generated inputs. Labels help identify failures.
- ScalaCheck supports integration with ScalaTest and Specs2 and provides
The document discusses performance testing and summarizes that:
1. Performance tests should closely simulate production environments including hardware, software, load, and isolation.
2. Extensive monitoring, logging, and profiling data should be collected to identify bottlenecks based on data rather than intuition.
3. Performance testing can be misleading without sufficient data due to issues like coordinated omission, so tools like Gatling and WRK2 that avoid this problem are recommended.
The document describes how to port and modify drivers for UART, Ethernet, LCD, and keypad on a Mango100 board running Android. It provides instructions on configuring the kernel, modifying driver source code files, and checking that the drivers are functioning properly. Key steps include enabling drivers in the kernel .config file, adding device registration code, and modifying functions to set GPIO pins and timing parameters for devices like the LCD. It also explains how to view input events in logcat and trace the flow of key events through the Android framework.
Similar to Automated Python Test Frameworks for Hardware Verification and Validation (20)
10. Test Framework Requirements
Easily design broad
tests from spec def module_test_1(suite, cl, slave_cls):
def verify(result, success, args):
if not success:
Control external return False
if result[-1] != args:
equipment return False
return True
Easy math handling
arg1 = 0.1
arg2 = 0.2
calls = [Call(cl.InstrumentSpecific.ThisIsAMethod, arg1, arg2),
Set(cl.InstrumentSpecific, "ThisIsAProperty", arg1),
Get(cl.InstrumentSpecific, "ThisIsAProperty")]
suite.add(calls, verify, arg1)
def add(suite, cl, slave_cls):
module_test_1(suite, cl, slave_cls)
11. Designing tests based on hardware specs
Phase alignment on multiple instruments must be
within 0.000010 arc seconds
Discrete Fourier Transform
Amplitude
Phase
17. Setup & Verify
def add_phase_test(suite, cl, slave_cls, wavegen):
# Constant parameters
PI = 4*atan(1)
if suite.test_level == test.FULL_TEST:
NUM_INNER_LOOPS = 2000 # approximately 13 hours with two devices
else:
NUM_INNER_LOOPS = 10 # approximately 4 minutes with 2 devices
def verify(result, success, args):
# Since the actual data analysis was performed in analyze_data,
# we only need to check the function call returns to determine
# overall success/failure.
for call_result in result:
if call_result == False:
return False
return success
# set up the waveform generator
# Sine wave at 10Hz, 1V peak (2V peak-to-peak), no offset
calls = [Call(wavegen.reset),
Call(wavegen.set_highimpedance_mode),
Call(wavegen.sine(INPUT_FREQ, INPUT_AMPLITUDE, 0)]
suite.add(calls)
for config_name in config_sequence
18. Test Sequence
for config_name in config_sequence:
calls = []
# Configure the master & slave devices
calls += configure_device(cl)
calls += configure_device_trigger(cl, configs[config_name]['master'])
for slave_cl in slave_cls:
calls += configure_device(slave_cl)
calls += configure_device_trigger(slave_cl, configs[config_name]['slave'])
suite.add(calls, verify, None)
for inner_loop in range(0, NUM_INNER_LOOPS):
calls = []
# Instruct the master device to issue a sync pulse
calls += [Call(cl.soft_sync)]
# Start acquiring data on each slave device
for slave_cl in slave_cls:
calls += [Call(slave_cl.trig_init)]
# Start acquiring data on the master device
calls += [Call(cl.trig_init)]
# Issue a soft trigger command to the master device
calls += [Call(cl.soft_trig)]
# Read the data
calls += [Call(analyze_data, cl, slave_cls, config_name)]
suite.add(calls, verify, None)
# Reset the slave devices & the master device
calls = []
for slave_cl in slave_cls:
calls += [Call(slave_cl.reset)]
calls += [Call(cl.reset)]
suite.add(calls, verify, None)
19. DFT Calculation
N = len(device_result.datapages)
n = INPUT_FREQ * N / SAMP_FREQ
val_dft_real = val_dft_imag = 0.0
k = 0
for page in device_result.datapages:
val_dft_real += page.dataset[board][0].data[0] * cos(2*PI*n*k/N)
val_dft_imag -= page.dataset[board][0].data[0] * sin(2*PI*n*k/N)
k += 1
val_magnitude = sqrt(pow(val_dft_imag, 2) + pow(val_dft_real, 2))/N
val_phase = atan2(val_dft_imag , val_dft_real)
Fatigue TestSimulates flight service lifeOver 4000 channels totalOverall test to run for 165000 cyclesAverage cycle takes about 5 minutes (this includes pressurization and de-pressurization)Expected to take almost 3 years of continuous testing
TODO: Pass around strain gauge & TCs for visual aidBefore I get started, I’m going to give some definitions since I’m pretty most of you aren’t familiar with the test & measurement industry.Strain gauge – A sensor for measuring the strain of an object. basically a wire (foil) looped into a pattern of parallel lines and attached to an object. As the object is deformed or bent, the strain gauge is deformed and its resistance changes. (stretching causes higher resistance, compression reduces resistance) (Excitation voltage is applied, voltage is read from the output leads, eqn to convert to strain.)Thermocouple – A sensor consisting of two different types of wire which works a lot like a thermostat – it produces a voltage that’s proportional to the temperature difference between the two ends. The voltage change is mostly linear (within a certain range), but more precise measurements require approximation with a polynomial (up to 13 terms, coefficients depend on the metals in the TC & can get nasty). There are several different types using different metals for range and accuracy. Type K is common & cheap, range -200 to 1350 C.Channel – one input (one sensor).Sample rate – samples (measurements) per second, per channel. Our strain instrument supports 1 Sa/s to 10 kSa/s (or 25 kSa/s in limited conditions). Thermocouple instrument supports up to 1000 Sa/s.Waveform – an electronic signal (voltage), something that you’d observe on an oscilloscopeWaveform generator – a device that produces a waveformTODO: Note that “waveform generator” & “function generator” & “signal generator” are all equivalent, definitely not the yield statement
“No sense blowing up more than one at a time”Same reasons as testing softwareIn Hardware, as in Software, there’s often a published specification of what your device will do. If you don’t meet it, you get angry customers. To keep those customers happy and buying your product, you’ve got to make surethat you meet your published specifications.Often, these published specs are based on what the hardware can do, such as ‘a noise floor of 0.01 Decibels’, or 0.000010 arc seconds (2.78 x10^-9 degrees) of phase alignment between channels. For those of you who build web frameworks [raucous laughter], a noise floor means that you can detect any signal above that strength, and a phase alignment between channels means that if you put an identical signal into channel 1 and channel 2, you will see in the resulting data that the waveforms were processed at the same time.You also want to make sure that you’ve actually built your hardware correctly. Sometimes the production floor gets confused and they install a diode backwards. Sometimes they install a 10 ohm resistor instead of a 10,000 Ohm resistor. Whatever the reason, sometimes the failure isn’t enough to let the magic smoke out, but still gives your customers the wrong answer. You want your tests to show that your device works even once the design is shown to be good.
With unit tests, the point is to pick small components or subsections of your code and test those pieces, to test functionality at the smallest unit. In some pieces of hardware, there are discrete pieces like this that you can test. If that’s the case with your hardware, by all means make use of it and test those pieces of functionality separately. However, in many cases you will have two pieces of hardware which are inextricably linked, like an analog-to-digital converter connected through an analog filter. In this case the final data is your only method of data gathering, and you need to test the filter and ADC as a cohesive unit.In hardware testing, some unit-like testing is still possible (Isolated HW pieces exist), but in large part the HW is a big black box that all hangs together. If you contracted out the design, you may not even know what’s in it, just that it has specs that it has to meet.Mocks are the practice of faking out classes with stubs that appear to perform all the correct behavior, or give all the appropriate responses without doing all of the work. When testing hardware, the whole point is the stuff down at the very bottom of the stack - the chips and circuits. Those aren’t possible to mock, because then you’d be faking exactly the data that you need. (This can be very useful, but not for testing.)The only piece of the system you’re testing is the hardware - and unless you have a 1:1 hardware simulator (which is expensive to construct and harder to guarantee correctness - it ends up looking like the HW itself), you can’t mock out a piece of hardware.TDD is the practice of writing the test before, or as a guide to, writing the software. But when making hardware, it’s not really possible to design your hardware based on the design of your test - hardware’s driven by other considerations like PCB space, component cost, and specification goals. We can build a prototype back in the lab, but it won’t match the final PCB design. What we can do is work with that final piece, the known specifications. Since the hardware must meet some specification, and this and the circuit designs are a known quantity before it goes off for fabrication, we can design and write our tests based on these hardware designs and goals. This isn’t exactly TDD... but it is Spec-Based Testing.
So if you can’t mock it and you can’t break it down into unit tests... [pause] How DO you test hardware? I just mentioned that hardware has specifications it has to meet, specifications like Total Harmonic Distortion or Noise Floor. We can work with our hardware developers to put certain inputs into the product that should create certain types of outputs. We then use more equipment to sense those outputs, and verify that the responses we get are the responses the hardware engineers expect. The great news is, if you know the input signal, the type of hardware you’ll need to generate the input, the equipment you’ll need to measure the output, and the valid range for the outputs... you can write the entire test, and even construct the test harness, before the board comes back from the fabricator.
Sometimes you may get 50 or 100 boards back from the fabricator at once. Sometimes you’re doing engineering verification and proving one board works correctly is enough... other times you’re doing build validation and you need to test all of them. Testing them by hand would be a waste of our time and awesome coding skills, so we can build test harnesses or test rigs. In the case where you need a lot of test points on a piece of hardware to test supply voltages or chip power, and you are testing a lot of boards, it may be economical to build a bed-of-nails tester which connects directly to the PCB, like the one shown here. Then you just need some switching and measuring and you can test many boards very quickly by automating the test procedure. Other times, you are testing a small number of units, as we most often do, and you just need a Cat-5 cable with the ends stripped off and a waveform generator (point to test rig and/or photo of test rig) to test the product right.
If you need to test many things without changing cabling, a switching solution could come in handy. (possible picture of DIO switch test rig or Comparator test diagram) No, not a network switch. This lets you feed different signals into your hardware or send the outputs to different types of monitors, while only making one cable rig at the start of the test. Getting the switching paths correct can sometimes be tricky, but is a lot less tedious than doing it by hand.And your test won’t stop at 3am, waiting for you to change equipment connections.
Once you have your test stand set up, test progressions should advance automatically too. This is where these frameworks have the most in common with SW frameworks, as long as we can easily and reliably load the external equipment and math portions. We do it with python.We don’t use any of the common Python test frameworks, since they’re all geared for software testing. Since we’re not writing unit tests and we can’t use mocks, we had to roll our own.In our framework, each test module has “add” function, each test has “verify” function.The major part of a test is the calls list. This is just a list of calls to make in the future, when the test actually runs. The dirty little secret of the framework is that all the work done here just generates a list of calls and functions to call later, when the framework actually runs the test. It then uses the verify function to determine if the test passed.
For an example, our strain gauge instrument has a test for phase alignment. This diagram is the same test rig that was pictured earlier, with the waveform generator connected to two instruments.To guarantee the published phase alignment, the test spec defines the input as a sine wave at a particular voltage and frequency and then we run a Discrete Fourier Transform on the acquired data. These nasty equations are how we calculate the amplitude and phase.atan2 is the two-argument form of arctan
Agilent 33120Awaveform generator & Agilent E5810A LAN/GPIB gatewayControlling external equipment can be extremely easy, since we have a plethora of industry standards for instrument communication.We use a waveform generator that supports VXI-11, a protocol for instrument communication and control over a network. Does anyone use xml-rpc or json-rpc? VXI-11 is similar, but it’s based on the original ONC RPC implementation.IEEE-488 – GPIB (general purpose interface bus), introduced 1975, 488.2 defines instrument control commands/messages - *IDN?, *RST, *OPC? SCPI – standard commands for programmable instruments, defined common syntax, command structure, and data formats. Includes generic commands & instrument classes. Doesn’t specify the communication link.VXI-11 – spec published 1995, RPC (remote procedure calls) over IP, uses ASCII messages (inc IEEE-488)
*RST – reset*OPC? – operation complete query, returns an ASCII "+1" when all pending overlapped operations have been completedDEF – default
The test begins by setting the waveform generator to produce a sine wave.As the comment in the verify function notes, it only checks the return values of the calls. The actual verification is a little complicated, so that’s handled in a separate function that’s part of the calls list.
This is the main test sequence. It starts by setting all of the devices to acquire a thousand samples, using a sample rate of a thousand samples per second, from all 48 channels. It also configures the devices in a master/slave configuration. The master device will send sync and trigger signals on particular hardware lines and the slaves are set to listen for those signals.The inner loop is part of the reason the full test takes several hours to run. Each acquisition takes data for 1 second, but the test uses 2000 acquisitions for each of several trigger configurations.The analyze data method is where almost all of the work actually happens. It reads the data from each device and calculates the magnitude and phase of the data from each analog board in each device.There are several conditions that could generate a failure here - not enough data received, the data has an error code set, the magnitude indicates a weak analog signal, there's timestamp or phase skew between the analog boards within a device, or there's timestamp or phase skew between the master and slaves.
The analyze data method is where almost all of the work actually happens. It reads the data from each device and calculates the magnitude and phase of the data from each analog board in each device.There are several conditions that could generate a failure here - not enough data received, the data has an error code set, the magnitude indicates a weak analog signal, there's timestamp or phase skew between the analog boards within a device, or there's timestamp or phase skew between the master and slaves.