Category Archives: CS-443

JUnit 5 Testing

2/27/2025

This week we learned about Junit test cases. Coming from a C++ background it was a bit difficult to order my tests and to use one global object that runs before all other tests. In C++ the tests run in the order that you write them, and I learned that in java that is not a thing unless you specifically use order(N) N being the order number. This way of testing makes you able to order your test cases in whatever way you want. Also, I learned that you can just make a setup function with a single object and by using “Before All” this means the set up will run before any other test which helps with repetitive tasks of making objects over and over. I personally would rather create a fresh object for each test, but it was a nice experience learning that java just randomly tests and does not have an actual order unless stated otherwise.

Looking through the Junit 5 user guide when doing the homework I also learned that you can use “Before Each” for tests that you want to run before each test sort of like a for loop. One very interesting thing I have never encountered is that you can use lambda in order to compare variables using in objects. This makes it nice and compact for simpler tests because this can all be done within one line.

In class I also learned that gradle will give a different output for the test’s cases compared to vscode. I also encountered that when I would hit the checkmark in vscode for individual test cases they would pass and then other occurrences where they would not pass. Also, the same with running them globally all together. This confused me and took me a few hours to figure out why, but I realized it was due to my global object that I created. I also noticed that gradle would give me a different result as well, but it was much better and consistent than running the tests individually.

Source: JUnit 5 User Guide
Source: Writing Templates for Test Cases Using JUnit 5 – GeeksforGeeks

From the blog CS@Worcester – Cinnamon Codes by CinCodes and used with permission of the author. All other rights reserved by the author.

JUnit, Test, and Repeat

I’ve decided that I wanted to practice making more JUnit tests. I did well on my last homework assignment, but I feel like I still need more practice. It took me some time to do it. I may have to generate my own JUnit tests in the midterm so I would need to make them at a faster rate. Anyway, practice makes perfect so there is no such thing as too much practice.

For this post I will be using this website: Inheritance in Java – GeeksforGeeks

This website contains two examples of code but I will use the first one. The code does not allow for user input but I’ll be drafting tests as if it does.

Before I write any test I would write:

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

import static org.junit.jupiter.api.Assertions.assertThrows;

They will be useful later.

The first test I would make is a constructor test. I believe it should be one of the first tests. It is good to know the test works as it is supposed to since if it cannot do that it will need to be immediately revised. So, I would do this:

@Test

public void testMountainBikeConstructor() {

MountainBike mb = new MountainBike(30, 10, 45);

assertEquals(30, mb.gear);

assertEquals(10, mb.speed);

assertEquals(45, mb.seatHeight);

}

This is supposed to be take in three values and tests if the constructor initializes them correctly. I used the name “mb” because it was already in a class that was used to test inputs. It just made sense to me.

Another test I created tests the set string height method.

@Test

public void testSetHeight() {

mountainBike.setHeight(40);

assertEquals(40, mountainBike.seatHeight);

}

This tests if the height of the mountain bike can handle user input.

@Test

public void testMountainBikeMethods() {

mountainBike.applyBrake(5);

assertEquals(10, mountainBike.speed);

mountainBike.speedUp(10);

assertEquals(20, mountainBike.speed);

}

This tests if the mountain bike can speed up and brake.

@Test
void testToString() {
String expected = “No of gears are 6\nspeed of bicycle is 25\nseat height is 10”;
assertEquals(expected, mountainBike.toString());
}
}

This is supposed to test that the code has the expected output.

For the final test, I wanted to up the ante. What if I could test the limits of the code?

@Test

public void testSpeedLimits() {

MountainBike mb = new MountainBike(3, 100, 25);

mb.setSpeed(0);

assertEquals(0, mb.getSpeed(), “No negative speed!”);

assertThrows(IllegalArgumentException.class, () -> mb.setSpeed(-10), “No negative speed!”);

}

Overall, this was an interesting challenge. The main difficulty was finding the code to do this project on. There was code that was too easy thus difficult to generate meaningful tests on. There was also code that was too complicated which made it difficult to make a significant number of tests. In the end, it was nice to get some practice.

From the blog My Journey through Comp Sci by Joanna Presume and used with permission of the author. All other rights reserved by the author.

On CI/CD Pipelining

 In this post, I’ll be discussing my thoughts on an article I found on the Ministry of Testing website titled “An introduction to Continuous Integration (CI) and Continuous Delivery (CD) pipelines for software testers.” This piece really stood out to me because it highlighted the importance of integrating testing into the continuous integration and continuous delivery (CI/CD) pipeline. I’ve been learning about automated testing and CI/CD practices, and this article helped me better understand how testing can be embedded into each phase of the development cycle to ensure high-quality software and faster release times.

