Unit Testing React with React Testing Library
In this document we will cover:
• The React Testing Library
• Running Unit Tests
• Testing Asynchronous Code
• Building and Running Component Tests
• Snapshot Testing
• Query Functions
• Simulating Events
• Text Matching
React Projects create with create-react-app come equipped with a testing framework from Facebook that’s:
• Invoked using “npm test”
• Open Source BSD 3-clause license
• Built on top of Jasmine
• From Facebook
• Works with other development frameworks as well (e.g. Angular)
Functions in Python
In this article we will work with functions in Python. Functions are reusable blocks of code that can be reused . They can accept parameters and return data. For this lab we will create script files rather than enter statements at the Python interpreter (shell).
Part 1 – Create a Basic Function
In this part we will create a basic function that prints a greeting.
__1. Open a terminal and navigate to your working directory. ( Following instructions in earlier labs this would be LabWorkPython. Use that directory if it exists. If not you can either create it, create another directory or use an existing directory. It doesn’t really make a difference where you save the files as long as you remember where they are. )
__2. Open your text editor (gedit or nano were suggested earlier) and create a file named:
__3. Add the following text to the file:
The function signature starts with the keyword ‘def’ and the function’s name followed by parenthesis. The signature ends with a colon ‘:’.
The code block that implements the function is indented from the function signature. In this case the print statement is the only line of code in that block. Later we will add more statements to the block and they will all need to be indented like print() is. The last line in the file executes the function.
|Related course: WA2703 Programming with Python 3
This 3 day course is designed to provide Developers and/or Data Analysts a gentle immersive hands-on introduction to the Python programming language; it also introduces Python for Data Science
Leading Practices for Microservice Logging
• (Micro-)Service Architectures mean that solutions are distributed across a network topology, with many small processes involved in handling a single request.
• Simple logging solutions generally don’t scale beyond a single process.
• How do we manage logs, which contain forensic information, when the requests have been distributed to many, potentially load-balanced, processes?
• Correlate Requests with a Unique ID
• Include a Unique ID in the Response
• Send Logs to a Central Location
• Structure Your Log Data
• Add Context to Every Request
• Write Logs to Local Storage
|Related course: WA2579 Technical Introduction to Microservices
This Introduction to Microservices training course will help you understand the value proposition and technical aspects of microservices, a new and rather fuzzy concept used to describe rapidly provisionable, independently deployable services with narrow and distinct functionality. For IT professionals, developers, software engineers, and DevOps practitioners – our microservices training provides the technical practices and tooling fundamentals necessary to begin realizing the benefits of microservices as a foundation for IT architecture, software engineering, and service/release delivery. Upon completion of this Microservices training course, students will have fundamental understanding of microservices and practical experience in implementing microservices using different technology stacks.