DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

The Latest Testing, Tools, and Frameworks Topics

article thumbnail
Java Testing Complete Guide
In this article, we discuss nine of the most common types of application testing and review code samples and tools for each in Java.
Updated March 11, 2020
by Dmitry Egorov DZone Core CORE
· 58,989 Views · 38 Likes
article thumbnail
How to Migrate From JUnit 4 to JUnit 5 Step by Step
In this tutorial, we take a look at how you can create and migrate a basic Spring Boot application from JUnit 4 to the refreshed JUnit 5.
March 11, 2020
by Awkash Agrawal
· 49,493 Views · 4 Likes
article thumbnail
SpringBoot: Performance War
A closer look at SpringBoot and its role in performance.
Updated March 11, 2020
by Santhosh Krishnan
· 21,881 Views · 14 Likes
article thumbnail
Collecting Logs in Azure Databricks
This article demonstrates how you can use Azure Databricks with Spark to create and collect logs and Docker.
March 10, 2020
by Shubham Dangare
· 9,400 Views · 1 Like
article thumbnail
The Anatomy of a Microservice, One Service, Multiple Servers
It’s (finally) time to look at the API Server layer and expose the business service to the outside world.
March 10, 2020
by Ray Elenteny DZone Core CORE
· 17,036 Views · 5 Likes
article thumbnail
Deploying an Angular App to AWS S3
In this article, you'll create and deploy an Angular app to AWS S3 from scratch in less than five minutes Prerequisites
March 9, 2020
by Marouen Helali
· 31,464 Views · 6 Likes
article thumbnail
Defining Implementations of Services: Dependency Injection in Angular
I was working on a practical project using Angular 8, where I was creating a service and thinking more about how to implement SOLID principles. I decided to have an interface to define my service and a class to implement the logic. Everything was okay with that design, but a question came to my mind, "How can I implement dependency injection with my Angular component?" In this example, I am going to use an abstract class, Let's create an abstract class, named IGreetingsService. This will be used as an Interface with a greeting method. TypeScript x 1 export abstract class IGreetingsService { 2 constructor() { } 3 abstract greeting(): String; 4 } Now, let's create a class, GreetingsServiceImpl. This class implements the IGreetingsService abstract class. TypeScript xxxxxxxxxx 1 1 export class GreetingsServiceImpl implements IGreetingsService { 2 constructor() { } 3 greeting(): String{ 4 return "Pruebaa"; 5 }; 6 } At this point, we have a regular class to use as a service, but we need to add the annotation @Injectable. We have to put it at IGreetingsService. TypeScript x 10 1 @Injectable({ 2 providedIn: 'root', 3 useClass: GreetingsServiceImpl, 4 }) 5 export abstract class IGreetingsService { 6 7 constructor() { } 8 9 abstract greeting(): String; 10 } The magic is at the property useClass. This class is used by the Angular framework to know what concrete class has to use for dependency injection when you are using theIGreetingsService abstract class. So we are ready to use our service into an angular component. TypeScript xxxxxxxxxx 1 12 1 @Component({ 2 selector: 'my-app', 3 templateUrl: './app.component.html', 4 styleUrls: [ './app.component.css' ] 5 }) 6 export class AppComponent { 7 name: String; 8 constructor(private service: IGreetingsService ) { 9 this.name = this.service.greeting(); 10 } 11 12 } At the moment, to create an instance of the AppComponent, Angular automatically creates an instance of GreetingsServiceImpl , instead of IGreetingsService. (Remember IGreetingsService is an abstract class). This approach can help you in several situations; for example, think about a service using REST services to get some data, but now there is a new requirement, and you need to get the same data from session storage or local storage. You can create a new class implementing your abstract class and update the property useClass to refer to your new class. Another situation would be if you needed a different implementation on production environments and testing environments. You can find the complete source code here: https://stackblitz.com/edit/angular8-injectiondependency-interface. A final note, you can define a provider in the component definition annotation to inject a specific implementation of your service. TypeScript x 1 @Component({ 2 selector: 'my-app', 3 templateUrl: './app.component.html', 4 styleUrls: [ './app.component.css' ], 5 providers :[{ provide: IGreetingsService, useClass: GreetingsServiceImpl }] 6 }) Further Reading Angular: Everything You Need to Know [Tutorials]. About Dependency Injection.
March 9, 2020
by Javier Santos
· 9,428 Views · 4 Likes
article thumbnail
How to Test for Lock Table Consistency When Deploying High Availability for SAP ERP
In this article, see how to test for lock table consistency and create shared file systems when deploying high availability for SAP ERP.
March 6, 2020
by Harry Aujla
· 13,764 Views · 3 Likes
article thumbnail
Taming AWS Costs With Cost and Usage Reports + AWS Athena
If your cloud costs are wearing you down, take a look at how you can integrate AWS Athena with you database for better cost usage insight.
Updated March 5, 2020
by Ayush Sharma
· 6,836 Views · 2 Likes
article thumbnail
Top 7 Programming Languages for Test Automation in 2020
In this article, look at a highlight of the top 7 programming languages to look out for for test automation in 2020.
March 5, 2020
by Himanshu Sheth DZone Core CORE
· 24,735 Views · 15 Likes
article thumbnail
Testing Asynchronous Operations in Spring With JUnit 5 and Byteman
In this article, we will be discussing how to test operations in an application that uses a Spring context (with asynchronous operations enabled).
February 28, 2020
by Szymon Tarnowski DZone Core CORE
· 39,433 Views · 7 Likes
article thumbnail
Authorizing the MuleSoft API Using AWS Cognito User Pool and Mule JWT Validation Policy
This article describes in-depth the process of using AWS Cognito and a Mule JWS validation policty to authorize the MuleSoft API.
Updated February 25, 2020
by Jitendra Bafna
· 26,427 Views · 5 Likes
article thumbnail
Top 6 Complete Automation Testing Solutions
These six solutions are some of the best for automation testing.
Updated February 21, 2020
by Rafaelo Condret
· 28,268 Views · 16 Likes
article thumbnail
Incorporating Fault-Tolerance Into Your Microservice Architecture
In this article, we discuss the process of incorporating fault-tolerance into a microservice architecture.
February 19, 2020
by Oresztesz Margaritisz DZone Core CORE
· 10,507 Views · 13 Likes
article thumbnail
Implementing DDoS With MuleSoft: Demonstration With Apache JMeter
In this article, we discuss how to stop DDoS attacks with MuleSoft by limiting the number of time a user can hit a certain API endpoint.
February 14, 2020
by Gaurav Dhimate
· 16,414 Views · 4 Likes
article thumbnail
Testing Asynchronous Operations in Spring With Spock and Byteman
In this article, we discuss how to test asynchronous operations in Spring applications with Spock and Byteman.
February 13, 2020
by Szymon Tarnowski DZone Core CORE
· 13,214 Views · 5 Likes
article thumbnail
Achieving SOC 2 Compliance in DevOps
Learn more about the specific guidelines for meeting SOC 2 security requirements in a DevOps pipeline and how AWS can help meet them.
February 10, 2020
by Mauricio Ashimine
· 27,544 Views · 3 Likes
article thumbnail
Implementing MUnit And MUnit Matchers With MuleSoft
MUnit is a Mule application testing framework that allows you to build automated tests for your Mule integrations and APIs.
Updated February 10, 2020
by Jitendra Bafna
· 24,055 Views · 4 Likes
article thumbnail
When to ''Unstub'' a Component in a Vue.js Unit Test
To test a component in isolation you can replace it's children components by stubbing them. Vue Test Utils can automatically do this for you with a feature called shallowMount. But what happens if a component is tightly coupled to one of its children? You can still use shallowMount, but you'll then have to selectively "unstub" the tightly coupled child. In this article, I'll show you how to use stubbing to write simpler unit tests. Note: this article was originally posted here on the Vue.js Developers blog on 2019/09/30. Testing in isolation A key idea of unit testing is to test a "unit" of the application in isolation. In component-based frontend apps, we consider the "unit" to be a component. Testing a component in isolation ensures that tests are unaffected by dependencies and other influences of children components. To isolate a component from surrounding components, you can stub it's children components. The diagram below shows how stubbing this way would affect a typical component hierarchy. Stubbing a component usually means replacing it with a simple "stand in" component with no state, logic, and a minimal template. For example, you might replace this: export default { name: "MyComponent", template: "..." props: { ... }, methods: { ... }, computed: { ... } ... }; with this: export default { name: "MyComponentStub" template: "" }; Rather than manually stubbing children components, though, Vue Test Utils offers the shallowMount feature which does it automatically. Coupled components In the real world, components aren't always completely decoupled. Sometimes a component relies on a child component and so the child can't be stubbed without losing some functionality. For example, say we make a button with a cool animation, and we want to reuse it across an app, and so we decide to create a custom component called animated-button. We now have the my-form component that uses this button component. It's been implemented such that my-form is coupled to animated-button, since the latter emits a "click" event that's used to trigger the submit method in the former. MyForm.vue Unit testing my-form Another key idea of unit testing is that we want to test the inputs and outputs of the unit and consider the internals to be a black box. In the my-form component, we should make a unit test where the input is the click of the button, while the output is the Vuex commit. We'll call this test "should commit FORM_SUBMIT when button clicked". We'll create it by first shallow mounting MyForm to isolate it from the influence of any children components as previously prescribed. MyForm.spec.js import { shallowMount } from "@vue/test-utils"; import MyForm from "@/components/MyForm"; describe("MyForm.vue", () => { it("should commit FORM_SUBMIT when button clicked", () => { const wrapper = shallowMount(MyForm); }); }); Next, we'll use the wrapper find API method to find the button component. We pass a CSS selector "animated-button" as the locator strategy. We can then chain the trigger method and pass "click" as the argument. This is how we generate the input of the test. We can then assert that a Vuex commit gets made (probably using a spy, but that's not relevant to this article so I won't detail it). MyForm.spec.js it("should commit FORM_SUBMIT when button clicked", () => { const wrapper = shallowMount(MyForm); wrapper.find("animated-button").trigger("click"); // assert that $store.commit was called }); If we try to run that, we'll get this error from Vue Test Utils: find did not return animated-button, cannot call trigger() on empty Wrapper Is the CSS selector wrong? No, the issue is that we shallow mounted the component, so all the children were stubbed. The auto-stub process changes the name of AnimatedButton to "animated-button-stub" in the template. But changing the selector from "animated-button" to "animated-button-stub" is not a solution. Auto-stubs have no internal logic, so the click event we trigger on it is not being listened to anyway. Selective unstubbing We still want to shallow mount my-form, as we want to ensure it's isolated from the influence of its children. But animated-button is an exception as it's functionality is required for the test. Vue Test Utils allows us to specify the stub for a particular component rather than using an auto-stub when shallow mounting. So the trick is to "unstub" animated-button by using its original component definition as the stub so it retains all of its functionality! To do this, let's import the AnimatedButton component at the top of the file. Now, let's go to our test and create a const stubs and assign it an object. We can put AnimatedButton as an object property shorthand. Now, we'll pass in stubs as part of our shallow mount config. We'll also replace the CSS selector with the component definition, as this is the preferred way of using the find method. MyForm.spec.js import { shallowMount } from "@vue/test-utils"; import MyForm from "@/components/MyForm"; import AnimatedButton from "@/component/AnimatedButton" describe("MyForm.vue", () => { it("should commit FORM_SUBMIT when button clicked", () => { const stubs = { AnimatedButton }; const wrapper = shallowMount(MyForm, { stubs }); wrapper.find(AnimatedButton).trigger("click"); ... }); }); Doing it this way should give you a green tick. Wrap up You always want to isolate your components in a unit test, which can easily be achieved by stubbing all the children components with shallowMount. However, if your component is tightly coupled with one of its children, you can selectively "unstub" that component by providing the component definition as a stub and overriding the auto-stub. Become a senior Vue developer in 2020. Learn and master what professionals know about building, testing, and deploying, full-stack Vue apps in our latest course. Learn more
February 7, 2020
by Anthony Gore
· 6,291 Views · 2 Likes
article thumbnail
Using AWS Step Functions For Offloading Exponential Backoffs
This tutorial demonstrates how you can apply AWS Step Functions to offload exponential backoffs as well as the technical challenges that entails.
Updated February 6, 2020
by Murat Balkan DZone Core CORE
· 8,937 Views · 2 Likes
  • Previous
  • ...
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • ...
  • Next
  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook
×