Jump to content

Help:Pickle/FAQ/fr

From mediawiki.org
This page is a translated version of the page Help:Pickle/FAQ and the translation is 18% complete.

This tries to answer some of the most common questions. If you have additional questions post them on the discussion page.

FaQ

En quoi consiste un test Pickle ?

A pickle test is a test written in a style similar to what has become common in RSpec. It focuses on the expected outcome of examples. It also focuses on tests that can be written before the code exists, not tests added after everything is finished.

Où définier les tests Pickle ?

Pickle tests resides on subpages with the suffix .spec. Usually only one page will hold tests for a single module, but all matching subpages will be included in a test run.

Où sont les rapports ?

Reports from a static test run—those that will be automatically reevaluated on each run—are usually posted as part of the spec doc page. It is not posted on the talk page; that page should only be used for discussion purposes.

Comment faire des tests pendant les modifications ?

If the module is edited, then there is an additional button under the editor (possibly console). Pushing this will run the found tests, and output the report.

For a test module

Pushing the button will only run tests from the current module (spec page).

For a source module

Pushing the button will run all the tests from the subpage for the current module (source page).

Comment lancer des tests dans la console système ?

To run tests from the console you have to some of the background job yourself. This is quite simple, but not similar on the two types of pages.

In the test console

The special p export variable holds the test module, but the internal require points to the saved source module. If this is correct you can use the following.

=p(null) -- the first argument is the language, which is not used

If that is not sufficient you can use the following where the last table can hold any replacement as key-value pairs where the key is a page otherwise loaded.

=p(null, {}) -- the first argument is the language, which is not used
In the source console

The special p export variable holds the source module, but the test modules require points to the saved source module. If this is correct you can use the following.

=require 'Module:Foo/bar.spec'(null) -- the first argument is the language, which is not used

If that is not sufficient you can use the following where the last table can hold any replacement as key-value pairs where the key is a page otherwise loaded.

=require 'Module:Foo/bar.spec'(null, {baz=p}) -- the first argument is the language, which is not used

Comment exécuter les tests pour un autre fuseau horaire ?

Tests are run for the current user language unless another is explicitly given. You can only do that through the console. The language is the first entry in the function call.

In the test console
=p('nb') -- the first argument is the language, which is Norwegian Bokmål
In the source console
=require 'Module:Foo/bar.spec'('nb', p) -- the first argument is the language, which is Norwegian Bokmål