Category Archives: Week 10

Customer and Enterprise: Why is one valued over the other

Photo by Anna Nekrashevich on Pexels.com

Hello, Debug Ducker here and have you ever thought how low quality a software you use feels, despite being made by a well known company. This is how I feel when it comes to videos games.

It was a thought that came to me during class when a professor said, if a company release buggy untested software that may ruin the companies reputation. A student ask well what makes the game industry different then. For those in the know the game industry has been plagued with the problem or releasing products in a buggy or half-finished state, that they expect the consumer to buy.

You would think after years of doing such thing, game development companies would be careful about development. Many gamers have criticized this on going problem within the industry and some gaming companies are seen in a poor light, though such reputation never seems to completely ruined them, it does make them less trustworthy. So why are video games different in terms of software testing.

This question kept bothering me, and I brought this up with a friend who may know more. He states that it is because that the consumer is not the most important person to disappoint, that in the software testing field the one who you don’t want to give a poor product or low quality product would be a company or a business. As they aren’t the average customer and have a lot more money to spend.

This is where I did a bit more digging and found out a lot of interesting things when it comes to making a product for the average consumer and making one for a company.

There is a lot of money making a product for a company. The graph from Dells revenue throughout the years showcase how much money can be made in enterprise products

As you can see the commercial products, which are products businesses themselves purchase make most of dell revenue compared to the average consumer. In a way I can see them being prioritized when it comes to reputation, you don’t want to have bad relations with the ones bring in the money.

There is possibly a more logical than financial answer to the question. Consumers are the common people and there are a lot of them. They may have different reactions to the product but since they are so many, there will always be someone willing to buy a product despite the quality. Then comes the company who probably needs the product to do a services and would prefer it thoroughly tested before getting it.

With this I can understand a little of why it is so important to test products in software testing especially when it comes to businesses. We need them for their continued support and they bring in a lot of money.

Admin. “Dell Statistics 2024 by User and Revenue.” KMA Solutions, 22 Apr. 2024, http://www.kma.ie/dell-statistics-2024-by-user-and-revenue/.

From the blog CS@Worcester – Debug Duck by debugducker and used with permission of the author. All other rights reserved by the author.

Different Types Of Behavioral Unit

Hello everyone,

The topic of this week’s blog will be about Behavioral Testing. Testing your code is one of the most important things every programmer has to master in their professional career. There are many many ways to test your code, and each niche technique focuses and works differently for specific purposes. Some can be similar enough compared to each other but different enough so they can be separated, and what we will focus on today will be about the “Different Types Of Behavioral Unit” As the name suggests, Behavioral Testing focuses more on how your code behaves rather than how it is written. While it may sound plain and simple, this type of testing has a lot of different ways programmers can use to test their code.

The first one you always start with is the “Happy Path Tests”, which basically checks if everything is working the way it should. The first goal each time you work on a project is to make sure that it runs and it outputs the wanted results, and then after you try to see how it reacts when things get a bit more complicated. Next we have “Negative Tests” and you use this to see how the program reacts when bad inputs are entered on purpose. This is used to see if some specific features work, like entering the wrong password. If that happens the program should give you another chance to enter the password or guide you on how to make a new one. This makes the program more secure and trustworthy for all users. The next most common type of Behavioral Testing, is “Boundary Tests” which allows you to see how the code behaves when inputs outside of the wanted range are entered or it can also be used to check the limit and boundaries of the code. This helps out with scaling the program if things are predicted to go bigger, from the database, users etc. One of my favorite things about this blog is that it covers a lot of key aspects that everyone should know about Behavioral Testing. Some tips that I learnt from it is that when writing this type of test you need to test one behavior at a time. Trying to test two at the same time will just ruin the purpose of it. You should also be very clear and describe exactly what you are trying to test. Another good habit you can do is to simulate events, from successful ones to trying to break your code on purpose to see how well it behaves in all conditions.

In conclusion Behavioral Testing is important because you can not only check if there are errors in the code from early to end development but also helps you understand how it behaves in different scenarios which is so important to know, it helps you to understand better and indirectly makes debugging a lot easier.

Source:

https://keploy.io/blog/community/understanding-different-types-of-behavioral-unit-tests

From the blog Elio's Blog by Elio Ngjelo and used with permission of the author. All other rights reserved by the author.

Test-Driven Development: An efficient development process

