Monthly Archives: March 2024

Understanding Object-Orientated Testing

Testing In context of software development is a critical process that involves systematically checking a program or system to ensure it performs as intended. In software development, It is really important to check our work making sure everything works as it should. When we write code using object-orientated programming (OOP) which is a common way to organize and write our software, we need a special kind of checking called Object-Orientated Testing (OOT). This blog dives into what OOT is, inspired by the detailed article from GeeksforGeeks , showing why it is different and important.
Summary of the resource

The article from GeeksforGeeks explains how testing for Object-Orientated programming is different than traditional testing. OOP deals with concepts like classes and objects (which are basically groups of functions and data that model real-world things). OOT then focuses on checking these classes and objects, along with how they interact with each other, which is not something you do in traditional testing. The article talks about the challenges of doing OOT, like making sure objects work well together and the need for different tools and strategies to do it right.

Reason for selection

I picked this article because it does a great job of showing how checking object-orientated code is different from the usual way of testing code. It fits well with what we are learning in class about how to build software, giving us a clear picture of how to make sure out OOP projects work well

Reflection:

Reading about OOT made me realize that checking our code in OOP needs more than just looking at each part by itself. We need to see how all parts work together. It was an eye-opener to learn about the different tools we can use for OOT and how it helps us find and fix problems early on.

Looking forward

This article made me more aware of how important it is to use OOT in my future projects. Knowing how to do this kinds of testing means I can make sure my software is solid and works well, which is very important for any software developer.

Conclusion

Object-Orientated Testing is a key skill for software developers, especially as we build more complex and interconnected software. The insights from the GeeksforGeeks article highlights the unique aspect of OOT and remind us why adapting our testing to match our coding style is crucial. As we tackle bigger projects keeping these OOT principles in mind will help us build better and more reliable software

From the blog CS@Worcester – Josies Notes by josielrivas and used with permission of the author. All other rights reserved by the author.

Blog Post 1- CS443

For this weeks blog post I read the article on Testsigma’s Website called “Unit Testing | What it is, How it Works, Types & Top Benefits” by Diane Wong. It talks about the significance of unit testing in software development, giving a full overview of its benefits and best practices. Unit testing is an important feature of the software testing process, involving the testing of individual units or components of a software application in isolation. The main goal that I though was shown in this blog post was to show that each unit has functions as show and how unit testing can contribute to the overall reliability and robustness of the entire software system. The article highlights the key advantages of unit testing, pointing out its role in spotting and fixing bugs early in the development cycle. This is usually done by dividing and testing individual units and this helps the developers quickly pinpoint and address issues and reducing the chances of more complex and costly problems later in the development process. The blog post also discusses the importance of unit testing and how critical it is in the process. Also, the article explains the best practices for effective unit testing, including the using of testing frameworks, test coverage metrics, and the adoption of a test-driven development (TDD) methods. It emphasizes the integration of unit testing into the overall software development lifecycle. In conclusion, the blog post from Testsigma provides a full and informative guide to unit testing it highlights its importance in software development and offering practical insights into its implementation and best practices. This was a helpful blog post to read, since it helped me grasp the information about Unit Testing since it was something we have worked on in the beginning of the semester, it helped it stay fresh in my mind as we learn other wats of testing this semester.

From the blog CS@Worcester – CS- Raquel Penha by raqpenha and used with permission of the author. All other rights reserved by the author.

Mastering Unit Testing: A Developer’s Guide to Enhancing Code Quality (Week – 9)

Unit testing is an integral part of software development, crucial for validating individual code segments’ functionality. This systematic approach helps in identifying defects early, enhancing code reliability, and simplifying modifications. Let’s delve into the nuanced strategies of unit testing, including specification-based and code-based techniques, and explore the role of code coverage and the utility of JUnit in ensuring robust software solutions.

Specification-Based Testing Techniques

