CDL - Section 13 - Testing and Securing Applications Flashcards
What is Test Driven Development (TDD)?
A software development practice that focuses on creating unit test cases before developing the actual code.
It’s a style of programming where coding, testing, and design are tightly interwoven.
What are the 4 layers of the TDD Testing Pyramid?
- Unit Testing
- Integration Testing
- System Testing
- Acceptance Testing
What is Unit testing (UUT)?
Conducted at the beginning for the development process; unit tests are done in isolation. They should not test interaction between multiple system components.
Automated tests that individually focus on a small portion of the application code that you want to test.
The tests should be: reliable, fast, isolated and readable.
What is Integration Testing (CUT)?
After the unit testing (UUT) is finished, you need to validate that the component can interact properly with actual system components.
Combining and testing multiple components and their interaction is called integration testing.
CUT = Component Under Test
What is System Testing?
The purpose of this testing layer is validating that the system or product works as a whole.
Examples are: functionality, security, usability, storage, and regression testing.
What is Acceptance Testing?
Once developers are finished with developing and testing the product, it is ready for delivery.
This final testing layer serves the purpose of validating that the delivered product matches the requirements of the client.
What is the difference between Alpha and Beta testing?
Alpha = testing done by developers in a Dev environment.
Beta = a selected group of users get access to the product before it’s release to provide feedback on quality,
Is a Unit Test clearly defined? IS the size defined?
No.
The size of a unit under test is not strictly defined, and neither is the definition of what a unit is.
A unit test in practice is a piece of code, typically a method or function, that invokes any part of the application code that you want to test.
What are the only two verdicts of a Unit Test?
PASS or FAIL
What are Happy Path/Sunny Day and Error Path/Rainy Day scenario?
The happy path scenario is a default use case where a test uses known input and executes successfully without any exceptions. AKA the test is always a PASS
the input is not in the expected form; it can help you to identify code smells and bugs early in the development of your application. AKA the test should FAIL.
REVIEW: Containers
→ Containers run isolated processes on an operating system, providing reliable and consistent deployments regardless of the environment.
→ They provide a standard way of packaging your application code and all the dependencies into a single object
→ It makes containers very convenient for running tests, as well as making sure you are deploying the same code that was used for testing
→ Containerization technology makes it possible for developers to replicate the production environment on the local computer; containers can be managed via the Terminal
→ Process of creating a container:
- Write the Dockerfile
- Add files to Build’s context
* * the Build’s Context = the directory where the Dockerfile is located - Build the image using the “docker build” cmd
- Start the container with the new image
What is a Docker File?
The file which holds the set of instructions that define a Docker image.
Containers are then spun up from a Docker Image.
REVIEW: Common Docker Commands
○ Convention dictates the instructions to be all in upper-case
○ Starts with the instruction FROM
- -> “FROM” Specifies the parent (base) image to be used for the following instructions in the Dockerfile.
- -> EX) FROM ubuntu:latest = creating a container based on an image from the latest release of Ubuntu. You would then use “docker run ubuntu:latest” to create a new Docker container.
○ Lines starting with “#” are the comments
○ COPY - Used to copy files or directories from the build’s context into the container
○ ENV - Creates a new environment variable or sets a value of an existing variable inside the container
○ RUN - Used to run a single or multiple commands in a shell in the container to prepare the image
○ VOLUME - Creates a mounting point for persisting data that is consumed by the Docker containers
○ EXPOSE - Exposes a TCP or UDP port on which the application running in the container is accessible
○ CMD - Unlike the RUN command, the CMD command does not execute while building the image. Instead, it just specifies what command to execute when a new container is started from this image
What is a Docker Repository?
What is a collection of Docker Repo’s called?
A Docker Repo is where a collection of Docker Images are stored.
A collection of Repo’s is called a Registry
What is a Network Driver (when working with Containers)?
Drivers are used to connect containers to other containers, or to a machine on the host network, or outside the network.