Summary Of The Source

  1. The process of TDD: There are three main steps to the TDD process, including the “red phase”, where a test is written but expected to fail. The green phase where code is written, enough to make the test pass. Finally the refactoring phase that aims to improve the code in functionality and in design metrics.
  2. Benefits of TDD for software teams: TDD is an implementation of agile development, since there is constant feedback on the tests and the code being written for them. This makes it so that the teams are regularly communicating and on the same page for fulfilling the requirements. Other benefits as well such as lower long-term costs, documentation, etc.
  3. Best practices for TDD: Organize correctly, making sure that naming conventions specify which function is being tested. Create tests that are simple and target only one aspect to assess, this makes it easier to pinpoint failure in the code. 

Why I Chose This Resource

I chose this blog post in particular because it is very easy to read for someone who is new to this process, providing all the necessary information needed to really understand what it is and its benefits without too much technical jargon. 

Personal Reflection

I have learned in the past about the waterfall development process vs the agile process, and that agile was pretty much just better, both in terms of time and resources spent. This blog made me realize that TDD falls under the agile framework and that makes the development more responsive to change along the way. It personally seemed silly to me at first that the test would be written first, testing seemingly nothing and only being there to cause confusion, but now I understand that it acts as more of a set of restrictions that keep the code produced working correctly, kind of like a mold that the code has to fit to work. This approach actually seems very intuitive because of the constant feedback and the way the functionality is built around something that is tested to work. To me, there don’t really seem to be any glaring downsides to this form of development unless the team decides against it and has a more comfortable development process, which for them would work better. It’s a simple strategy but it seems very clean in its workflow and deployment. 

Future Application

After learning more about this process, I would like to work in an environment where this is practiced. It seems very intuitive and efficient and utilizing it would help me get a better personal feel for it. Developing around tests probably seems confining, but I think it does produce more correctly working code than the other way around.

Citation


CircleCI. (2020, August 11). What is test-driven development? Retrieved from https://circleci.com/blog/test-driven-development-tdd/

From the blog CS@Worcester – The Science of Computation by Adam Jacher and used with permission of the author. All other rights reserved by the author.

Why Boundary Testing is so Important

Boundary testing is an integral aspect of testing software used to test the extreme limits of a program. It consists of testing the minimum value, right above minimum, a nominal value, a maximum value, and right below maximum. If we’re using a strong testing method, we would also test below the minimum and above the maximum.

By testing this way, we can assure that the “boundaries” of the program work correctly as well as center of those boundaries. We can also ensure that invalid inputs return an invalid response from the program.

As Jayesh Karkar says in his blog “Everything You Need to Know About Boundary Value Testing”, “This testing is imperative when it comes to testing the functional competence of software modules.”

He mentions some factors that justify the necessity of boundary value testing. These include that functionality errors are likely to occur more often at boundaries, it only tests a small range of values making it simple to execute, and due to the testing being based on guidelines and framework there is no chance of compromising the boundary values which ensures maximum test effectiveness.

Now as most of us in the computer science field know, there are many ways of testing programs. Boundary value testing is just one of them. With this in mind, boundary value testing is certainly one you should keep in your “tool kit” and combine with other forms to create the most effective tests possible.

As I continue my career as a student and my future career as a computer scientist, I plan on taking this form of testing with me wherever I go as a fundamental.

From the blog CS@Worcester – DPCS Blog by Daniel Parker and used with permission of the author. All other rights reserved by the author.

Mocha, Chai, and Why

URL: TestoMat Mocha and Chai Web Application Testing
The chosen article walks us through the implementation and inner workings of two JavaScript testing tools. Mocha and Chai are two different testing tools that, when combined, form a powerful addition to any software development project. Mocha serves as a test runner, being responsible for executing the test suites. While Mocha can function independently and does not necessarily require any additional tools, combining it with Chai, an assertion library, allows for the validation of expected outcomes in test cases.

The blog post also provides us with several reasons why the utilization of both tools can help improve your software development speed and quality. Among the listed benefits are:

Mocha:

  • Flexible and customizable testing.
  • Simplifies the testing of asynchronous code.
  • The ability to apply before, beforeEach, after, and afterEach.
  • Runs tests in both browser and Node.js environments.

Chai:

  • Provides clear and expressive assertions that improve the readability of your test scripts.
  • Allows you to write descriptive tests using natural language constructions.
  • Enables the creation of custom assertions tailored to your specific testing requirements.
  • Supports assertions on complex data structures such as arrays, objects, etc.

