The future of

testing in Pharo
Julien Delplanque
julien.delplanque@live.be
DrTests
-
Developers
• 2nd year of Master

• Did an internship in RMoD
team working on DrTests
for the last 6 months

• Participated to GSOC
• Entering last year of PhD
in RMoD team

• Hacking Pharo around
many aspects… just for
fun :-)

• Hit by testing topic « by
accident »
Julien Dayne
Roadmap
• SUnit’s TestRunner and its limitations

• DrTests - an architecture to build tools around tests

• DrTests internal

• Next steps
!3
TestRunner UIPackages
containing
tests
TestCases
Results
summary
Failed tests
Errors
Run tests Profile test
execution
Analyse code
coverage
Re-run failures
or errors only Export results
!4
TestRunner UI
Run tests Profile test
execution
Analyse code
coverage
We can do more than that!!5
What can we do around
tests?
Mutation testing
Parametrisable tests
Check executable comments
Find rotten green tests
and more!
!6
Run them! Test profiling
Test coverage
…
TestRunner UI
Run tests Profile test
execution
Analyse code
coverage
Adding more buttons does not scale!!7
TestRunner model
!8
Power-up testing experience in Pharo by:

‣ Letting you plug your analysis via plugins
‣ Providing a model to configure, run and gather results
from plugins

‣ Letting you customise the way to visualise results (e.g.
sort them according to your needs).
What do we want?
!9
DrTests
!10
An architecture to build tools around tests
DrTests
Packages
under analysis
Plugin inputPlugin selected
Results tree
Plugin-defined
action(s)
Start pluginLogging label
Results view
!11
Who has the control?
2
Managed by plugin
Managed by result !12
Who has the control?
2
Managed by plugin
Managed by result
YOU!!13
Demo
!14
DrTests’ model
Plugin

Configuration
Plugin

Result
Plugin
Plugin run,

provides updates

through announcements
Created from UI

or by scripting
Can be queried from

