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

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.
Unit Tests

Part of tutorial

Unit Tests
Write a simple test and run it in PyCharm's visual test runner.
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.
Project Setup

Part of tutorial

Project Setup
Make a PyCharm project and virtual environment with dependencies, and configure PyCharm to use pytest.
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.
Skipping Tests

Part of tutorial

Skipping Tests
During refactoring, use pytest's markers to ignore certain breaking tests.
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 for Exceptions

Part of tutorial

Testing for Exceptions
Write tests which ensure exceptions are raised when expected.
dotCover Command Line Tools for Automation Testing Code Coverage

JetBrains Blog

dotCover Command Line Tools for Automation Testing Code Coverage
Learn when and how to install the dotCover command line tools, and add code coverage to your CI/CD workflows.
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.
Conclusion

Part of tutorial

Conclusion
Putting Your Knowledge into Practice.
Prerequisites

Part of tutorial

Prerequisites
Setting Up Your Development Environment.
How to Handle Errors in Go

Part of tutorial

How to Handle Errors in Go
Errorless Go - Write Clean and Reliable Code.
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
Where to Go from Here.
Handling Specific Types of Errors

Part of tutorial

Handling Specific Types of Errors
Effective Error Handling - Strategies for Network and IO Issues.
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.
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.
Visual Testing with pytest

Tutorial

Visual Testing with pytest
Test writing is productive and fun with PyCharm as a visual testing tool atop pytest.
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?
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.
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.
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.
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.
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 with one keyboard shortcut.
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 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.
Given, When and Then

Part of tutorial

Given, When and Then
See how Spock tests are usually structured.
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.
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.
Mocks

Part of tutorial

Mocks
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.
Setup and Teardown

Part of tutorial

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

Part of tutorial

Stubs
Stub can provide simple interfaces, so we don't have to initialise the whole application to test a section.
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.
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 and keep your code compiling.
Writing JUnit 5 Tests

Tutorial

Writing JUnit 5 Tests
Writing JUnit 5 Tests from start to finish.
Assert Completion in Testify

Tip

Assert Completion in Testify
Write testify asserts faster thanks to the IDE smartness.
Live Template to Write Benchmark Functions

Tip

Live Template to Write Benchmark Functions
Write benchmarks quicker thanks to the builtin bench live template.
Live Template to Create a for Loop

Tip

Live Template to Create a for Loop
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.
Navigate to Subtests

Tip

Navigate to Subtests
Jump to the specific test case from the results window.
Run a Single Test

Tip

Run a Single 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.
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.
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.