One key point that really resonated with me was the idea of shifting left, which means testing early in the development process. The author explained that integrating tests into the CI/CD pipeline allows teams to detect bugs and issues earlier, rather than waiting until the end of the development cycle. This makes perfect sense to me because I’ve seen firsthand in my career how much more efficient the development process becomes when tests are automated and run continuously. Instead of waiting for a bug to be discovered during a manual testing phase late in the process, CI/CD testing enables teams to catch those issues as they happen, significantly reducing the risk of production bugs and minimizing the effort needed to fix them. When things build up, business units accrue a lot of technical debt, and I end up having to hound them to fix 20 different things at the same time, instead of them being able to handle them as they appear, which CI/CD pipeline testing may help them with.

By incorporating automated tests into the pipeline, I can quickly get feedback about the code I’ve written, allowing me to catch mistakes early. However, I also realized that the article pointed out a very important note that I agree with: not all tests can be fully automated. There are still areas, such as user experience or complex edge cases, that may require more manual or exploratory testing. This balance of automated and manual testing within CI/CD pipelines is something I’ve experienced while developing a public facing status page, where it is not just functionality that needs to be tested, but also human elements, like how the page looks.

The article also discussed how testing within the CI/CD pipeline encourages a mindset of continuous improvement. Each time a test fails or catches an issue, it provides an opportunity to address potential gaps in the process and refine both the tests and the code. I think this aligns perfectly with the idea of being a “Software Apprentice,” always looking for ways to improve and enhance the quality of the product, no matter how far along in the development cycle it may be. Overall, this article reinforced the idea that CI/CD testing is not just about speeding up development—it’s about focusing on quality, where testing is an integral part of every stage.

From the blog Mr. Lancer 987's Blog by Mr. Lancer 987 and used with permission of the author. All other rights reserved by the author.

On CI/CD Pipelining

 In this post, I’ll be discussing my thoughts on an article I found on the Ministry of Testing website titled “An introduction to Continuous Integration (CI) and Continuous Delivery (CD) pipelines for software testers.” This piece really stood out to me because it highlighted the importance of integrating testing into the continuous integration and continuous delivery (CI/CD) pipeline. I’ve been learning about automated testing and CI/CD practices, and this article helped me better understand how testing can be embedded into each phase of the development cycle to ensure high-quality software and faster release times.

One key point that really resonated with me was the idea of shifting left, which means testing early in the development process. The author explained that integrating tests into the CI/CD pipeline allows teams to detect bugs and issues earlier, rather than waiting until the end of the development cycle. This makes perfect sense to me because I’ve seen firsthand in my career how much more efficient the development process becomes when tests are automated and run continuously. Instead of waiting for a bug to be discovered during a manual testing phase late in the process, CI/CD testing enables teams to catch those issues as they happen, significantly reducing the risk of production bugs and minimizing the effort needed to fix them. When things build up, business units accrue a lot of technical debt, and I end up having to hound them to fix 20 different things at the same time, instead of them being able to handle them as they appear, which CI/CD pipeline testing may help them with.

By incorporating automated tests into the pipeline, I can quickly get feedback about the code I’ve written, allowing me to catch mistakes early. However, I also realized that the article pointed out a very important note that I agree with: not all tests can be fully automated. There are still areas, such as user experience or complex edge cases, that may require more manual or exploratory testing. This balance of automated and manual testing within CI/CD pipelines is something I’ve experienced while developing a public facing status page, where it is not just functionality that needs to be tested, but also human elements, like how the page looks.

The article also discussed how testing within the CI/CD pipeline encourages a mindset of continuous improvement. Each time a test fails or catches an issue, it provides an opportunity to address potential gaps in the process and refine both the tests and the code. I think this aligns perfectly with the idea of being a “Software Apprentice,” always looking for ways to improve and enhance the quality of the product, no matter how far along in the development cycle it may be. Overall, this article reinforced the idea that CI/CD testing is not just about speeding up development—it’s about focusing on quality, where testing is an integral part of every stage.

From the blog Mr. Lancer 987's Blog by Mr. Lancer 987 and used with permission of the author. All other rights reserved by the author.

On CI/CD Pipelining

 In this post, I’ll be discussing my thoughts on an article I found on the Ministry of Testing website titled “An introduction to Continuous Integration (CI) and Continuous Delivery (CD) pipelines for software testers.” This piece really stood out to me because it highlighted the importance of integrating testing into the continuous integration and continuous delivery (CI/CD) pipeline. I’ve been learning about automated testing and CI/CD practices, and this article helped me better understand how testing can be embedded into each phase of the development cycle to ensure high-quality software and faster release times.