At the end of the article, it presents an opportunity to implement Mocha with some real-world examples, which is great and especially helpful for anyone unfamiliar with the framework.

The reason I chose this article relates mainly to another class. I will be taking on the task of developing test suites for the Thea’s Pantry app. I also found it interesting because it explains why you would use both Mocha and Chai instead of using other tools or Mocha alone.

The content is helpful and does not seem to include any bias by presenting Mocha and Chai as the only testing environment for JavaScript. Instead, it highlights their pros and invites the reader to determine whether these tools will suit their specific use case. One thing that caught my attention about using Mocha is its ability to generate documentation through testing. This is great, as it will help me better understand how documentation related to testing is created and how useful it can be.

Mocha and Chai’s use of natural, human-like language makes testing much easier. The use of natural or human-like language in programming often makes me skeptical of such tools, libraries, or frameworks. Sometimes, this characteristic is marketed as a way to draw people in, as if it will help them code more effectively. Although Mocha and Chai are distinct tools, their implementation of this characteristic leans more toward improving readability for the programmer rather than for just anyone. What I mean by this is that they avoid technical or overly formal wording in favor of keywords that resemble everyday human language.

From the blog CS@Worcester – CS Today by Guilherme Salazar Almeida Nazareth and used with permission of the author. All other rights reserved by the author.

More About Mocks

This week in class, we took another deep dive into the world of test doubles. This week pertained to mocks specifically. While doing class activities related to mocks this week in class, it seemed to me that mocks are easier to use than stubs while offering more insight on how a program is supposed to run. With that in my mind, I took the opportunity to further learn about mocks. I ended up finding a blog that gave me an even better understanding about mocks, and it is called “Understanding Mock Objects in Software Testing: A Tale of Simulated Reality”.

One quote from the blog does a great job of summing up what mocks are. “It’s like a stand-in actor in a movie – the mock object behaves like the real one but is controlled within the testing environment.” Mocks mimic the actions of the object it replaces when called upon in a test class. Mocks check the order and frequency of method calls in which they are used, which stubs don’t do.

Frameworks

There are mocking frameworks for many different languages. Some common mock frameworks include Mockito in Java, Moq in .NET, and Jasmine in JavaScript. Mockito is popular for its simplicity. It does well to create mock objects for a certain class or database that simulates how a real object would respond in the program. Moq is primarily used for C# applications and is popular for its strong typing and fluent interface. A language with strong typing demands specification over data types, so variables must have a type when they are defined. Jasmine mocks HTTP requests, which allows front-end applications to be tested without back-end interactions.

Pros

Some of the benefits of using mocks is that they are used in a controlled and predictable environment, and they are efficient. Mocks give predetermined behaviors and don’t leave the testing framework, which leads to consistency and predictability. And since mocks are used in the place of real-world objects, the testing process is sped up. It allows testers to isolate external factors and focus solely on the code being tested. Mock testing is also a cheaper alternative to testing real-world objects that may be very expensive.

Cons

A drawback of mock testing is that while tests pass in the testing, they may not in real-world situations. And just like stubs, changes to the system can cause mocks to become outdated, so it is important that mocks are frequently provisioned in order kept up to date with any changes to the system being tested.

Example

In the example above Mockito is the framework being used. WeatherService represents the external dependency, and WeatherModule represents what is being tested. mockService should return “Sunny” when “New York” is the string in the .getWeather() method. This allows WeatherModule to be tested in isolation. module.getWeather() is then assigned to the string variable “weather”. From there, weather is tested for if it returns “Sunny”. This is fascinating because the tests compile and are ran using make-believe objects

Reference

https://www.thetesttribe.com/blog/mock-testing/

From the blog Blog del William by William Cordor and used with permission of the author. All other rights reserved by the author.

Use-Testing Graphs

In the previous week we spoke about Use-Testing which is a graph node with edges where the edges show the flow of the program, and the nodes are each line. These can be very big graphs if it is a large project but luckily, we can always shrink it down by taking out unnecessary nodes. This will also mean redirecting the edges correctly but after working with the full model it is much simpler to shrink it down. These graphs are called Decision to decision path graphs that reduce redundancy while keeping the important parts of the graphs still visible and with the flow of the program. These graphs go well with decision tables where it would be a True or False scenario with a “don’t care” option which can be used together with the path graph.

