Category Archives: CS@Worcester

Why is Test Driven Development So Good

Article: https://www.thoughtworks.com/en-us/insights/blog/test-driven-development-best-thing-has-happened-software-design

Last class, we got some hands-on experience with using Test Driven Development. These concepts always feel more concrete and understandable when actually working with them  yourself, rather than only reading articles or looking at examples. I’ve since gotten the hang of this method of development, and wanted to look into how it compares with other development strategies. Such is how I found Test Driven Development is the best thing that has happened to software design by Arek Torczuk.

Throughout the entire article, Torczuk compares the methodologies of code-driven tests and test-driven code. In other words, he judges whether code-first test later is better than test-now code later, respectively. The results for this vary, of course; some companies or teams may benefit more from one strategy than the other. A noted flaw of code-driven testing is that your tests do not challenge the implementation and design of your code. You can create all the tests you’d like on a specific method, but nothing would make you second-guess the way you wrote the method. 

This is where the test-driven approach would come into play. Having already written the tests, you have a better idea of what your code should look like, and how it should act. As Torczuk states, you can ask yourself “What do I expect from the code?” with writing tests before the method (Torczuk). Essentially, with TDD, you know all the answers to your questions and when enough is enough in terms of tests & code. In my mind, it makes the process more streamlined.

Another important part of TDD Torczuk mentions is that it gives quick feedback about the design of your software. You’ll sooner realize the potential issues with your existing codebase, and how it might affect your ability to add new functionality. 

I selected this article because test-driven development piqued my interest after I had more time to experiment with it. This article grabbed my attention specifically because it didn’t just reiterate the concept of Test Driven Development over and over. Another quite useful part of this article is its inclusion of real examples of TDD by the author.

The content of this article was clear cut and organized, and even though it may not have been a ton of new information, it was a different perspective comparing test-driven development and code-driven tests. I learned that generally TDD is more effective at producing well-implemented code than simply writing the method first and tests later. Seeing as we are continuing to learn TDD, I’m confident that I’ll be able to use this in my future projects/jobs if necessary. Or, I could suggest it to my team if we are struggling with writing tests after code.

From the blog CS@Worcester – Josh's Coding Journey by joshuafife and used with permission of the author. All other rights reserved by the author.

Unraveling the Efficiency of Pairwise and Combinatorial Testing in Software Development (Week-11)

In the dynamic landscape of software development, ensuring the reliability and functionality of applications is paramount. Traditional testing methods, while thorough, often require substantial time and resources, prompting the industry to lean towards more efficient strategies. Among these, Pairwise and Combinatorial Testing have emerged as pivotal techniques, providing a balance between testing depth and resource allocation.

Pairwise Testing: A Closer Look

Pairwise testing, a subset of combinatorial testing, operates on a principle that most defects in software are triggered by interactions between pairs of input parameters. This method systematically generates test cases to cover all possible pairs of inputs, significantly reducing the number of tests needed to identify potential bugs. According to Capers Jones, a luminary in software engineering, pairwise testing can detect up to 75% of defects, presenting a compelling case for its adoption (Jones, 2008). This efficiency stems from the recognition that not all input combinations are necessary to uncover the majority of the issues, thus optimizing the testing process.

Combinatorial Testing: Expanding the Horizon

Combinatorial testing extends the concept of pairwise testing by considering interactions among three or more parameters. This technique is particularly beneficial in complex systems where interactions extend beyond simple pairs. While it requires more test cases than pairwise testing, it’s still far less than the exhaustive testing of all possible inputs. The National Institute of Standards and Technology (NIST) has highlighted combinatorial testing’s effectiveness, noting its capability to uncover intricate bugs that pairwise might miss, making it an indispensable tool for ensuring software robustness (Kuhn et al., 2013).

Integrating Pairwise and Combinatorial Testing into Development

The integration of these testing methodologies into the software development lifecycle can significantly enhance the quality assurance process. By identifying the most impactful combinations of parameters, developers can preemptively address issues, leading to more stable releases. Tools such as PICT (Pairwise Independent Combinatorial Testing tool) from Microsoft and Hexawise facilitate the implementation of these strategies, enabling teams to automate test case generation and focus on critical test scenarios.

