Category Archives: Week 10

Mockito: Complicated at First Glance, Simple in Concept

Mockito is a mocking framework. In his article Mocks aren’t Stubs, Martin Fowler mentions that Mocks allow for behavior verification, rather than state verification, which verifies values after method calls to confirm the proper behavior occurred. Behavior verification instead makes sure the proper behavior happened, by confirming the proper methods themselves were called.

So mocking is a means of setting expectations of method calls on a mock object, and then verifying that those method calls actually happen. But how does this apply to Mockito?

Mockito is a bit more comprehensive. It has mocks, stubs and spies. It has a lot of methods, and a few different philosophies on how it should be used. Should everything be mocked except the system under test? Should you mock types that you didn’t create? When is partial mocking ok? These are questions that are not simply answered and will likely have answers that evolve over time. But the takeaway is that there is a lot to Mockito.

The best way to learn how Mockito can be used is to look at examples. Mockito’s documentation is a good resource and describes many of the concepts. However, the examples are a bit simple and isolated. A Vogella tutorial on Mockito has many better examples that shows how you can use Mockito in actual production code.

Complicated behavior is where mocking comes in handy. Stubs are great for making sure simple methods are called within objects. But in complicated systems, there is a lot more going on that may affect the behavior of the object under test. A mock object can trick external classes into believing that the Mock object is doing real work, by providing expected return values when a method is called. Furthermore, you cannot always check the state of an object without modifying the class itself, making behavior verification the only means of testing.

Mockito is commonly used in Android mobile app testing, especially when Android was officially using Java. In a mobile environment, you are building an app on top of a complicated framework, and as such you may encounter problems, or at least complications, when trying to test. A common example is the Context object in Android. It provides necessary information about the environment in which code is being run. Android Fragments and Activities might need this context internally, but the behavior of the Fragments and Activities should not depend on the actual Context object. Another issue arises: how do you set up application context in a test environment? With Mockito, these complications are resolved by simply creating a Mock Context object in the test cases. If you rely on return values within a mock object, you can even tell Mockito what it needs to return when methods are called.

Mockito can be used in combination with other test methods, using as many or as few of its features as desired. Mocking is quite possibly a necessity when testing complicated systems, and at the very least powerful and convenient.

From the blog CS@Worcester – Inquiries and Queries by ausausdauer and used with permission of the author. All other rights reserved by the author.

A Different Type of Angles

I decided to learn more about angular since it peaked my interest in class and in general. in my search for more information on Angular, I found “Introduction to AngularJS” by GeeksForGeeks. This post explains the strengths and important things to know about Angular and some of the key features of Angular. some key points from the post are that its easy to use and requires little understanding of different coding languages like HTML, JavaScript, and CSS. Angular saves time as well and avoids unnecessary code. Angular is a powerful framework that allows the developer more control over their applications and web resources. Angular is also unit test ready which helps the developer even more in there processes of creating applications and resources. Angular has Data Binding which means that the developer does not need to continuously update the HTML file or create a special code to bind the data. This keeps data consistent and updated with the most recent version of an application or resource that the developer provides.
Angular seems to make web development easier than ever and gives people the templates and tools needed to create powerful and intuitive applications to suit their own needs. From my short experience with angular, i felt confident and powerful while using the framework and wasted less time than expected had i tried to create a web application without it. I felt in control and could see the real time changes that were occurring in my local website due to the changes I was making. Angular has been for sometime one of the three major frameworks for web developers and the other two are React and Vue. I’m unsure about the other too languages are better or worse or have advantages over Angular, but at this point in time Angular seems like a strong and good choice for my future with any type of web development. the one thing that i think makes angular so appealing to me and others is that the data is bonded and you don’t need to constantly change things to reflect one change in a web application or resource. This framework is something i could see myself using in the future or something like it for web development because it simplifies a larger more difficult job and allows people with enough information to traverse its power and harness that power to create powerful applications. I can’t wait to learn even more about Angular and how to use it effectively.
link to article referenced: https://www.geeksforgeeks.org/introduction-to-angularjs/

From the blog CS@Worcester – Tyler Quist’s CS Blog by Tyler Quist and used with permission of the author. All other rights reserved by the author.

The Single Responsibility Principle