We also learned to define the paths by splitting the variables, defined at and used nodes into separate columns. This simplified things in order for us to assign the node number to the variable. For example, node 1 is numCells which is used in node 4 and 10, when we do this method, we can see where each variable is used at and therefore when we shrink our graphs, we know how to better organize it.

Overall, the use of the test cases helps us organize for test cases for the entire system. It helps us determine whether something is useful or not like an empty line can be counted as a node because the IDE is still going to check if there is code on that line, but for the final graph empty lines and else statements can be erased or shown as an edge. The graphs also help with noticing what we need for the test case not only what we do not need. This makes it easier to visualize the structure of the code while also easily being able to communicate what is required in order to make the test cases because the last thing anyone wants to do is write unnecessary test cases or and over abundant amount of test cases that should not be there.

Also, by using path testing you can easily visualize which node interacts with a certain edge or another node. If needed to explain to a team of engineers it will be easy and organized for anyone to look at while also having all the valid and important information that they need to create the test cases for the software.  I also learned about the cases that come along with these graphs which are cases 1-5 where case 1 is a node with no edge going into it which would always be the first node of the graph. Case 2 just does not go out to another node implying in some cases the last node. Case 3 would be an indegree greater than 2 and out degree greater than 2. Case 4 consists of 1 degree in and 1 degree out which is usually in variable declaration or in a sequential program. Case 5 is a single entry or single exit. These cases help to define the nodes further in-depth in order to dive deeper into the flow of the program.

Source: Software Testing – Use Case Testing | GeeksforGeeks

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

Week 10- Stubs and Mocks

During week 10, we experimented with stubs and mocks. Stubs and mocks are two forms of testing doubles that allow a team to write tests before the whole program has been written. Stubs and mocks simulate the code’s fleshed out methods and allow for testing methods to be written in advance. 

Stubs are methods or classes that are either empty or return a set value so they can run and be tested. Stubs are state testers and focus on testing the outcome of methods. Mocks are more dynamic, the test block can define what it wants the outcome of any method to be and then test for that outcome. It can also test for multiple set outcomes in the same block. Mocks are behavior testers and test the interactions between methods, rather than the outcome. 

The reference I found was a blog that compares and contrasts stubs and mocks by BairesDev to get a better idea of their use cases. They explained what stubs and mocks are, the advantages and disadvantages of each, and the situations to use both of them.

Advantages for stubs are their predictability and isolating the method. They will always return what you are expecting because of how simple they are. Since stubs do not involve any other calls or methods, they are great at isolating testing to just that method. Disadvantages are user error and the lack of behavior testing. The user might have a discrepancy in what they return in the stub and what they expect in the test. If your method needs to interact with other methods, stubs are not great for testing behavior because they only look at the outcome. 

Advantages for mocks are being better at testing subtle bugs and issues and testing the interactions between methods in your code. Since mocks are behavioral tests, if the methods don’t interact how they’re expected to, the test will not pass, which goes beyond what stubs do. Disadvantages are increased complexity and brittle tests. Mocks make your tests more complex than if you were testing the fully written code, which may take more time to adapt to once the program is finished. Brittle tests can occur if tests are too connected to the mock expectations, and small changes can cause a lot of errors. 

Overall, stubs are useful when testing independent methods and those that only need to be tested for the outcome. Mocks are useful when methods are dependent on others and can find errors that might not show up if you were just testing outcomes. Both are great when writing tests, but have different applications and both should be used when testing programs. 

Source: https://www.bairesdev.com/blog/stub-vs-mock/

From the blog CS@Worcester – ALIDA NORDQUIST by alidanordquist and used with permission of the author. All other rights reserved by the author.

Decision Table Testing

Decision table testing is a software testing  technique  that connects  inputs to  outputs. It  utilizes a structured table  for all possible test cases to be analyzed. A  condition represents  a variable or input that  impacts a process, and the action is the outcome influenced by a condition. Condition alternatives define all  possible values for a condition. Each row in  decision table testing is a connection between a  condition and action, with values typically  represented as true or false or yes or no. For instance testing a login system, the conditions are username and password. Action is a successful or  failed  login attempt. Switch table is classified as a type of decision table testing where  a single condition decides a design. A  traffic light system is an instance of decision table testing, with traffic light color being the condition. Action is cars  stopping or  continuing through traffic depending on traffic light color. In  rule based decision table, columns are actions and conditions, and the  row indicates if a condition and action  for a column match the condition and action for a rule.  Another type of decision based testing is a limited decision table. Limited decision tables have a simple and independent condition with an example of a login system. A  login attempt result  is known from a  username and password being correctly entered. Username and password are independent  conditions, as a system identifies username or password is correct, regardless of each other.

