Testing

Testing

Make sure code behaves as expected.

Testing and test-driven development is an important part of professional coding. Our IDEs come with a friendly user interface for writing and running tests, using a variety of frameworks.

See Also

How to Use Mock Testing in Go

Tutorial

How to Use Mock Testing in Go
Mocking & Rocking - Power Up Your Go Testing
Common Mistakes to Avoid When Handling Errors in Go

Part of tutorial

Common Mistakes to Avoid When Handling Errors in Go
Write Clean Code - Common Error Handling Mistakes to Avoid
Best Practices for Error Handling in Go

Part of tutorial

Best Practices for Error Handling in Go
Reduce Bugs and Maintain Control - Essential Practices
Popular Error Handling Techniques in Go

Part of tutorial

Popular Error Handling Techniques in Go
Defer, Panic, and Recover - When to Use Each
Conclusion

Part of tutorial

Conclusion
Putting Your Knowledge into Practice
Handling Specific Types of Errors

Part of tutorial

Handling Specific Types of Errors
Effective Error Handling - Strategies for Network and IO Issues
How to Handle Errors in Go

Part of tutorial

How to Handle Errors in Go
Errorless Go - Write Clean and Reliable Code
Conclusion

Part of tutorial

Conclusion
Where to Go from Here
Unit testing in Go is easy!

Part of tutorial

Unit testing in Go is easy!
The Power of Unit Testing in Your Go Projects
More Mocking Techniques

Part of tutorial

More Mocking Techniques
Mocking Power - Interfaces, Testify, and HTTP for Go Testing
Prerequisites

Part of tutorial

Prerequisites
Software Requirements - What You Need to Know Before You Begin
Prerequisites

Part of tutorial

Prerequisites
Setting Up Your Development Environment
Setting Up the Demo Project in GoLand

Part of tutorial

Setting Up the Demo Project in GoLand
Unleash the Power of Mocks - Build a Project from Scratch
Better 11ty Development with Tooling

Tutorial

Better 11ty Development with Tooling
Getting a component-driven development experience that fits nicely into the 11ty zen.
pytest vs Unittest, Which is Better?

JetBrains Blog

pytest vs Unittest, Which is Better?
Python, being a versatile and widely used programming language, offers several testing frameworks to facilitate the testing process. Two prominent choices are pytest and unittest, both of which come with their own sets of features and advantages.
Testing and debugging

Part of tutorial

Testing and debugging
Testing and debugging in IntelliJ IDEA
Do you do enough testing? pytest to the rescue!

YouTube

Do you do enough testing? pytest to the rescue!
Join us to learn how you can use pytest to find bugs, improve code quality, and even have some fun along the way.
Productive pytest with PyCharm

YouTube

Productive pytest with PyCharm
Testing is a major part of Python development and pytest has become the leading testing framework. Brian Okken, author of the recent book Python Testing with pytest and host of the Test and Code podcast, helps you “level up” your pytest skill.
An Interview with Brian Okken - the pytest storyteller

JetBrains Blog

An Interview with Brian Okken - the pytest storyteller
Brian wears many hats including being a host for multiple Python podcasts and the author of Python Testing with pytest and has recently launched his new pytest course. Mostly, Brian spends his free time telling people they should write good, clean automated tests, specifically using pytest.
Three pytest features you will love

JetBrains Blog

Three pytest features you will love
One of the most popular frameworks for Python is pytest, and it comes with several cool features. I’m going to show you three of them in this blog post.
Show diff for failing test

Tip

Show diff for failing test
Quickly see the diff for failing test
Generate a Test Class

Tip

Generate a Test Class
Generate a new test class from your Java class
Navigate to Test

Tip

Navigate to Test
Go to your matching test class
Highlights of GoLand 2023.3

Playlist

Highlights of GoLand 2023.3
Explore key features and enhancements in GoLand 2023.3.
Code coverage for applications

Tip