In the realm of specification-based or black-box testing, the focus is on assessing the software’s external behavior rather than its internal structure:

  1. Boundary Value Testing: This method targets the extreme ends of input ranges, where most errors tend to occur. By testing these boundary values, developers can identify potential edge case issues that might not emerge under normal test conditions.
  2. Equivalence Class Testing: This strategy simplifies testing by grouping inputs into classes that elicit similar behaviors. Testing one sample from each class can reduce the number of tests while maintaining effectiveness, ensuring that different scenarios are adequately represented.
  3. Decision Table-Based Testing: For functions governed by complex rules, decision table-based testing offers a structured approach. It maps different input combinations to their expected outcomes, ensuring all logical branches are explored and validated.

Code-Based Testing Strategies

Code-based or white-box testing requires an understanding of the software’s internal workings:

  1. Path Testing: Essential for ensuring every executable path is tested at least once, path testing uncovers sections of code that could be prone to errors, enhancing the overall robustness of the application.
  2. Data Flow Testing: Focusing on the lifecycle of data, this method tracks the creation, manipulation, and usage of variables. It’s particularly effective in identifying issues related to improper data handling and scope errors.

Emphasizing Code Coverage

Code coverage metrics are crucial for gauging the extent of tested code. While high code coverage does not eliminate all software bugs, it indicates thorough testing and contributes to higher quality code. Achieving substantial code coverage helps in maintaining and updating code with confidence.

Leveraging JUnit for Java Testing

JUnit, a cornerstone in the Java programming ecosystem, streamlines the creation, execution, and documentation of unit tests. It supports annotations for defining test cases and employs assertions to verify code behavior, aligning with Test-Driven Development (TDD) practices. JUnit’s simplicity aids in regular test implementation, encouraging developers to maintain code quality continuously.

In conclusion, unit testing is not just a task but a discipline that significantly impacts software quality. By integrating specification-based and code-based testing methods and striving for extensive code coverage, developers can craft more reliable, maintainable software. JUnit further simplifies the testing process, embedding quality into the development lifecycle. For a comprehensive guide to unit testing with JUnit, refer to “JUnit in Action, Third Edition” by Catalin Tudose, a resource that offers deep insights and practical examples for effective Java testing.

By embracing these practices, developers can ensure that their code not only functions as intended but also adapts gracefully to future changes and requirements.

From the blog CS@Worcester – Kadriu's Blog by Arber Kadriu and used with permission of the author. All other rights reserved by the author.

Embracing Vulnerability: “Expose Your Ignorance” Week-7

Acknowledging the Unknown:

“Expose Your Ignorance,” a compelling pattern from “Apprenticeship Patterns” by Dave Hoover and Adewale Oshineye, addresses a crucial aspect of growth in software development: openly acknowledging what you don’t know. This pattern encourages embracing the gaps in your knowledge as opportunities for learning, rather than as weaknesses. It’s about admitting your ignorance on certain topics, and actively seeking to fill those gaps, thereby transforming vulnerability into strength.

A Resonating Approach:

Though I haven’t yet started a career in software development, the principle of “Expose Your Ignorance” resonates with me. It aligns with my understanding of learning as an iterative and transparent process. This pattern challenges the often-held notion that admitting ignorance is a sign of weakness, especially in a field as complex as technology, where no one can know everything.

The Power of Honest Inquiry:

What I find most intriguing about this pattern is the empowerment that comes from honest self-assessment and inquiry. By exposing our ignorance, we open doors to new knowledge and show a willingness to grow. This approach not only accelerates learning but also fosters an environment of openness and collaboration.

Shaping Future Learning Attitudes:

While I have not yet had the chance to apply this in a professional setting, “Expose Your Ignorance” shapes my perspective on how I intend to approach learning in my future career. It instilled in me the value of being forthright about what I don’t know and using that as a catalyst for continuous improvement and skill acquisition.

A Balance of Vulnerability and Confidence:

While embracing ignorance is a powerful learning tool, I also recognize the importance of balancing this vulnerability with confidence in what I do know. It’s crucial to avoid underestimating one’s existing skills and knowledge while being open about areas for growth.

In conclusion, “Expose Your Ignorance” is an essential pattern for anyone aspiring to succeed in the ever-evolving world of software development. It encourages a mindset where admitting to not knowing something is not a drawback but a starting point for learning and growth. This pattern is a reminder that in the journey to becoming a skilled professional, vulnerability and openness are not just accepted; they are necessary. By willingly exposing our ignorance, we set ourselves on a path of continual learning and development, a path that is essential in the dynamic field of software development.