Several weeks ago, we briefly discussed the SOLID design
principles in CS-343. This discussion was supposed to lead into a homework
assignment where we would research a couple of principles, but since this never
happened I decided to research a SOLID principle for a blog post instead. In
this post, I will be focusing on the Single Responsibility Principle, or SRP
(the ‘S’ in SOLID). This principle declares that a class should have only one
reason to change, or in other words, a single responsibility. It sounds like a
simple concept, but actually implementing it can be challenging. My research
into the SRP helped me come across a blog post by Patrick Smacchia titled “SOLID
Design: The Single Responsibility Principle (SRP),” which defines guidelines
that may help make the principle easier to follow.

The blog can be found here:

In the blog, Smacchia explains that the SRP is not as simple
to follow as it sounds, because different programmers may define a responsibility
or a reason to change in different ways. For this reason, he approaches
the principle based on its fundamental purpose of determining which logic
should be in which class. From this approach, he explains several aspects of
the SRP using example code, and he provides a set of concrete guidelines that
can help enforce the principle. I chose to share this post because Smacchia’s
approach to explaining the SRP has helped me understand it better by getting me
to think about it from a more fundamental perspective. I also think his
guidelines would be useful to any programmers, myself included, who intend on
following this principle in their projects.

I certainly intend on referring back to the guidelines
included in this blog to ensure that my future projects follow the SRP. Although
there are a couple I don’t fully understand, such as the one on POCO classes, I
think the others will greatly help me adhere to the SRP. His suggestion to keep
logic related to different functions separated into different classes makes
sense thanks to his Employee example, which I will refer back to when deciding
which functions should be separated into different classes. I found Smaccia’s
discussion on cohesion especially interesting because it exposed me to the Lack
of Cohesion Of Methods metric, or LCOM, which is used to actually quantify how
cohesive a class is. It surprised me that a more complex class can have a lower
LCOM score than a simpler one, and that a class’ simplicity does not represent
its adherence to the SRP. I will definitely refer back to this blog to help me
ensure that my own classes keep a low LCOM score even as they grown more
complex as a way to follow the SRP. I have certainly had issues with classes
getting too large and doing too many things in the past, and I think learning
more about the SRP from this blog will help me avoid this problem in the future.

From the blog CS@Worcester – Computer Science with Kyle Q by kylequad and used with permission of the author. All other rights reserved by the author.

Apps Made Easy With Angular

If you have ever been around anything web-based, there is a
good chance you have heard or come across angular. Angular for those unfamiliar
is a framework that allows for a wide range of possibilities. Angular all stems
from 4 main parts: components, dependency injection, property bindings and
typescript. Components are what Angular is entirely composed of. Most things
created in Angular are components or collection of components. While there are still
a few other concepts to angular, components are the most prominent. Components
are usually comprised of HTML, CSS and JS but with angular, these are all
combined into an easy to manipulate sense to allow for customization of the
components. The next part of angular is the dependency injection which helps
largely with dependency management. Dependencies are all in a collection together
and when new components are created, the dependency for that object is
automatically created and put into the collection alongside the other dependencies.
This allows for the user to easily streamline dependency management as angular
is able to “automatically” create and track dependencies. The next main aspect
of angular is the property bindings. What this means is that the data that the
app contains is separate from the what is being presented. This allows for the
user to make changes to this data and automatically have it update and be
displayed on the presentation side. This allows for the user to seamlessly update
anything needed in real time. The last part of angular is the support and use
of typescript. Javascript, for the ones unaware, is a subset of typescript.
Typescript allows for a very straight forward approach to writing javascript.
The user is able to write the code needed in typescript and it will be automatically
generated into javascript to be used by the app.

The main benefit of angular is allowing for users to easily
be able to build large scale apps with everything being self-contained in the program.
A lot of the complicated processes that went along with developing apps are now
very easy to be implemented with Angular. People that are not skilled in javascript
generally have a much easier time adapting typescript due to the fact that the syntax
is not all too different from java. Most skilled programmers are able to pickup
and implement typescript rather quickly. This allows for almost anyone to be
able to create and build large scale apps without having to personally be
responsible for many of the complications that would prevent people from trying.

If you want to learn more, this website has a great overview
of Angular:

https://www.telerik.com/blogs/all-things-angular

From the blog CS@Worcester – Journey Through Technology by krothermich and used with permission of the author. All other rights reserved by the author.

6 Weeks to Write 6 Blogs