First step in creating a decision table is identifying the conditions. A login system will be used for an example. Conditions are valid   username or  password. Once the conditions are constructed, the next step is defining  possible condition alternatives. In a class activity, the conditions were gpa and credits. A condition with either  gpa or credits is allowed  multiple  values  such as gpa > 2.5  or gpa < 4.0. Once condition and condition alternatives have been created, the actions have to  be defined. The next step is setting up  rules for the decision table. After the rules have been set. The table should hold conditions, actions, rules, and condition alternatives. Table should be now filled. The last step to creating a decision table is identifying and deleting  repetitive rules. Prior to taking a software testing class, I had little knowledge on decision table testing. I choose this blog as a chance to expand my  understanding of decision testing. After reading the article, I have a better understanding of decision testing compared to my first learning decision testing.

article: https://www.browserstack.com/guide/decision-table

From the blog CS@Worcester – jonathan&#039;s computer journey by Jonathan Mujjumbi and used with permission of the author. All other rights reserved by the author.

Basis Path Testing in Software Testing

Software testing is a significant part of confirming the functionality, reliability, and performance of software products. Out of all the diverse types of tests, Basis Path Testing is one essential technique for confirming the control flow of a program. In this blog, we share the concept of Basis Path Testing, its importance, and how it is applied in software testing.

What is Basis Path Testing?
Basis Path Testing is a white-box testing method that focuses on software control flow. It was formulated by Thomas J. McCabe as a part of the Cyclomatic Complexity metric, which calculates the amount of linearly independent paths in a program’s control flow. The approach is designed to test the software by executing all the independent paths through the program at least once to provide complete coverage of the code.

The goal of Basis Path Testing is to locate all the potential paths within a program and ensure that each of them is tested for possible issues. It helps in determining logical defects that are not obvious through other testing techniques, such as functional or integration testing.

Key Elements of Basis Path Testing
Control Flow Graph: The first step in Basis Path Testing is to design a control flow graph (CFG) for the program. This graph represents the control structure of the program, including decision points, loops, and function calls.

Cyclomatic Complexity: The second step is to compute the cyclomatic complexity of the program, which is the number of independent paths. The metric is calculated as:
V(G) = e – n + 2*P

Where, e is number of edges, n is number of vertices, P is number of connected components.
The cyclomatic complexity provides the minimum number of test cases required to exercise all the independent paths.

Independent Paths: After calculating the cyclomatic complexity, the independent paths in the control flow graph must be determined. These are paths that don’t reuse any other path’s sequence of execution.

Test Case Design: Once independent paths are identified, test cases are created to execute each path such that all aspects of the program’s logic are exercised.

Importance of Basis Path Testing
Basis Path Testing is particularly useful in revealing intricate logical errors that can result due to intricate control flow. By carrying out all independent paths, it ensures that nothing in the program is left untreated, and this reduces the chances of undiscovered defects.

The approach is used widely in unit testing and integration testing, especially for programs with intricate decision structures and loops. It is also a good approach to use in regression testing, where changing the codebase can probably introduce flaws into previously tested paths.

Conclusion
Basis Path Testing is a highly valuable method for thorough testing of software using independent paths through the control flow of a program. By understanding and applying this method, software developers are able to improve the quality of applications, reduce errors, and deliver improved software to end-users.

Personal Reflection
Having studied Basis Path Testing, I can see how this approach is essential to checking the strength of software systems. As a computer science major, what I have learned from my studies is that testing is not just about checking if the code runs but, more importantly, that the logic and correctness of running are checked. Basis Path Testing’s focus on cyclomatic complexity provides a clear, mathematical way to ensure that all possible execution paths are considered.

My experience is that application of this technique detects logical flaws in programs which would otherwise not be easily seen through normal debugging or functional testing. 

Citation:
“Basis Path Testing in Software Testing.” GeeksforGeeks, https://www.geeksforgeeks.org/basis-path-testing-in-software-testing/.

From the blog Maria Delia by Maria Delia and used with permission of the author. All other rights reserved by the author.