From the blog CS@Worcester – Kadriu's Blog by Arber Kadriu and used with permission of the author. All other rights reserved by the author.

Week 9: CS-443

Static vs Dynamic Testing

Testing software and ensuring it works as intended is a crucial part of software development. Two approaches to testing are static and dynamic. Static testing involves testing the software without running the code, while dynamic executes the program and tests its behavior in various situations.

Static Testing

The term static testing comes from examining the code in a “static” state rather than actually running it. Because the code is never actually executed with static testing, the focus of testing is on analyzing the software’s documentation along with the design of the code, and the code itself. Static testing is most beneficial in the early stages of development. Since the code is never being executed, a fully working implementation is not required unlike dynamic testing. Issues identified early in development are easier and less costly to fix resulting in better maintainability, and decreased time and money spent in the long term. Some static testing techniques include informal reviews, walkthroughs, static code reviews, and more.

Dynamic Testing

Dynamic testing involves actually executing the software and testing its behavior based on various inputs. Test cases are created to conduct test runs to identify defects and ensure the software meets the required specifications. Along with testing the software with various inputs and comparing to the expected outputs, error conditions are also tested. Error conditions are inputs that are outside of the valid input range, and the software should be able to handle the invalid input without any unexpected behavior. Dynamic testing is performed after coding and development are complete, whereas static testing usually begins in the early stages of development. Because dynamic testing executes the code, the software must be far enough in development where the software functions, performs, and secure as intended. Those reasons are why dynamic testing is to be completed after development. Some dynamic testing techniques include unit testing, integration testing, and system testing.

Conclusion

This article was chosen because it clearly explained what static and dynamic testing are and the differences between them. The article was also easy to follow along. I enjoyed learning about when static and dynamic testing are most beneficial because I was unaware that static testing begins in the earlier stages of development while dynamic is performed after development. So far in my software development journey, I have not written many tests for the code I have written, and have mainly done manual testing which takes extra time and may have errors. Gaining insight in these techniques will be helpful when testing code in the future.

Resource:

https://www.guru99.com/static-dynamic-testing.html

From the blog CS@Worcester – Zack's CS Blog by ztram1 and used with permission of the author. All other rights reserved by the author.

Test-driven development using mocking and stubbing

In the world of software development, ensuring that your application works as intended is crucial. This is where testing comes into play, serving as a safeguard against unexpected behavior and bugs. But how do you test effectively? This is where concepts like mocking, stubbing, and contract testing become vital. Let’s dive into these techniques and see how they can enhance your testing strategy.

  • The Essence of Mocking and Stubbing

Mocking and stubbing are techniques used primarily in unit and component tests, but their usefulness extends beyond these. They are about creating fake versions of external or internal services to streamline and stabilize testing processes.

Mocking refers to creating a faux version of an external or internal service to replace the real one during testing. This is especially useful when your code interacts with object properties rather than behaviors. By mocking dependencies, you enable your tests to run more quickly and reliably since they are not bogged down by real-time data fetching or complex logic processing.

On the other hand, stubbing involves creating a stand-in for certain behaviors of an object rather than the entire object. This technique is useful when your implementation interacts only with specific behaviors of an object, enabling faster and more focused tests.

  • Practical Applications

When your code uses external dependencies, such as system calls or database access, mocking or stubbing comes in handy. For example, instead of actually creating or deleting a file during a test, you can mock or stub the file system’s responses. This not only speeds up the testing process but also ensures that your tests remain independent and easy to manage.

  • Contract Testing in Microservices

In a micro-services architecture, services interact based on predefined “contracts” detailing expected requests and responses. Contract testing verifies that these interactions meet the agreed-upon standards. Unlike traditional integration testing, contract testing focuses on the interfaces between services, making it a leaner and more targeted approach.

This type of testing is beneficial for checking the integrity and reliability of service interactions without deploying an entire system. It’s particularly effective in continuous integration pipelines, as it ensures that changes in one service don’t break the contract with another.

  • The Role of Mocks and Stubs