One key point that really resonated with me was the idea of shifting left, which means testing early in the development process. The author explained that integrating tests into the CI/CD pipeline allows teams to detect bugs and issues earlier, rather than waiting until the end of the development cycle. This makes perfect sense to me because I’ve seen firsthand in my career how much more efficient the development process becomes when tests are automated and run continuously. Instead of waiting for a bug to be discovered during a manual testing phase late in the process, CI/CD testing enables teams to catch those issues as they happen, significantly reducing the risk of production bugs and minimizing the effort needed to fix them. When things build up, business units accrue a lot of technical debt, and I end up having to hound them to fix 20 different things at the same time, instead of them being able to handle them as they appear, which CI/CD pipeline testing may help them with.

By incorporating automated tests into the pipeline, I can quickly get feedback about the code I’ve written, allowing me to catch mistakes early. However, I also realized that the article pointed out a very important note that I agree with: not all tests can be fully automated. There are still areas, such as user experience or complex edge cases, that may require more manual or exploratory testing. This balance of automated and manual testing within CI/CD pipelines is something I’ve experienced while developing a public facing status page, where it is not just functionality that needs to be tested, but also human elements, like how the page looks.

The article also discussed how testing within the CI/CD pipeline encourages a mindset of continuous improvement. Each time a test fails or catches an issue, it provides an opportunity to address potential gaps in the process and refine both the tests and the code. I think this aligns perfectly with the idea of being a “Software Apprentice,” always looking for ways to improve and enhance the quality of the product, no matter how far along in the development cycle it may be. Overall, this article reinforced the idea that CI/CD testing is not just about speeding up development—it’s about focusing on quality, where testing is an integral part of every stage.

From the blog Mr. Lancer 987's Blog by Mr. Lancer 987 and used with permission of the author. All other rights reserved by the author.

On CI/CD Pipelining

 In this post, I’ll be discussing my thoughts on an article I found on the Ministry of Testing website titled “An introduction to Continuous Integration (CI) and Continuous Delivery (CD) pipelines for software testers.” This piece really stood out to me because it highlighted the importance of integrating testing into the continuous integration and continuous delivery (CI/CD) pipeline. I’ve been learning about automated testing and CI/CD practices, and this article helped me better understand how testing can be embedded into each phase of the development cycle to ensure high-quality software and faster release times.

One key point that really resonated with me was the idea of shifting left, which means testing early in the development process. The author explained that integrating tests into the CI/CD pipeline allows teams to detect bugs and issues earlier, rather than waiting until the end of the development cycle. This makes perfect sense to me because I’ve seen firsthand in my career how much more efficient the development process becomes when tests are automated and run continuously. Instead of waiting for a bug to be discovered during a manual testing phase late in the process, CI/CD testing enables teams to catch those issues as they happen, significantly reducing the risk of production bugs and minimizing the effort needed to fix them. When things build up, business units accrue a lot of technical debt, and I end up having to hound them to fix 20 different things at the same time, instead of them being able to handle them as they appear, which CI/CD pipeline testing may help them with.

By incorporating automated tests into the pipeline, I can quickly get feedback about the code I’ve written, allowing me to catch mistakes early. However, I also realized that the article pointed out a very important note that I agree with: not all tests can be fully automated. There are still areas, such as user experience or complex edge cases, that may require more manual or exploratory testing. This balance of automated and manual testing within CI/CD pipelines is something I’ve experienced while developing a public facing status page, where it is not just functionality that needs to be tested, but also human elements, like how the page looks.

The article also discussed how testing within the CI/CD pipeline encourages a mindset of continuous improvement. Each time a test fails or catches an issue, it provides an opportunity to address potential gaps in the process and refine both the tests and the code. I think this aligns perfectly with the idea of being a “Software Apprentice,” always looking for ways to improve and enhance the quality of the product, no matter how far along in the development cycle it may be. Overall, this article reinforced the idea that CI/CD testing is not just about speeding up development—it’s about focusing on quality, where testing is an integral part of every stage.

From the blog Mr. Lancer 987's Blog by Mr. Lancer 987 and used with permission of the author. All other rights reserved by the author.

On CI/CD Pipelining

 In this post, I’ll be discussing my thoughts on an article I found on the Ministry of Testing website titled “An introduction to Continuous Integration (CI) and Continuous Delivery (CD) pipelines for software testers.” This piece really stood out to me because it highlighted the importance of integrating testing into the continuous integration and continuous delivery (CI/CD) pipeline. I’ve been learning about automated testing and CI/CD practices, and this article helped me better understand how testing can be embedded into each phase of the development cycle to ensure high-quality software and faster release times.