Conclusion

Pairwise and combinatorial testing represent a paradigm shift in software testing, moving away from exhaustive and resource-intensive methods towards a more strategic approach. By focusing on the interactions that most likely contribute to defects, these methodologies offer a practical pathway to improving software quality without the overhead of traditional testing techniques. As software systems grow in complexity, the adoption of pairwise and combinatorial testing is not just advisable but essential for developers aiming to deliver flawless applications efficiently.

The practicality and effectiveness of these testing strategies underscore a broader trend in software development towards optimization and efficiency. As we continue to push the boundaries of what software can achieve, the methodologies we employ to ensure their reliability must evolve accordingly. Pairwise and combinatorial testing stand at the forefront of modern software quality assurance.

References:

  • Jones, C. (2008). Applied Software Measurement. McGraw-Hill Education.
  • Kuhn, D. R., Kacker, R. N., & Lei, Y. (2013). Introduction to Combinatorial Testing. CRC Press.

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.

Intro to Software Testing

Software testing != doing homework bt rather, Software testing == checking homework to make sure it’s done right. In this blog we’ll explore the basics: what testing is, how it’s done, and why it’s important. We’ll cover different ways to test, how deep we go into testing, some smart ways to test, and why testing is worth it. Let’s dive in!

What is Software Testing?

Software testing is the process of verifying and validating whether a software or application is bug-free, meets technical requirements, and satisfies user needs. It ensures that the software functions as expected, identifying errors, faults, or missing requirements in contrast to actual specifications. This process aims to enhance efficiency, accuracy, and usability.

Verification and Validation

  1. Verification: Ensures that the software correctly implements specific functions, answering the question, “Are we building the product right?”
  2. Validation: Confirms that the built software aligns with customer requirements, answering the question, “Are we building the right product?”

Different Types of Software Testing

  1. Functional Testing: Validates whether the software functions according to functional requirements.
  2. Non-functional Testing: Assesses non-functional aspects like performance, scalability, and usability.
  3. Maintenance Testing: Involves modifying and updating software to meet evolving customer needs.

Further, testing can be performed manually or through automation, each with its own set of advantages and applications.

Different Types of Software Testing Techniques

  1. Black Box Testing: Conducted without accessing the source code, focusing on software interface.
  2. White Box Testing: Involves knowledge of internal workings and access to source code.
  3. Grey Box Testing: Blends aspects of both black and white box testing, providing testers with partial knowledge of the internal workings. This approach offers a balanced perspective, allowing for effective testing while maintaining a degree of independence from the code’s intricacies.

Additionally, Grey Box Testing combines elements of both approaches.

Different Levels of Software Testing

  1. Unit Testing: Evaluates individual units or components of the software.
  2. Integration Testing: Tests the interaction between integrated units.
  3. System Testing: Assesses the complete, integrated system or software.
  4. Acceptance Testing: Determines system acceptability based on business requirements.

Each level serves a distinct purpose in ensuring software reliability.

Best Practices for Software Testing

  • Continuous Testing: Test each build as it becomes available to reduce risks and improve functionality.
  • User Involvement: Engage users to understand their needs and perspectives during testing.
  • Test Segmentation: Divide tests into smaller parts for efficient analysis and resource utilization.
  • Metrics and Reporting: Track project metrics and share test results for improved collaboration and decision-making.
  • Regression Testing: Continuously validate the application to maintain its integrity.
  • Avoid Programmer Bias: Programmers should refrain from writing tests to maintain objectivity.
  • Service Virtualization: Simulate systems and services to reduce dependencies and start testing sooner.

Benefits of Software Testing

  • Product Quality: Ensures delivery of high-quality software by detecting and fixing errors early.
  • Customer Satisfaction: Identifies and resolves issues before delivery, enhancing user experience.
  • Cost-effectiveness: Saves time and money by detecting and fixing bugs in early stages.
  • Security: Protects software from internal and external security vulnerabilities.

Sources https://www.geeksforgeeks.org/software-testing-basics/

From the blog CS@Worcester – CS: Start to Finish by mrjfatal and used with permission of the author. All other rights reserved by the author.

