CoffeeScript: a TDD example

CoffeeScript is a language building an abstraction over JavaScript (as the similar name suggests.) It is an abstraction over the syntax of JavaScript, not over its concepts: the language is still based on functions as objects which may bind to other objects, and prototypical inheritance.

CoffeeScript favors the best practices of JavaScript by transforming abstractions you would have written anyway, or borrowed from a framework, into language concepts for maximum conciseness. It has a compilation step - as every language must compile to a lower-level one, like C or Java.

Automated Accessibility Testing

As more and more companies focus on making their apps accessible, a question that often comes up is "How do we make sure we don't let things slip?" We've done all this work to remediate our app, but how do we make sure we don't dig ourselves back into a hole six months later and end up in a similar situation that we are in now? How do we keep things accessible?

There are a few solutions. The first is education and training. Everyone in the company needs to be an accessibility advocate and understand accessibility best practices. The second is better organizational processes. Companies should include accessibility audits in natural checkpoints throughout the software development lifecycle, like when UX provides design mockups to the engineering team or when the engineering team is code complete on a new feature. The third is automated testing, and that's what I'd like to focus on today.

Design Insights From Unit Testing

Probably the biggest breakthrough while Unit Testing is to realize that writing tests offer priceless feedback about the design of your production code. This feedback goes from suggesting immediate obvious improvements, up to hints about some of the most advanced design principles in software engineering. This article briefly enumerates these hints, pointing to questions to ask about your design. 

Disclaimer: Don't follow blindly these hints, but make sure you understand all of them so that you can decide in your real problem what would improve the design, and what wouldn't.

End-to-End Debug Object Modeling – First Hard Problem in Building DDTJ: Day 4

Yesterday I got the second PR out of the door (and the 3rd although that was automated). Today wasn't as productive.

Winter just started in full force around these parts, and yesterday, everything was flooded. This slowed down some of my work, especially after my son's kindergarten was flooded and he had to stay home. Still, I could make progress thanks to the fact that the code now runs end to end. That means I can start debugging the whole thing by using the command line and setting a breakpoint in the backend. Very convenient.

Building High-Quality Software

I have interviewed many engineers and managers lately, and one of the standard questions I ask is how to build high-quality software. Of course, I provide more context and explanations, but the gist is the same. I heard all kinds of answers. However, I was puzzled that almost none were systematic, and people immediately went into a specific pet peeve. As part of this exercise, I felt that I had to crystalize my answer to this question and write it down.

Let me start with high-level thoughts (specifically to make it systematic). First of all, I want to concentrate on software code quality (vs. larger topics, including problem definition, documentation, UX, design, etc.). High-quality software is software that has fewer bugs (and a shorter tail of fixing remaining issues). There are a bunch of other things like code readability, maintainability, debugability, and so on which can easily be swept under the quality umbrella. Let’s concentrate on the core that the product operates as expected.

CockroachDB TIL: Volume 1

This is a new series of articles covering short "Today I Learned" topics as I peel the layers of CockroachDB. This is meant to resemble release notes. I decided to mix it up with the format for these posts as they may not justify an entire blog.  Link here for past articles.

Topics

Topic 1: Unit Testing With CockroachDB