One key point that really resonated with me was the idea of shifting left, which means testing early in the development process. The author explained that integrating tests into the CI/CD pipeline allows teams to detect bugs and issues earlier, rather than waiting until the end of the development cycle. This makes perfect sense to me because I’ve seen firsthand in my career how much more efficient the development process becomes when tests are automated and run continuously. Instead of waiting for a bug to be discovered during a manual testing phase late in the process, CI/CD testing enables teams to catch those issues as they happen, significantly reducing the risk of production bugs and minimizing the effort needed to fix them. When things build up, business units accrue a lot of technical debt, and I end up having to hound them to fix 20 different things at the same time, instead of them being able to handle them as they appear, which CI/CD pipeline testing may help them with.

By incorporating automated tests into the pipeline, I can quickly get feedback about the code I’ve written, allowing me to catch mistakes early. However, I also realized that the article pointed out a very important note that I agree with: not all tests can be fully automated. There are still areas, such as user experience or complex edge cases, that may require more manual or exploratory testing. This balance of automated and manual testing within CI/CD pipelines is something I’ve experienced while developing a public facing status page, where it is not just functionality that needs to be tested, but also human elements, like how the page looks.

The article also discussed how testing within the CI/CD pipeline encourages a mindset of continuous improvement. Each time a test fails or catches an issue, it provides an opportunity to address potential gaps in the process and refine both the tests and the code. I think this aligns perfectly with the idea of being a “Software Apprentice,” always looking for ways to improve and enhance the quality of the product, no matter how far along in the development cycle it may be. Overall, this article reinforced the idea that CI/CD testing is not just about speeding up development—it’s about focusing on quality, where testing is an integral part of every stage.

From the blog Mr. Lancer 987's Blog by Mr. Lancer 987 and used with permission of the author. All other rights reserved by the author.

On CI/CD Pipelining

 In this post, I’ll be discussing my thoughts on an article I found on the Ministry of Testing website titled “An introduction to Continuous Integration (CI) and Continuous Delivery (CD) pipelines for software testers.” This piece really stood out to me because it highlighted the importance of integrating testing into the continuous integration and continuous delivery (CI/CD) pipeline. I’ve been learning about automated testing and CI/CD practices, and this article helped me better understand how testing can be embedded into each phase of the development cycle to ensure high-quality software and faster release times.

One key point that really resonated with me was the idea of shifting left, which means testing early in the development process. The author explained that integrating tests into the CI/CD pipeline allows teams to detect bugs and issues earlier, rather than waiting until the end of the development cycle. This makes perfect sense to me because I’ve seen firsthand in my career how much more efficient the development process becomes when tests are automated and run continuously. Instead of waiting for a bug to be discovered during a manual testing phase late in the process, CI/CD testing enables teams to catch those issues as they happen, significantly reducing the risk of production bugs and minimizing the effort needed to fix them. When things build up, business units accrue a lot of technical debt, and I end up having to hound them to fix 20 different things at the same time, instead of them being able to handle them as they appear, which CI/CD pipeline testing may help them with.

By incorporating automated tests into the pipeline, I can quickly get feedback about the code I’ve written, allowing me to catch mistakes early. However, I also realized that the article pointed out a very important note that I agree with: not all tests can be fully automated. There are still areas, such as user experience or complex edge cases, that may require more manual or exploratory testing. This balance of automated and manual testing within CI/CD pipelines is something I’ve experienced while developing a public facing status page, where it is not just functionality that needs to be tested, but also human elements, like how the page looks.

The article also discussed how testing within the CI/CD pipeline encourages a mindset of continuous improvement. Each time a test fails or catches an issue, it provides an opportunity to address potential gaps in the process and refine both the tests and the code. I think this aligns perfectly with the idea of being a “Software Apprentice,” always looking for ways to improve and enhance the quality of the product, no matter how far along in the development cycle it may be. Overall, this article reinforced the idea that CI/CD testing is not just about speeding up development—it’s about focusing on quality, where testing is an integral part of every stage.

From the blog Mr. Lancer 987's Blog by Mr. Lancer 987 and used with permission of the author. All other rights reserved by the author.

On CI/CD Pipelining

 In this post, I’ll be discussing my thoughts on an article I found on the Ministry of Testing website titled “An introduction to Continuous Integration (CI) and Continuous Delivery (CD) pipelines for software testers.” This piece really stood out to me because it highlighted the importance of integrating testing into the continuous integration and continuous delivery (CI/CD) pipeline. I’ve been learning about automated testing and CI/CD practices, and this article helped me better understand how testing can be embedded into each phase of the development cycle to ensure high-quality software and faster release times.

