IOT Test Automation Framework (ITAF) WALKTHROUGH Revision 1.0
Total Page:16
File Type:pdf, Size:1020Kb
IOT Test Automation Framework (ITAF) WALKTHROUGH Revision 1.0 Ramya Ranganathan Contact: [email protected] Copyright © Intel Corporation, 2019. All rights reserved. This work is licensed under a Creative Commons Attribution 4.0 International License. INTRODUCTION .................................................................................................................................4 TWO MAJOR CATEGORIES OF TESTS .................................................................................................4 WHY Test Structure is needed...........................................................................................................5 Test Framework Goals ......................................................................................................................5 WHY ITAF ..........................................................................................................................................5 ITAF Terminologies ...........................................................................................................................6 ITAF Architecture Choices .................................................................................................................6 1: Separation of configuration data from test case application code ........................................................ 6 2: Abstraction of test run code from test application code ........................................................................ 6 3: Separate test logs/reports from test application code ........................................................................... 7 4: Common test code utilities .................................................................................................................... 7 5: Documented code ................................................................................................................................. 7 6: Embrace other test aid tools and test scope ......................................................................................... 7 7: Common Directory Structure for ITAF ................................................................................................... 7 ITAF Tool Choices ..............................................................................................................................8 Python (http://python.org ) ......................................................................................................................... 8 Selenium .................................................................................................................................................... 8 Additional Libraries .................................................................................................................................... 8 ITAF : Test Execution Flow ................................................................................................................9 ITAF COMPONENTS ...........................................................................................................................9 iTAF Directory Structure ............................................................................................................................ 9 testCaseApps ....................................................................................................................................... 12 testScenarios ....................................................................................................................................... 12 utils ....................................................................................................................................................... 12 Robot Framework .................................................................................................................................... 12 TestSettings and SettingsInfo ................................................................................................................. 13 Parameterization and Metrics .............................................................................................................. 14 Logging .................................................................................................................................................... 14 Documentation ........................................................................................................................................ 15 DETAILED WALKTHROUGH ..............................................................................................................15 First Things First ...................................................................................................................................... 15 Robot File ................................................................................................................................................ 16 What Happens When Robot Starts Executing This File? ........................................................................ 19 Copyright © Intel Corporation, 2019. All rights reserved. This work is licensed under a Creative Commons Attribution 4.0 International License. Robot “Cell-based” Parsing ..................................................................................................................... 20 The “import” Problem ............................................................................................................................... 21 Setup And Teardown ............................................................................................................................... 23 Robot Flow Of Execution ......................................................................................................................... 25 Keyword SET CONFIG LOCATIONS ...................................................................................................... 25 TestSettings ............................................................................................................................................. 29 What Is SettingsInfo? .............................................................................................................................. 30 Python Test Case File ............................................................................................................................. 32 Summary Of Walkthrough - Guidelines ................................................................................................... 35 DOCUMENTING THE CODE .............................................................................................................36 Introduction .......................................................................................................................................... 36 Creating Configuration File .................................................................................................................. 36 Document the Code ............................................................................................................................. 37 Run the Doxygen ................................................................................................................................. 39 Copyright © Intel Corporation, 2019. All rights reserved. This work is licensed under a Creative Commons Attribution 4.0 International License. INTRODUCTION IOT Test Automation Framework (ITAF) is an automation test framework for IOT product validation. It is especially useful for automating end-to-end UI and API tests of an IOT product. This document will walkthrough test code structuring and tool choices for ITAF. TWO MAJOR CATEGORIES OF TESTS The IOT products which ITAF supports usually have the following high-level architecture where the is a Sensor component generating the data, Gateway compiles and abstracts the data and sends interesting data to cloud where the customers can interpret and make insightful decisions. There is also a manageability / configurability flow that sources from the Cloud and gets propagated to GW and Sensors. For instance, over the air updates of the GW and Sensor SW happen from the Cloud. Gateway SENSORSENSOR SENSOR CLOUD Gateway SENSORSENSORSENSOR UI Interface Gateway SENSORSENSORSENSOR API Interface From the cloud, there are usually two types of interfaces for customers to interact with; these are the UI and the API. There is also a third type of interface called the CLI The UI interface is a human-driven interface that presents a set of web pages for humans to interact with the IOT system. In this case, iTAF testing would use the python selenium library to automate human-like interaction with the web pages. The API interface is a programmatic interface intended so that customers can write applications to interact with the IOT system. In this case, iTAF would automate API calls. CLI - Command Line Interface is for Personas with technical skillset who interact with the edge devices via cmd line console. Although current IOT solutions relies more on cloud based interfaces for remote edge management and UX, CLI does exist for obvious reasons. Some products might require both or all 3 types of testing to be performed. Copyright © Intel Corporation, 2019. All rights reserved. This work is licensed under a Creative Commons Attribution 4.0 International License. WHY Test Structure is needed Structured test development which is modular and supports test reuse is crucial to get tests developed quickly and with less redundancy which in turn help organizations