Code coverage for applications
Track code execution and identify dead code effectively
Unit testing

Part of tutorial

Unit testing
What is RiderFlow? And where to find it?
Unit testing

Part of tutorial

Unit testing
The Unreal Engine testing framework is built in and works without additional configuration.
Marco Codes - Hibernate & JPA Tutorial

Tutorial

Marco Codes - Hibernate & JPA Tutorial
Crash course in Hibernate and JPA
Generate tests for generic functions

Tip

Generate tests for generic functions
Use a shortcut to generate test files for your generic functions.
Integrated Go Playground

Tip

Integrated Go Playground
You can format and share your code, change the Go version, and run your code using the Go playground server.
Merge/Unmerge If Statements

Tip

Merge/Unmerge If Statements
Experiment with your code without changing the semantics
Marco Codes - JUnit 5

Tutorial

Marco Codes - JUnit 5
JUnit 5 Nice n Easy
Fuzz testing

Tip

Fuzz testing
Automate your tests by continuously submitting various input.
React, TypeScript, and TDD

Tutorial

React, TypeScript, and TDD
How to write React applications in TypeScript using TDD, highlighting features of the IDE
Using the Terminal in IntelliJ IDEA

Tutorial

Using the Terminal in IntelliJ IDEA
IntelliJ IDEA has a built-in terminal that you can use to perform a number of functions inside your IDE
Migrating JUnit 4 to JUnit 5

Tutorial

Migrating JUnit 4 to JUnit 5
Migrating your JUnit 4 test suite to JUnit 5
Hot Spots

Tip

Hot Spots
Find areas of your code base that may need better test coverage.
Continuous Testing

Tip

Continuous Testing
Run your tests in the background, while you code.
Generate Test Methods

Tip

Generate Test Methods
Generate a test method in your Test class
Detect incorrect usages of t/b.Fatal* calls in goroutines

Tip

Detect incorrect usages of t/b.Fatal* calls in goroutines
Find if tests or benchmarks are using t/b.Fatal* calls inside goroutines incorrectly
Writing Tests with Spock

Tutorial

Writing Tests with Spock
Learn about the Spock testing framework by creating a project that uses Spock to unit test Java code
Data Pipes

Part of tutorial

Data Pipes
Often we want to test the same set of criteria with different sets of data. Data pipes is one mechanism to do this.
Expecting Exceptions

Part of tutorial

Expecting Exceptions
Tests don't check just the happy paths, sometimes we want to say we're expecting a specific Exception.
Given, When and Then

Part of tutorial

Given, When and Then
See how Spock tests are usually structured.
Data Tables

Part of tutorial

Data Tables
Data tables offer the same functionality as data pipes, but this syntax can sometimes be more readable for more complex sets of data.
Setup and Teardown

Part of tutorial

Setup and Teardown
See how to set up, or clean up, test classes and methods in Spock.
Mocks

Part of tutorial

Mocks
Mocks are a useful testing tool. We can provide "empty" objects, so we don't have to initialise the whole application to test a section, and we can use mocks to check our code is making the calls we expect.
Setting up the Dependencies

Part of tutorial

Setting up the Dependencies
Add Spock framework dependencies to the project
Verify All

Part of tutorial

Verify All
Test frameworks often stop the test at the first failure. Find out how to run all conditions to see which pass and which fail.
Stubs

Part of tutorial

Stubs
Stub objects allow us to state from a test what values get injected into our application code. They can provide simple interfaces, so we don't have to initialise the whole application to test a section.
Writing and Running Unit Tests with ReSharper

Part of tutorial

Writing and Running Unit Tests with ReSharper
Run, debug and profile tests, do continuous testing, and inspect code coverage.
Assert That Import

Tip

Assert That Import
Use quick intentions to manage imports
Writing JUnit 5 Tests

Tutorial

Writing JUnit 5 Tests
Writing JUnit 5 Tests
Assert completion in testify

