Chia sẻ kiến thức IT và đời sống – Sharing IT Knowledge and Life

Showing posts with label Unit Testing. Show all posts
Showing posts with label Unit Testing. Show all posts

Thursday, December 31, 2020

Tuesday, September 15, 2020

Unit tests with jmockit

What is JMockit?

JMockit is open source software unit testing library, It includes APIs for mocking, faking, and combining with a code coverage tool. This library is used together with a testing framework such as JUnit or TestNG.  IntelliJ IDEA is a good ide for testing with JMockit.

Monday, April 11, 2016

Using Hamcrest for testing - Tutorial

1. Purpose of the Hamcrest matcher framework


Hamcrest is a framework for software tests. Hamcrest allows checking for conditions in your code via existing matchers classes and allows you to define your custom matcher implementations.
To use Hamcrest matchers in JUnit you use the assertThat statement followed by one or several matchers.
Hamcrest is typically viewed as a third generation matcher framework. The first generation used assert(logical statement) but such tests were not easily readable. The second generation introduced special methods for assertions, e.g., assertEquals() but that lead to lots of assert methods. Hamcrest uses the assertThat method with a matcher expression to determine if the test was succesfully See Wiki on Hamcrest for more details.
Hamcrest has the target to make tests as readable as possible. For example the is method is a thin wrapper forequalTo(value).

Sunday, April 3, 2016

Unit and UI Testing in Android Studio

1. Overview

In this codelab, you'll learn how to set up your project in Android Studio for testing, write a Unit Test and run it locally on your development machine and also how to do functional UI testing on the device.

What you’ll learn

  • Updating the Gradle build files to include JUnit and the Android Testing Support Library
  • Writing Unit Tests which run on the Java VM on your local machine
  • Writing Espresso tests which run on the device or emulator

Saturday, April 2, 2016

Unit tests with Mockito - Starter

1. Unit Testing & test doubles

1.1. Target & challenge of unit testing

A unit test is a test related to a single responsibility of a single class, often referred to as the System Under Test (SUT). A unit test should test a class in isolation. Side effects from other classes or the system should be eliminated if possible. The achievement of this desired goal is typical complicated by the fact that Java classes usually depend on other classes. Test doubles will solve this.

Wednesday, March 23, 2016

Unit Testing with JUnit

1. Testing terminology

1.1. What are software tests?

A software test is a piece of software, which executes another pierce of software and validates if that code results in the expected state (state testing) or executes the expected sequence of events (behavior testing).                                   

1.2. Code (or application) under test

The code which is tested is typically called the code under test. If you are testing an application, this is called the application under test.

PHỔ BIẾN

CHUYÊN MỤC

TỔNG LƯỢT XEM