In contract testing, mocks and stubs play a crucial role. By simulating the services that an application interacts with, developers can check the consistency and reliability of the application’s responses without relying on live services. This approach significantly reduces testing time and increases reliability.

  • Conclusion

Testing is an integral part of the software development lifecycle, and techniques like mocking, stubbing, and contract testing are essential tools in a developer’s arsenal. By understanding and implementing these strategies, we can ensure that your tests are both efficient and effective, leading to more reliable and maintainable software.

The link to the initial blog post: https://circleci.com/blog/how-to-test-software-part-i-mocking-stubbing-and-contract-testing/

From the blog CS@Worcester – Coding by asejdi and used with permission of the author. All other rights reserved by the author.

Week 7: CS-448

Concrete Skills

For this post, I read about the Concrete Skills pattern. This pattern is about when seeking a new role on a development team, the team may not want to risk the possibility that one may you be able to contribute to the team. They may think this because you may not have much concrete work to show your skillset and prove to teams you are able to contribute. The solution to this problem according to the text, is to acquire and maintain concrete skills. In order to do this, the text suggests collecting CVs of people whose skills you respect. Collecting CVs helps give an idea to what skills are useful and looked for when joining these teams. After learning these skills, then build a project using them to demonstrate that you can apply those newly learned skills.

I found this pattern to be useful because I am currently in the process of applying to jobs, so this pattern is very prevalent to me. Collecting CVs of those already in the industry, or those with more experience is something I had not thought of. However I believe it is a good way to find skills that you may be missing. Collecting a list of skills is also useful in the sense that common buzzwords used among CVs can be noted to help get past HR filters and managers who construct teams based off of those buzzwords.

I found the statement that describes hiring managers requiring to take a leap of faith on choosing who they hire, and having concrete work allows you to meet them halfway to be interesting. I found this to be interesting because it changes my perspective on the hiring process.

This pattern has changed the way I go about looking for new skills to learn. When learning new skills, I sometimes plateau and get overwhelmed with what I should be looking into. Now after reading this pattern, going into the future I will start collecting CVs because having a list of skills will be useful to direct my focus in the skills I should be learning.

From the blog CS@Worcester – Zack's CS Blog by ztram1 and used with permission of the author. All other rights reserved by the author.

CS-448 Week 7 Learn How you Fail

The pattern being examined is “Learn How to Fail” and it emphasizes the inevitability of failure in everyone’s life. It also suggests that failure is not a sign of incompetence but rather an opportunity for growth and self-awareness. This encourages individuals to analyze their failures, understand the underlying patterns, and address them effectively without dwelling on past mistakes or striving for perfection.

This pattern resonates deeply with me due to the universal nature of failure and brings light to the fact it is a natural part of the learning process. I am one that values continuous self-improvement and find the idea of embracing failure as a catalyst for personal growth both empowering and liberating. Instead of viewing failure as inadequate, it is seen as an invaluable source of feedback that can inform my future decisions and actions.

One of the more interesting and useful aspects of this pattern is its emphasis on self-reflection and self-awareness. The pattern provides a practical framework for introspection and self-discovery by encouraging individuals to identify recurring patterns, habits, and behaviors that contribute to their failures. This will help individuals to make more informed choices and develop strategies to lessen their weaknesses effectively.

This pattern has certainly influenced the way I think about my intended profession and how I approach my work. Failure is now viewed as an opportunity for learning and development rather than a setback or source of shame. I intend to face challenges and setbacks during my career path and handle them with resilience, knowing that they will contribute to my overall growth and success.

While I do not disagree with the general message of this pattern, there can be cause for concern given how you might handle failure. It is important to acknowledge and learn from failure, it is just as important to celebrate successes and achievements. Failure can provide valuable lessons but can also overshadow or diminish one’s accomplishments in the search of self-improvement. Balancing both self-reflection and self-affirmation is crucial for maintaining a healthy mindset and sustained motivation.

In conclusion, the pattern underscores the importance of embracing failure as a steppingstone to personal and professional growth. By cultivating self-awareness, learning from mistakes, and approaching challenges with resilience, individuals can navigate their professional journeys with confidence and adaptability.