Testing Gone Mobile

In another of my classes I am beginning to learn android mobile app development. This gave me a lot of interesting thoughts about how testing might look for mobile app development. As the applications are full-stack applications, and require testing of the back and front ends. I had questions like: “What would testing a front end look like? Simply applying it and clicking around?” and “How might we test back-end functions if they are intrinsically tied to the front-end?”. To find out more I looked on stickyminds, where I find most of my articles. I found an article about Testing Usability in Mobile app Development The title struck me as answering the first of my questions, so I chose to delve into it. The article’s title is Testing Usability for Mobile Applications by Mukesh Sharma.

The article provides an in-depth analysis of the pivotal role of usability in mobile applications. Usability has a profound impact on user engagement and app longevity, and this is something I can corroborate, as I have chosen apps with higher usability over similar apps with better quality and functions, but lesser usability. The article highlights specific usability characteristics: app simplicity to facilitate navigation effectively, helpful error handling mechanisms to guide users through troubleshooting and make it less of a hassle, optimizing efficiency to speed up tasks, and prioritizing user satisfaction to keep the app functional and supported by users. The article also delves into the nuanced focus areas for usability testing, including functionality assessments to verify feature completeness, contextual evaluations to tailor experiences to user preferences and test them against other preferences, rigorous device compatibility testing to ensure seamless performance across diverse models of mobile device and OS, examining in detail and scrutinizing data entry methods, and comprehensive examination of multimodality, to avoid user uncomfortability. The article uses an example of the Skype app to explain these potential problems. When moving the phone away from your ear, it would switch the speaker in your phone from the call speaker, to the loud back speaker. This is similar to the function in my Samsung Galaxybuds. When you take them out of your ear, it stops what’s playing or disconnects entirely. These are examples of uncomfortable features that have not been tested fairly. By adhering to the best practices for testing, developers can fix these issues in the testing phase, and assure no issues come from the software.

This applied extensively to several of my classes. I had been wondering how to think about tailoring mobile applications to the user, since learning about their development in one of my classes. This article has given extensive explanations into some poor features, and how to test to avoid these issues in the creation of the app. This will be very useful not only for mobile applications, but for testing full-stack applications as a whole, as the article covers mainly abstract ideas for testing full-stack applications.

Source:
https://www.stickyminds.com/article/testing-usability-mobile-applications

From the blog CS@Worcester – WSU CS Blog: Ben Gelineau by Ben Gelineau and used with permission of the author. All other rights reserved by the author.

Week 11

Deciding on a topic this week I decided to delve into Test Driven Development (TDD). I found an article with an engaging title “Test-Driven Development (TDD): A Time-Tested Recipe for Quality Software” by Ferdinando Santacroce. This would be very useful for me and the whole class because it’s fresh in our minds and we will continue to work with this concept. Getting a firmer grasp on this topic will help me with future assignments and homework. It’s always great to get an insider view with experience inside the field connecting it to what we learn in class.

This article begins with the history of TDD giving credit to Kent Beck one of the first “extreme programmers”. At the time nobody had ever reversed the idea of testing starting with a test instead of the actual code. The purpose of writing a test before the code would help programmers put them in the perspective of the maker making it easier to create the software. This would make more tunnel-focused code with much more simplicity because of just focusing on the test. Plus the codes get rapid feedback because all the tests have been made. TDD has the fastest feedback loop only surpassed by pair programing. Currently, TDD is widespread inside the field and several teams utilize it day to day. It’s hard to adapt to this type of coding scheme but with time it is proven to be a key to success. Minor grievances may also come up because this type of process can be too rigid or the lack of tools.  

After reading this article getting a glimpse into the history of how this came to be. It didn’t specifically specify when it started but I assume it was around the 90s because it mentions how common it is now. Understanding the benefits of doing this test answers my question why would you decide to do your coding process in reverse? What we have been learning is that it will be conventional to have code and then write the test connected to the already processed code. The benefits of cutting down time because of the faster feedback times and leading to less complicated code, I now understand its purpose. That is a recurring theme with code the simpler the better because you are never working alone. Maybe it is a self-contained project but your future self may not understand your complex code and updates to the code should be easy to do not a headache. 