Hello again my few readers, sorry I haven’t posted in a while but as you all know, I am a heavy procrastinator hence why I have 6 weeks to write 6 blogs in order to obtain an A in my class. Luckily, I am attending a presentation today so now I only have to write 5 blogs. Regardless, lets get this show on the road.

Today, I am going to talk about a blog with the title of “How Testers Can Become Agents of Change” Honestly, kind of a long title, but I don’t mind. The article is pretty short overall with 5 short sections. The first section is simple introduction to what the blog entry is going to be about. That is kind of like what I did for the first paragraph of this post. The author asks the reader to consider what they think is difficult at their job and how they will overcome said difficulty. Honestly, so far this sounds like one of those inspirational talks with some really outdated famous celebrity talking about how to be like them. This isn’t a bad thing, I just found that to be funny.

The post then explains how to identify opportunities for change. She mentions how there are three types of change: “Tool’s, processes, and people” (Norville) I assume this can mean that staff is always changing, methods are always changing, and tools are always changing which makes sense in a working environment. She says that anyone can bring change which sounds kind of cheesy, but I do like that because this shows that somebody like an Intern can bring about change. She then mentions a start, stop, continue model which is explained as the team discussing what they should stop doing, and what they should start doing. She uses an agile group as an example here and we learned about agile last semester.

Norville then talks about how to actually enact this change. This section is broken up into several subtopics which I think makes an article look cleaner and more organized. She tells the reader to know their audience in order to persuade them in the best way possible. She also says to fully understand the problem which is self explanatory. She describes the pitch as a way of presenting your information and evidence to the person you are trying to convince. This kind of follows the know your audience path. She also tells the reader to poke holes in the pitch. This is interesting because it is kind of exactly like testing where you try and break the code in order to ensure quality.

The last real paragraph is some tips that you can use in case you hit some bumps. The first of the tips is “Don’t Give Up” (This is in every inspirational post I swear). But regardless, it is true, even if you hit a bump along the way, you shouldn’t give up. The next tip is finding a team. This can be helpful with the knowing your audience part because everybody is different. She mentions learning from others successes, and I think this one is helpful because you can use methods that other people used to get your point across.

The actual last paragraph is just a closer telling the reader to start enacting change. I did enjoy this article, however this seems like an article that was directed at everyone rather than just testers. This isn’t a bad thing, but I would have liked to see more direct examples of how Software Testers can enact change. Overall this was a very well written blog. It was short and concise, and it was organized very well. I would recommend this article to anyone who is trying to make changes in their workplace, but they donf’t know how to start.

Making Software Quality a Critical Priority: How Testers Can Become Agents of Change

From the blog CS@Worcester – My Life in Comp Sci by Tyler Rego and used with permission of the author. All other rights reserved by the author.

GitHub and GitLab Issues

Week 9 started on Monday by dealing with the flagged GitHub accounts. As suggested by Dr. Wurst, I created a support ticket in the account and said that I was a student researcher testing out the GitHub platform for an open source project and if they could unflag the account and to contact Dr. Wurst if they had any questions about the project. I also included the issue of issue cards on project boards getting automatically removed by a spam filter. I copied this response for each one of the testing accounts so I ultimately filed 4 support tickets with GitHub. After that I tested out Dr. Jackson’s question about if shop managers on GitLab had the ability to manage their own subgroups if they are given owner permissions from the parent group owner. I tested this under the testing GitLab group by removing the shop manager account from the top-level group, creating a new shop subgroup, and adding the shop manager as the owner. This worked the way I thought it would and the shop manager was able to create subgroups within the shop subgroup and could add new members that weren’t in the parent GitLab group. I updated the GitHub issue card with confirming this finding. Then, I went on to read Dr. Jackson’s response to my earlier question of if it was still worth it to create documentation for GitLab Free based on his earlier response that GitLab Free doesn’t allow the creation of multiple issue boards and this would impact our use of the platform. Dr. Jackson’s detailed response included different ways of having workflows with the one issue board limit on GitLab Free. I ended up drawing some of these out on a whiteboard to visualize the concepts. I kind of like the concept of Dr. Jackson’s second option of having one board at the LFP level and that would be used by all of the shops. Although he says it is a disadvantage, right now I like the idea of all shops using one unified workflow as it makes documentation simpler and makes sure everyone is following the same steps to contribute to the projects. One question I have from this is how do the shop level boards look with this option or is it only just the one board in the LFP group? I also listened to the podcast he recommend about why a company switched from GitHub to GitLab. I found it pretty interesting and what they were saying mostly goes along with the differences I have found between the two services. I did like hearing from the perspective of someone who has a self-hosted instance of GitLab as this hasn’t been something I have been looking into but was interested in how this worked. Finally, Monday finished with discovering that our GitLab Gold membership wasn’t renewed properly and that we don’t have the Gold features available to us currently. This is a pretty big issue as it limits what I am able to test to just GitLab Free features. I emailed Dr. Wurst about this and he submitted a support ticket. 