Tip

Assert completion in testify
Write testify asserts faster thanks to the IDE smartness
Live Template to create a for loop in benchmark functions

Tip

Live Template to create a for loop in benchmark functions
Benchmark loops are repetitive, so let the IDE handle this for you
Live Template to create test function

Tip

Live Template to create test function
Write tests faster thanks to the builtin func Test live template.
Live Template to write benchmark function

Tip

Live Template to write benchmark function
Write benchmarks quicker thanks to the builtin bench live template.
Navigate to subtests in table tests

Tip

Navigate to subtests in table tests
Jump to the specific test case from the results window
Run a single test from a table test

Tip

Run a single test from a table test
Focus your testing on new test cases or tests that fail
Completion for testify test names

Tip

Completion for testify test names
Let your IDE add constructor arguments to your instance.
Testing code

Part of tutorial

Testing code
Get started with testing. We will use Jest as an example.
Auto-Run Tests

Tip

Auto-Run Tests
Get into testing mode by telling GoLand to automatically re-run tests as you type.
Run Single Test

Tip

Run Single Test
Speed up testing by focusing on one test.
Spot Coverage Gaps Using the Gutter

Tip

Spot Coverage Gaps Using the Gutter
Let the IDE help you spot coverage gaps in your testing.
Run Tests from Editor

Tip

Run Tests from Editor
Learn how to run a single test right from the editor.
Unit Testing with Rider

Part of tutorial

Unit Testing with Rider
Learn how Rider can help make sure code behaves as expected, with continuous testing and code coverage.
Review Errors from Test Runners

Tip

Review Errors from Test Runners
In a test file, hover over an error to get more information about it.
Visual Testing with pytest

Tutorial

Visual Testing with pytest
Test writing is productive and fun with PyCharm as a visual testing tool atop pytest.
Background on Testing

Part of tutorial

Background on Testing
Introduce testing, pytest, and how it all fits into PyCharm, along with a scenario to work on.
Debugging During Testing

Part of tutorial

Debugging During Testing
When writing tests, use the PyCharm "visual debugger" to interactively poke around in the context of a problem.
Hello Test

Part of tutorial

Hello Test
Write a simple test and run it in PyCharm's visual test runner.
Test Fixtures

Part of tutorial

Test Fixtures
Make your tests more focused by moving sample data to pytest fixtures.
Jump to Error

Part of tutorial

Jump to Error
Writing code means writing broken code. Click a link in a traceback to open a file on the line of the error.
Project Setup

Part of tutorial

Project Setup
Make a PyCharm project and virtual environment with dependencies, then configure PyCharm to use pytest.
Getting Into the TDD Flow

Part of tutorial

Getting Into the TDD Flow
Setup your PyCharm project to help get into the flow of Test-Driven Development (TDD).
Testing Exceptions

Part of tutorial

Testing Exceptions
Write tests which ensure exceptions are raised when expected.
Skipping Tests

Part of tutorial

Skipping Tests
During refactoring, use pytest's markers to ignore certain breaking tests.
Finding Tests in Large Test Files

Tip

Finding Tests in Large Test Files
Use the Structure tool window for quick navigation around large test files.
Navigate to Test

Tip

Navigate to Test
Use the Go to Symbol popup to go to a test.
Speed Up Coverage with Configuration File

Tip

Speed Up Coverage with Configuration File
Speed up your "visual coverage" with a config file and correct working directory.
Split Screen Without Tabs

Tip

Split Screen Without Tabs
Get your code and tests side-by-side without resorting to tabs.
Spot Coverage Gaps Using the Gutter

Tip

Spot Coverage Gaps Using the Gutter
Let the IDE help you spot coverage gaps in your testing.
Auto-Run Tests

Tip

Auto-Run Tests
Get into testing mode by telling PyCharm to automatically re-run tests as you type.
Run Single Test

Tip

Run Single Test
Speed up testing by focusing on one test.