https://semaphoreci.com/blog/test-driven-development

From the blog cs-wsu – DCO by dcastillo360 and used with permission of the author. All other rights reserved by the author.

Retreat into Competence

This week I decided to write about the pattern called “Retreat into Competence”. This pattern discusses the common occurrence of feeling out of your depth and what you should do about it. In the past couple of months,  I have been confronted with the depths of my lack of knowledge and realized just how overwhelming it can be. It is for this reason that I chose to read about the suggested solutions for this pattern.

The solution provided for this issue is to retreat into your knowledge to regain composure and then “then launch forward like a stone from a catapult”. This method will allow you to realize how far you’ve come and recognize what you are capable of. You need to overcome your fear of incompetence to grow. I agree with the statement that “sometimes you need to take one step back in order to take two steps forward” and how it is important to focus on moving forward as quickly as possible. It took me some time to reflect on this solution but I think this is because if you don’t force yourself to focus on moving forward you can get stuck by being too comfortable. 

For the most part, I agree with the text. It is definitely a risky solution because it is important that you recognize that it is only a temporary fix. You need to be honest with yourself and have discipline to stick to a time limit as suggested in the last paragraph. Although this is a good solution for certain situations and/or certain types of people, sometimes I think you just need to throw yourself into learning the new material. In the recent projects I worked on where I realized the extent of my ignorance, I decided to dive right into some resources to help me learn. I was working with tight deadlines and had to learn as much as I could to be a useful team member. Regardless of this fact, the core of this section gets one thing right, to do anything you must first tackle your fear of incompetence and inadequacy. Although my first solution is to dive into new material, I may come across a situation where it will be more helpful to take 2 steps back. This solution was definitely interesting to read about because it is very different from my usual approach.

From the blog CS@Worcester – Live Laugh Code by Shamarah Ramirez and used with permission of the author. All other rights reserved by the author.

Test Driven Development

Test driven development is an important method of developing which is based on first writing a test for what you want your program to do, this test will fail as you do not have any code written in orde for the test to pass but you then write the code which is necessary for the test to pass and then you continue repeating this process of writing a test then writing the code for said test to pass. You are encouraged to write the simplest possible code in order to make your test pass before moving on to the next test but you may need to do some refactoring between tests in order to ensure you do not have unused code, confusing methods or variables, etc. Test driven development is very helpful when it comes to testing the specifications of a system as you can write simple unit tests which would pass if a specification was met and when it fails you know that you still must add or change your code in order to make sure the specification was met for the end product. Other types of testing are also important to perform but test driven development can help you steer away from over complicated code and make sure that you do not have recurring duplication present when you regularly refactor between cycles.

I found this article to be particularly helpful when researching test driven development as it clearly breaks down the steps of test driven development in order for the reader to fully understand the process you must go through in order to follow this development method. Along with the thoroughly explained process this article also compares and shows how both acceptance test driven development and developer test driven development work together. As we just started working with test driven development in class I found this article to provide valuable insight into the definition and process of this testing/development model as it is something rather different compared to what we have worked on previously regarding testing as we usually have worked with code that needed tests written and not with tests that needed code to be written. Being new to TDD made it seem very confusing at first as it did not feel right to be writing the tests for code which did not even exist yet but the benefits of TDD are much easier to understand once you put this method into practice.

From the blog CS@Worcester – Dylan Brown Computer Science by dylanbrowncs and used with permission of the author. All other rights reserved by the author.

Test-Driven Development

For this week’s blog, I decided to find a blog that discusses test-driven development (TDD). I found a blog called “Test Driven Development is the best thing that has happened to software design” by Arek Torczuk. In this blog, the author walks through how they apply key elements through real examples. Throughout the blog, they explain their reasons for implementing TDD and walk through how to use TDD on code that is impossible to test. They split their explanation of how to test impossible code into small sections that include bits of example code to aid in the explanation. I found the organization of the blog along with the various examples to be particularly helpful in aiding the reader understand the topic and stay engaged.

