Help:Pickle/FAQ

From mediawiki.org
Jump to navigation Jump to search
This page is a translated version of the page Help:Pickle/FAQ and the translation is 50% complete.
Other languages:
English • ‎español • ‎português • ‎日本語

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

Frequently Asked Questions

What is a pickle test?

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.

Where do I define pickle tests?

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.

Where are the reports?

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. No es posteado en la página de discusión; aquella página sólo tendría que ser utilizada para propósitos de discusión.

¿Cómo correr pruebas durante la edición?

Si el módulo está editado, entonces hay un botón adicional bajo el editor (posiblemente consola). Empujando esto correrá el fundar pruebas, y producción del informe.

Para un módulo de prueba

Empujando el botón sólo correrá pruebas del módulo actual (inspeccionar página).

Para un módulo de fuente

Empujando el botón correrá todas las pruebas de la subpágina para el módulo actual (página de fuente).

¿Cómo correr pruebas de la consola?

Para correr pruebas de la consola tienes un poco del trabajo de fondo. Esto es bastante sencillo, pero no similar en los dos tipos de páginas.

En la consola de prueba

The special p export variable holds the test module, but the internal require points to the saved source module. Si esto lo corriges puedes utilizar el siguiente.

=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
En la consola de fuente

The special p export variable holds the source module, but the test modules require points to the saved source module. Si esto lo corriges puedes utilizar el siguiente.

=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

How to run tests for another locale?

Tests are run for the current user language unless another is explicitly given. You can only do that through the console. El idioma es la primera entrada en la llamada de función.

En la consola de prueba
=p('nb') -- the first argument is the language, which is Norwegian Bokmål
En la consola de fuente
=require 'Module:Foo/bar.spec'('nb', p) -- the first argument is the language, which is Norwegian Bokmål