I get this question a lot:  "What is the best way to unit test CockroachDB as part of application development?"  Depending on the use case, there are several approaches we can take.  There is a venerable [cockroach demo](https://www.cockroachlabs.com/docs/stable/cockroach-demo.html), which has been my trusty go-to tool when I needed something in a hurry.  It comes with a one-hour license for enterprise features, which you can also unit test, but it also comes with certain limitations. For example, there is reported latency at table creation, ports until recently were random and not configurable, and by default it loads data which you can also overcome with a flag. The goal for cockroach demo is to quickly spin up a working environment for demo purposes and not necessarily something designed for unit testing.

Simple Code: Integration Tests

An integration test is something that tests a functionality that is dependant on an external system e.g. a database, HTTP API, or message queue.

Integration vs Unit Tests

The line is thin in my opinion. The integration part can be faked, or embedded services can be used in place of the actual integration point, and with these solutions, the interaction with the external system is bounded in the test context and the tests can be executed in isolation so they are very much like unit tests. 

E2E Testing with React, Jest, and the TestProject JavaScript OpenSDK

With a long list of end-to-end (e2e) test frameworks available to choose from, it’s hard to know which one you should be using. Cypress and Selenium are leading the market as the most widely used options, but there’s also Appium for mobile app testing, Puppeteer for automating tasks in Chrome, and Protractor for Angular and AngularJS applications, just to name a few.

Recently a newcomer has joined the pack: TestProject, a free, open-source test automation platform for e2e testing that helps simplify web, mobile, and API testing. The TestProject SDK has language support for Java, C#, Python, and, most recently, JavaScript.

Testing With Scala: Library Landscape

If you are confused by the variety of test libraries in the Scala ecosystem like me, then this is the article for you.

In this article, I'd like to do a quick tour of Scala frameworks and libs and show the capabilities of each of them on the same example to compare their approaches and how the final test will look at a very high level.

The Problem With Annotation Processors

For reasons unknown, broaching the subject of annotation processors seems to elicit some primordial fear in developers. People tend to associate annotation processing with borderline witchcraft and sorcery performable only by the most adept of basement wizards. It doesn’t have to be that way. Annotation processing doesn’t have to be the big scary monster hiding under the bed.

Monster Under the Bed
Image taken from https://sourcesofinsight.com/monsters-under-the-bed/


JavaScript Unit Testing

This is the 10th article documenting what I’ve learned from a series of 13 Trailhead Live video sessions on Modern App Development on Salesforce and Heroku. In these articles, we’re focusing on how to combine Salesforce with Heroku to build an “eCars” app—a sales and service application for a fictitious electric car company (“Pulsar”) that allows users to customize and buy cars, service techs to view live diagnostic info from the car, and more. In case you missed my previous article, you can find the link here.

Just as a quick reminder: I’ve been following this Trailhead Live video series to brush up and stay current on the latest app development trends on these platforms that are key for my career and business. I’ll be sharing each step for building the app, what I’ve learned, and my thoughts from each session. These series reviews are both for my own edification as well as for others who might benefit from this content.

Java: Unit Testing Private Methods

Introduction

In this article, I will contemplate the testing of private methods in unit tests. After that, I will propose a way or pattern to do it, if you must. Finally, I will show how you can generate this pattern automatically.

And yes, I will also write a takeaway section to know what you have read.

Unit Testing Void Methods with Mockito and JUnit

Writing functionality is the main focus whenever we are writing a software program, but it is equally important that we make sure our code works the way we intended it to. And how do we do that? By writing unit test cases. They are used to test the smallest functionality of code. Unit test cases are an essential part of software development. In this blog, we are going to cover one of the testing scenarios and unit test cases for void methods.

How to Test Void Methods 

As we already know that our aim is to test void methods in a class. But it is also really important to understand why we test void methods. 

Java Annotated Monthly – September 2020

September’s here, and that means back to work, back to school. Or not. It feels like the world is applying a lot of wishful thinking and behaving as if everything is going back to normal. With so much uncertainty right now, it’s a tempting approach for sure.

Anyway this is supposed to be about Java. This month we have another huge edition for you, and it includes the inevitable look at Java 15, a bunch of news about Java 16, articles and videos on testing, Java / Jakarta EE, and Java libraries.

Unit Testing Xamarin Forms View Model

In this tutorial, we are going to see how to unit test a view model in a Xamarin Forms application.

View Model in a Nutshell

The view model is the centerpiece of the Model-View-ViewModel pattern. When you're not using MVVM, your presentation logic is in the view (code behind), making harder to test because the logic is coupled to UI elements. On the other hand, when using MVVM, your presentation logic move into the view model, by decoupling logic from the view, you gain the ability to test logic without being bothered by UI elements.

Getting Started

To walk you through this tutorial, I created a Xamarin Forms app called WorkoutTube.

Software Unit Testing: What Is That? Why Is it Important?

Software Unit Testing: What Is It? Why Is It Important?

It is hard to overestimate the importance of software quality. A single error can have a huge negative impact on your entire business. If bug issues are not addressed efficiently, it may result in everything from an endless cycle of fixes to a destroyed reputation of your company. Effective testing strategies help to minimize such risks by ensuring the quality of the released product. There are many testing practices you can choose to build a great software solution. One of the basic but effective testing techniques to make sure that your product works properly is called unit testing.

What Is Unit Testing and What Are the Unit Testing Frameworks?

Unit testing (sometimes called module testing or component testing) is a technique for testing the smallest testable component of your code (unit) to ensure that it performs as intended. The basic feature of unit testing is the isolation – a unit test only performs a specific function and excludes all external influences, such as dependencies between units, calls to other functions, etc The unit testing process can be done manually, but developers usually use unit testing tools to facilitate the process, so they can focus on more complex tasks such as defining the test cases.