5. Perpetual Learning | Apprenticeship Patterns (oreilly.com)

From the blog CS@Worcester – Jason Lee Computer Science Blog by jlee3811 and used with permission of the author. All other rights reserved by the author.

A Summary on Unit Testing

Unit testing is a crucial aspect of software development that focuses on testing individual components of a software product. Nickolay Bakharev writes a great article detailing the uses, advantages, and strategies to unit testing in his article, Unit Testing: Definition, Examples, and Critical Best Practices.

Unit testing involves writing tests for functions, procedures, methods, objects, or other entities in an application’s source code. The goal is to ensure that each unit of the software performs as intended and meets requirements.

Some advantages of unit testing are that it is able to detect problems early, thereby reducing costs. It is also heavily test-driven, easier to refactor the code, and allows developers to keep documentation of the system’s behavior.

Unit tests usually consist of four phases:

1. Planning and setting up the environment

2. Writing test cases and scripts

3. Executing the tests

4. Analyzing the results

A common approach to unit testing is something called Test-driven development (TDD), where tests are written before the actual code, resulting in a high-quality, consistent codebase.

Unit testing can also be used for security purposes by creating tests that focus on the security controls of the smallest testable unit of software. Security unit tests can help catch security flaws early in the development lifecycle which saves the costs of potential security breaches.

Various unit testing techniques include structural unit testing, which examines the internal structure of the code, functional unit testing, which tests the functionality of an application component, and error-based techniques such as fault seeding and mutation testing.

There are many examples of unit testing in specific frameworks. Some include Android unit testing, Angular unit testing, Node.js unit testing using Mocha, and React Native unit testing using Jest.

In order to use unit testing most effectively, the developer must write readable tests, write deterministic tests that always pass or fail on the same code, automate unit tests in a continuous integration process, and avoid multiple asserts in a single unit test to maintain clarity and reliability.

I found unit testing to be a very useful technique to learn in class. While I knew the basics of testing, this was the first time I actually implemented it into code. I will try to add these unit testing techniques to my research project code.

From the blog Stories by Namson Nguyen on Medium by Namson Nguyen and used with permission of the author. All other rights reserved by the author.

sustainable motivations

I hear this a lot: getting into tech, and specifically software engineering, because of money. It certainly seems to be the case that many people since maybe the 2010s have worked on Computer Science degrees solely because of the income and luxury of it, rather than an actual enjoyment of it.

I always found myself good with technology. When I took my first Computer Science course in high school, I always ended up completing assignments in 10-15 minutes when the allotted time was around two class periods. This is what I’m good at, as far as I can tell, but that’s not necessarily enough for me to make a career off of. If I don’t care about it, then I’m stagnating. If my motivation is simply that I’m good at it, it doesn’t necessarily inspire growth.

These are two examples of unsustainable motivations. The idea is that we can get trapped in the motivations we set up for what we do, and they lock us into a (most of the time, negative) mindset. Instead of enjoying my day to day work, I’ll see it as just work, and want the day to be over as soon as it starts, without actually growing as a person or in my skill level.

While the solution given tries to offer a practical approach (writing down your motivations and how much they factor in to your decision to stay a software developer), I don’t necessarily think this is a strong solution. I’m inclined to say that you have to have a more inquisitive investigation to why you care about this career, and what is really motivating you. Ultimately, you yourself create this motivation, it’s not out there waiting to be found. You can either construct for yourself an enjoyment of the journey, or you can only care about the outcomes.

From this, I would say solely caring about outcomes is unhealthy, and that mindset lends itself to motivations like reputation and money. As such, you have to ultimately figure out how to care about the journey if you actually want to have some level of enjoyment in your career. Otherwise every day genuinely will be a soulless repetition of the last.

There’s a reason why Camus wrote that one must imagine Sisyphus happy. If Sisyphus were to redefine the pushing of that boulder as a journey, and the rolling down of that boulder as a satisfying conclusion and new beginning, then this punishment is not as severe. Of course, this requires a lot of mental effort, but I think it’s necessary to live a life that you can actually be happy with.

From the blog CS@Worcester – V's CompSCi Blog by V and used with permission of the author. All other rights reserved by the author.