UI or by scripting
!15
Consequence of
DrTests’ model
Plugins can be exposed via different UIs easily
!16
Mini DrTests
!17
DrTests
!18
Switch to Mini DrTests
Mini DrTests
Quick visual feedback
!19
DrTest APIIn a nutshell
DTPluginConfiguration
TestRunnerConfiguration
Inherits
• Stores data required for the
plugin to run in instance
variables
!20
DTPluginConfiguration subclass: #DTTestsRunnerConfiguration

	 slots: { #tests }

	 classVariables: { }

	 package: 'DrTests-TestsRunner'
DrTest APIIn a nutshell
DrTestsPlugin
TestRunner
Inherits
• Set UI labels for lists, tree and buttons.

• Describe how to fill lists to let user create a
configuration

• Create configuration by reading UI’s state in
#buildConfigurationFrom:

• Define how to run the plugin in
#runForConfiguration:

• Define if can be minified or not via
#allowMiniDrTests
!21
DrTest APIIn a nutshell
DTPluginResult
TestRunnerResult
Inherits
• Define how to build UI
trees via pragmas

• Define actions available
for nodes via commands
!22
buildGroupedByTypeTree
	 <dTTestRunnerResultTreeNamed: 'Grouped by type of result'>

	 ^ DTTreeNode new

	 	 subResults:

	 	 	 {DTTreeNode new

	 	 	 	 name: DTTestResultType error pluralName;

	 	 	 	 subResults: (self buildLeavesFrom: self testsResult errors type:
DTTestResultType error);

	 	 	 	 yourself.

	 	 	 …

};

	 	 yourself
DrTest APIIn a nutshell
➡Define how to build result trees via pragmas
!23
buildContextualMenuGroupWith: presenterIntance

	 ^ (CmCommandGroup named: 'TestRunnerResult context menu')
asSpecGroup

	 	 basicDescription: 'Commands related to results.';

	 	 register: (DTRerunCommand forSpec context: presenterIntance)

beHiddenWhenCantBeRun;

	 	 register: (DTDebugTestCommand forSpec context: presenterIntance) 

beHiddenWhenCantBeRun;

	 	 beDisplayedAsGroup;

	 	 yourself
DrTest APIIn a nutshell
➡Define actions available for nodes via commands
!24
Previously @PharoDays 2019
Done!
On its way: CommentToTest,
Mutation testing, etc…
6 months of dev later
Next steps
• Calypso integration

• Enhance SUnit

• Unify SUnit’s API tools are exposed to
Damien on github
{
!26
Conclusion
juliendelplanque/DrTests
@juldelplanque
juliendelplanque
Dr Tests opens a lot of possibilities of
future tools around tests!
‣ DrTests will be part of Pharo 8, SUnit runner will be deprecated

‣ The new infrastructure allow people to plug their analyses
‣ Tests are super-valuable, DrTests will help to extract the gold
out of them
!27

DrTests: The Future of Testing in Pharo

  • 1.
    The future of
 testingin Pharo Julien Delplanque julien.delplanque@live.be DrTests -
  • 2.
    Developers • 2nd yearof Master • Did an internship in RMoD team working on DrTests for the last 6 months • Participated to GSOC • Entering last year of PhD in RMoD team • Hacking Pharo around many aspects… just for fun :-) • Hit by testing topic « by accident » Julien Dayne
  • 3.
    Roadmap • SUnit’s TestRunnerand its limitations • DrTests - an architecture to build tools around tests • DrTests internal • Next steps !3
  • 4.
    TestRunner UIPackages containing tests TestCases Results summary Failed tests Errors Runtests Profile test execution Analyse code coverage Re-run failures or errors only Export results !4
  • 5.
    TestRunner UI Run testsProfile test execution Analyse code coverage We can do more than that!!5
  • 6.
    What can wedo around tests? Mutation testing Parametrisable tests Check executable comments Find rotten green tests and more! !6 Run them! Test profiling Test coverage …
  • 7.
    TestRunner UI Run testsProfile test execution Analyse code coverage Adding more buttons does not scale!!7
  • 8.
  • 9.
    Power-up testing experiencein Pharo by: ‣ Letting you plug your analysis via plugins ‣ Providing a model to configure, run and gather results from plugins ‣ Letting you customise the way to visualise results (e.g. sort them according to your needs). What do we want? !9
  • 10.
    DrTests !10 An architecture tobuild tools around tests
  • 11.
    DrTests Packages under analysis Plugin inputPluginselected Results tree Plugin-defined action(s) Start pluginLogging label Results view !11
  • 12.
    Who has thecontrol? 2 Managed by plugin Managed by result !12
  • 13.
    Who has thecontrol? 2 Managed by plugin Managed by result YOU!!13
  • 14.
  • 15.
    DrTests’ model Plugin
 Configuration Plugin
 Result Plugin Plugin run,
 providesupdates
 through announcements Created from UI
 or by scripting Can be queried from
 UI or by scripting !15
  • 16.
    Consequence of DrTests’ model Pluginscan be exposed via different UIs easily !16
  • 17.
  • 18.
  • 19.
  • 20.
    DrTest APIIn anutshell DTPluginConfiguration TestRunnerConfiguration Inherits • Stores data required for the plugin to run in instance variables !20 DTPluginConfiguration subclass: #DTTestsRunnerConfiguration slots: { #tests } classVariables: { } package: 'DrTests-TestsRunner'
  • 21.
    DrTest APIIn anutshell DrTestsPlugin TestRunner Inherits • Set UI labels for lists, tree and buttons. • Describe how to fill lists to let user create a configuration • Create configuration by reading UI’s state in #buildConfigurationFrom: • Define how to run the plugin in #runForConfiguration: • Define if can be minified or not via #allowMiniDrTests !21
  • 22.
    DrTest APIIn anutshell DTPluginResult TestRunnerResult Inherits • Define how to build UI trees via pragmas • Define actions available for nodes via commands !22
  • 23.
    buildGroupedByTypeTree <dTTestRunnerResultTreeNamed: 'Groupedby type of result'> ^ DTTreeNode new subResults: {DTTreeNode new name: DTTestResultType error pluralName; subResults: (self buildLeavesFrom: self testsResult errors type: DTTestResultType error); yourself. … }; yourself DrTest APIIn a nutshell ➡Define how to build result trees via pragmas !23
  • 24.
    buildContextualMenuGroupWith: presenterIntance ^(CmCommandGroup named: 'TestRunnerResult context menu') asSpecGroup basicDescription: 'Commands related to results.'; register: (DTRerunCommand forSpec context: presenterIntance) beHiddenWhenCantBeRun; register: (DTDebugTestCommand forSpec context: presenterIntance) beHiddenWhenCantBeRun; beDisplayedAsGroup; yourself DrTest APIIn a nutshell ➡Define actions available for nodes via commands !24
  • 25.
    Previously @PharoDays 2019 Done! Onits way: CommentToTest, Mutation testing, etc… 6 months of dev later
  • 26.
    Next steps • Calypsointegration • Enhance SUnit • Unify SUnit’s API tools are exposed to Damien on github { !26
  • 27.
    Conclusion juliendelplanque/DrTests @juldelplanque juliendelplanque Dr Tests opensa lot of possibilities of future tools around tests! ‣ DrTests will be part of Pharo 8, SUnit runner will be deprecated ‣ The new infrastructure allow people to plug their analyses ‣ Tests are super-valuable, DrTests will help to extract the gold out of them !27