One key point that really resonated with me was the idea of shifting left, which means testing early in the development process. The author explained that integrating tests into the CI/CD pipeline allows teams to detect bugs and issues earlier, rather than waiting until the end of the development cycle. This makes perfect sense to me because I’ve seen firsthand in my career how much more efficient the development process becomes when tests are automated and run continuously. Instead of waiting for a bug to be discovered during a manual testing phase late in the process, CI/CD testing enables teams to catch those issues as they happen, significantly reducing the risk of production bugs and minimizing the effort needed to fix them. When things build up, business units accrue a lot of technical debt, and I end up having to hound them to fix 20 different things at the same time, instead of them being able to handle them as they appear, which CI/CD pipeline testing may help them with.

By incorporating automated tests into the pipeline, I can quickly get feedback about the code I’ve written, allowing me to catch mistakes early. However, I also realized that the article pointed out a very important note that I agree with: not all tests can be fully automated. There are still areas, such as user experience or complex edge cases, that may require more manual or exploratory testing. This balance of automated and manual testing within CI/CD pipelines is something I’ve experienced while developing a public facing status page, where it is not just functionality that needs to be tested, but also human elements, like how the page looks.

The article also discussed how testing within the CI/CD pipeline encourages a mindset of continuous improvement. Each time a test fails or catches an issue, it provides an opportunity to address potential gaps in the process and refine both the tests and the code. I think this aligns perfectly with the idea of being a “Software Apprentice,” always looking for ways to improve and enhance the quality of the product, no matter how far along in the development cycle it may be. Overall, this article reinforced the idea that CI/CD testing is not just about speeding up development—it’s about focusing on quality, where testing is an integral part of every stage.

From the blog Mr. Lancer 987's Blog by Mr. Lancer 987 and used with permission of the author. All other rights reserved by the author.

The Key Pillars of API Testing

Application Program Interfaces (APIs) provide the framework for how pieces of software communicate with each other, as well as the user. Therefore, proper API testing is key in delivering a reliable product. In a blog for Medium.com, Andrey Enin says that around 3/4 of product functionality involves designing the API correctly. He also lists some of what he considers to be the core ideology behind how these tests are designed and conducted.

Firstly, an API, or any program, must be tested to ensure it works properly. Functionality testing involves sending requests to the API and comparing the results with the intended specifications. End-to-end tests are useful in this case; multiple calls are chained together, often across multiple APIs, to replicate the end user experience in order to bring bugs to the surface.

Performance testing is another point. Measuring how the software and API perform in high use cases or under high traffic loads improves stability by identifying issues in a controlled environment. That is, better to break it now, rather than after delivering the product. Compatibility testing falls under a similar umbrella. Differing and often “unexpected” requests are sent to the API to test how the program responds. While performance testing can involve stress-testing and compatibility testing often involves testing the API in different environments, the philosophy is the same: better for it to break now, when fixes are easier to implement as opposed to post-release.

In a similar thread is error testing. Quality software will be able to handle errors without suffering catastrophic failure. With API testing, this generally comprises of sending intentionally incorrect or malformed requests to ensure the interface returns the relevant error responses.

Testing the usability of the API is somewhat different, in that it refers to the developer experience when working with the interface. Some of the examples listed in the aforementioned Medium.com post include adhering to OpenAPI specifications, uniform naming conventions, and making sure documentation is comprehensive and unambiguous. The unique perspective of focusing on the end user experience helps create developer-friendly interfaces that are popular and remain relevant in the industry.

Finally, security testing involves checking to make sure the API carries data securely and is protected from unauthorized or malicious use. Transmitting data over HTTPS is a common method of protecting sensitive information, and is generally considered standard for most web traffic. Testing the interface’s authentication methods for vulnerabilities protects against outside access to the same sensitive information as well as preventing unauthorized use of the interface.

As a final note, it’s helpful to consider these testing approaches as a foundation for a standard of quality assurance, as opposed to a check list to follow. Specific tests may address multiple different parts, and different approaches may take importance over others. Considering each different aspect of API testing over the course of the development cycle, outside of the testing environment, helps ensure the quality of the final product.

References:

Enin, Andrey. “Field Notes in API Testing, Part 1: Areas of Focus.” Medium.Com, Medium, 25 Jan. 2025, adequatica.medium.com/field-notes-in-api-testing-part-1-areas-of-focus-46b516ccacf4#4439.

From the blog Griffin Butler Computer Science Blog by Griffin Butler and used with permission of the author. All other rights reserved by the author.