The author first explains that TDD is implemented in a fail, pass, refactor cycle approach. They shorten the idea by explaining that “our focus remains on the ‘what’, and our knowledge of ‘how’ is postponed.” In this section, the author also provides a visual which I find to be effective in blatantly pointing out the important details of this section. They then go on to explain the differences between when tests are driven by code and when code is driven by tests. When tests are driven by code although the tests written for the code may pass it may not be the right approach as feedback about implementation and design may be lacking. There are 2 questions that one has to ask themselves when they take this approach: “When should I stop adding new tests?” And “Am I sure the implementation is finished?”. The latter approach (when code is driven by tests) forces you to ask yourself “What do I expect from the code?”. When code is driven by tests, you know when to stop. TDD provides fast feedback.

The various examples of code that are impossible to test were interesting to read through. One example I found fascinating was the “Bloated setup” and the “Mocking Hell” scenarios. The first scenario is where an object either has too many dependencies or the Single Responsibility principle has been broken. The author explained that in this case you should you should rethink your design. The latter is where a mock returns a mock that returns a mock.

Overall, I think this was an interesting read. I think reading through the various examples of how to test impossible code will be useful for the future as I will have to think through how to test different kinds of code and when I should rethink certain designs.

From the blog CS@Worcester – Live Laugh Code by Shamarah Ramirez and used with permission of the author. All other rights reserved by the author.

‘Sweeping the Floor’ Pattern

The ‘sweeping the floor’ pattern in chapter four pertains directly to the beginnings of an apprenticeship or just work in software in general. This pattern explains that when you first begin the process of working in software while you will not be nearly as knowledgeable or efficient as the other members of your team with more experience you will still be able to contribute in smaller or more simple ways in order to still provide assistance and work with your team as you learn how to do more technical tasks. This strategy can be applied in every field as when you start your career or even when you start a part time job in high school you first have to be taught how to do certain tasks in the correct way but while you learn how to do the more complicated tasks correctly you will still be able to put effort into making tasks easier for others who are already able to do the more complicated tasks that come with your job.

This pattern stood out to me as I believe that this is especially important to remember when you are entering any job or looking to start your career after college as the thought of ‘not knowing’ how to do the more technical tasks can be daunting for people at times as they see it as a massive obstacle you must overcome when in reality you are not expected to be able to do every task that more experienced team members are able to do. You are expected to contribute in any way you can to help your team work and provide insight while also remembering to continuously learn along the way in order to enable yourself to do these tasks in the future so that one day you are the ‘more experienced team member’ that someone looks to for guidance. Advice like this is important for college graduates that are just starting their careers as in most cases our first jobs will be learning experiences that we need to embrace and make the best of in order to further our understanding of both the field and our colleagues. 

From the blog CS@Worcester – Dylan Brown Computer Science by dylanbrowncs and used with permission of the author. All other rights reserved by the author.

Breakable Toys

Breakable toys are small programs you can develop and alter freely, without repercussions if something goes wrong. Often expecting something to go wrong as we learn more from our mistakes and successes. This freedom allows you to experiment and push your limits, creating an opportunity to further develop your knowledge in whatever program or system you are working with.

Reading this pattern has made me realize that almost everything I know about programming has been learned through breakable toys. I have always treated school assignments as breakable toys, with a deadline for no longer being broken. Trying to add features to the project that would force me to learn something new. Through trial and error and not just learning what works and what doesn’t but understanding why they do or don’t. Sometimes, revisiting old projects well past their due date to add features. My go-to breakable toy when learning a new language syntax has always been a decimal-to-binary calculator that can eventually support other bases.

Understanding how big of an impact breakable toys have had on my programming skills, I realize the importance of revisiting them along with making new ones to grow my toolbox. The reading provided a lot of good examples of breakable toys that I can work on and develop in the future. As someone who uses a wiki daily, I have never thought about developing my own until now, and as the reading suggests it would provide a lot of opportunities to develop new features as I go. Other important breakable toys will continue to appear as I learn more

Moving forward I am going to make sure I always have a breakable toy that I am working on and developing. To have many breakable toys at my disposal when it comes to solving problems in projects that do not have the luxury of being breakable. Getting ideas and inspiration for new breakable toys is going to be based on what skills I need to focus on. With those required for my profession at the forefront of the list of breakable toys I need to work on.

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