For the rest of the week I checked to see if the GitLab Gold or the GitHub support tickets were updated. On Sunday I got a response from GitHub support to all of the support tickets saying that having multiple user accounts was against their terms of service and that they would remain flagged. I emailed Dr. Wurst about this and he would contact GitHub Education to see if there was anything they could do to help us. The GitLab Gold membership still hadn’t been fixed yet at this point. After looking at those, I went back to the diagrams I had been working on the previous week. I updated some of the GitLab diagrams to be consistent and fix an issue that it looked like the shop manager had to add themselves to a group which they don’t have to do. I then looked at some of the other documents in the community section of the LFP organization on GitHub to see how Dr. Jackson had formatted the other documents and what information to include. One thing I have a question on is what is the DCO and do I need to sign off on this for the commits I will be making to the project? Another is what to include for the licensing information at the bottom of the document? I then looked at the question Dr. Jackson had about if GitLab had an equivalent to the GitHub Probot framework for creating and using bots across the service. I found that although it seems possible to create bots on GitLab, they don’t seem to have a framework yet like GitHub does. 

Week 10 was short. On Monday I looked at the email response from GitHub Education regarding the multiple testing accounts. I found their response to be unhelpful to our situation and that their education features weren’t what we are looking for in testing permissions and project configurations for LFP. I took a quick look at the new website that Dr. Wurst created for LFP and how it currently links to the GitHub organization. I also read some of the principles listed on the LFP GitHub Community section like the Agile principles and the “FOSSisms“. I found the FOSSisms to be particularly interesting to read about with the process of contributing and working in open source projects, especially with how to get started with contributing to an open source project since that’s what I have been learning with this project. 

From the blog CS@Worcester – Chris' Computer Science Blog by cradkowski and used with permission of the author. All other rights reserved by the author.

Find Mentors

Hi everyone and welcome to another apprenticeship pattern blog post. Today apprenticeship blog post is going to about find mentors which I think is important because I’m doing the same thing in my new internship. I realize when you new to your craft or job it’s important because to always ask a question and help when needed and there should be someone you can count on. I agree with this pattern because when working and you come across a problem and have no idea how to fix it, you will need guidance and that will be your mentor. I think the best way to learn is to listen to those who have to be there before. I also agree that everyone will always find a mentor because I think there always someone that is willing to help anyone new that needs help. There might even be more than one mentors that will supervise an apprentice for example in the new job I have many people helping when I have trouble with a problem. I also agree that real-world apprentices have to scratch and claw their way into the lives of master craftsmen and are grateful for whatever attention they can get because I think that some mentors don’t if you want to learn or not so I think it always best to ask question and try to shadow the mentors as much as possible. I agree that when finding a mentor, you shouldn’t expect the mentor to know everything because no one does, and you are still walking the long road too. I like how the actions give a good tip on finding a mentor because it’s important to find the right one especially one the is patient with you. All in all, I think this apprenticeship pattern find a mentor is helpful and important. I know when I first started my job, I was looking for a mentor to help me when needed and I lucky to have a few that is patients with me. I feel like it was really important because I don’t think I can progress fast without taking the knowledge of others.

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

Use Your Title

Hi my readers. Welcome back to my blog.  In this blog post I am going to talk about an interesting pattern called “Use Your Title”.

Most us, who have worked in big companies and most of you who will in the future, are gonna have a FANCY title at your job. Sometimes even the person itself will get confused by its own title as at the beginning might not describe well what it means.

The best advice given by the authors for this pattern is: “Don’t allow your title to affect you! & Don’t be fooled by an impressive title!” It happens a lot nowadays that people have to explain what they really do because not everyone is aware of what a job title might be and what are the duties and responsibilities. There are also a lot of other cases where people misinterpret the job titles. My job title in my company is Support Engineer. and when some people would hear the name Support they automatically told me ” So you like talking on the phone with customer huh?!” That’s where I had to explain what my real position was and what was I actually doing. As I come from Albania, at the beginning I used to ‘blame’ on the company for giving me this title, but later on I realized it was the people who were to blame.

