SmartTest

What is SmartTest?

SmartTest innovation award

SmartTest is a plugin developed in Pharo. It is an Add-On for Quality Assistant by Yuriy Tymchuk and provides new rules and critiques. But it has also its own implementation of feedback about testing

The goal of SmartTest is to provide to the developers the list of tests they should run after they modify their code. With this plugin installed, developers will save time and will develop in a better way (hopefully).

Installation

I supposed you have already installed Pharo. If not, please install it.

To install SmartTest. The easiest way is to use the catalog browser.

Install Smartest

Utilisation - Reneraku Integration

Once you install SmartTest, it is auto-activated (it can take a few seconds, but you will not notice them).

You can disable this way of utilization in the setting. To do that, you only have to toggle the corresponding button in the settings.

Activate QualityAssistant Integration

Each time you select a method or a class. Two rules can be activated.

Should write tests

shouldWriteTest

This critique indicates that the plugin didn't find any test related to the method you've selected. Normally, it means you didn't write a test for this method. So it advises you to create a test (because yes... It's essential !!!).

If you click on the fix button, the plugin offers you to create it quickly (from a template).

Should run tests

shouldRunTest

This critique indicates that the plugin has found test(s) related to the method you've selected. This critique offers you two new actions

AutoTestSelection

This window displays the list of tests SmartTest has found. You're able to run each run by clicking on the #testNotRun icon. The tests will be run in debug mode (errors will be displayed). By clicking on the "Run all test" button, you will run all the tests displays in debug mode.

Options

Many options are available to custom your experience with SmartTest. You should read this part to use SmartTest at the maximum of its possibilities. You can extend each option and so create your own experience.

Enable/Disable research

You can enable or disable the research of tests for a method or for class only. To do that, you only have to toggle the corresponding button in the settings.

Method Activation

Class Activation

Testing strategy

Testing strategy

SmartTest provides four strategies for testing.

You're able to extend SmTTestingStrategy if you'd like to create your own testing strategy.

Finder

finder

The finder contains the implementation of how SmartTest will find test relative to a method. The default will work as follow, for

Filter

filter

You can also define a filter for the finder strategy to optimize our tool. Currently, we are filtering test relative to the method package. That includes all the class in our package, the package with the same base name ("SmartTest-Patate" and "SmartTest-Frite-Poulet" are two packages with the same base name "SmartTest"). And the package that calls our method class ("MyClass>>#hello" is in the package A. In the package B, there is at least a method that calls "MyClass". So, the methods inside the package B are not rejected).

(working on schema)

You're able to extend SmTFilterStrategy if you'd like to create your own strategy to filter tests.

Runner

runner

The runner is the part of SmartTest which run the tests provided by the finder. By default, the SmartRunner is used.

The Debug one will open the debugger if an error appears (don't depend on the button you click on). The notice one works as the debug one but it never opens the debugger.

Utilisation - Own implementation

You can activate the own implementation of SmartTest by enabling it in the settings menu.

Collect button

Then the Test Button will appear. Each time you modify a method. The Button will save the tests link to this method. When you click on the button, those tests are run, and the button provides you a feedback.

Relative Test Button

Uninstall

To uninstall SmartTest, it's a bit hard currently. You have to follow this instruction:

The projects are present on github. So you can report issues (or features you want to see implemented). And you can do pull request too.

Development version

The best way since Pharo7 is to use iceberg !!

You can also execute this script

1Metacello new 2 baseline: #SmartTest; 3 githubUser: 'badetitou' project: 'SmartTest' commitish: 'development' path: '.'; 4 onWarningLog; 5 load

Some Contributors