As you might know by now, I am graduating this May with a major in Computer Science and Software Development concentration. While having a conversation at my office with my teammates we all agreed that our titles were a bit too much as we hadn’t graduated as Engineers but developers. However, we all like using the fancy title.

The other side of the coin is where you have such a high job position and your job title doesn’t fully express much about it until you say what you actually do.

In both cases, the most important thing is to explain what you do with your own words and not the title, fancy or not. It is always good to have a written definition of what you do and what your duties are as you might never know who you might come across to.

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

Sprint 4 Retrospective

This past sprint flew by. We did manage to get some work done, although perhaps not quite as much as I would have liked. Still, it was a valuable sprint and we learned quite a bit during it.

Since the last review, we solidified the workflow through which we’re going to be contributing to the project. For each task, we’re going to be creating a branch. Then, after committing it the new branch, we’re going to be creating a pull request for it that we’ll use for development. As we commit, the commit history will appear on the pull request in our GitHub repository, and the progress of the component can be commented on and tracked by others. Once the component is done, we’ll leave a comment saying so, and then it will be be reviewed and pulled into the main branch.

There was a bit of a hold up for some time because we are required to use Google’s Angular Material Design were struggling to identify exactly where to find that. We didn’t entirely realize that the Angular Material Design library was exactly that. Once we did though, we updated the master branch so that all future branches would have compatibility with Angular Material. Our group in particular had already made a branch called Questionnaire-Form before we got it working with Material Design, so we elected to delete this branch and create a new one, named Q-Form.

Also, from what I’ve heard, our back-end plan is currently not going as anticipated. In the beginning, we had plans to either use mocking or to create a server with fake information that we could draw upon. Then, last sprint, we had established that we were going to be using mocking and tying that in to different services that our front end components needed to use. However, it seems as though we don’t fully understand how the back end is currently implemented, and it’s something that we’ll likely need our professor to look even further into before we dive in.

If I could change one thing about how this work has been going, it would definitely be to do more work more often. Currently I think it should be entirely possible to be finishing components almost weekly, and it seems as though no one in the class has been doing that. At least, they haven’t been pushed to the master branch if there has been significant work. However, hold ups with sorting out the development environment and getting material design to function have been a major slow-down, so it is understandable that things haven’t been getting done as fast as we had anticipated.

Going forward, we’re looking to make sure that our new form component on our Q-Form branch works exactly how the Angular Material Form component is designed to work. Right now we have it functioning how it should, with an input field and a submit button, however we’re struggling to get it styled in the exact way that Angular Material is meant to be. Once we cross that hurdle, it’ll be far easier to get components finished, committed, and merged into the master branch.

On to the next one!

From the blog CS@Worcester – James Blash by jwblash and used with permission of the author. All other rights reserved by the author.

“Expose Your Ignorance” Apprenticeship Pattern

I am writing this blog post about the “Expose Your Ignorance” apprenticeship pattern from the Apprenticeship Patterns book. To summarize the idea of this pattern, it is about making known what it is that you do not know in order to learn. People have a tendency of wanting to appear competent and knowledgeable about any job that is expected of them, but faking expertise is counterproductive. It is more helpful to seek knowledge than it is to hide ignorance. I have been looking at job descriptions lately, and many of them are filled with expectations and preferences referring to things I have never worked with before or have minimal experience with. My aptitude is for algorithms and data structures; I have studied and developed and implemented them a lot, for years. When it comes to “technologies”, though, I do not know anything about software development. There are so many languages and frameworks and libraries and acronyms that I am not familiar with because they have never been necessary or relevant before, and now I see that a lot of jobs are expecting proficiency with these tools. I am used to solving problems without extra tools, so in order to work in a new environment where an unfamiliar tool is necessary, it is important to establish that I do not know how to do anything using the tool. Then, I can begin to ask questions and learn how to apply my skills to the new problem. During the CAPSTONE project this semester, for instance, I am required to work with the Angular framework, and a tool for making things with Angular. I have no practical experience with any of these things, so whenever I need to know something in particular, I put out a question, so then I can learn. Rather than going off and trying to learn how to use these utilities, it is much more efficient to begin by seeing whether anybody else around already has an answer. Sharing knowledge and asking questions is a much more practical way to learn about how to work in a new environment.

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