Skip to content

Commit

Permalink
Merge pull request #110 from Behat/legovaer-v3.0
Browse files Browse the repository at this point in the history
New structure of v3.0
  • Loading branch information
everzet committed Jul 24, 2016
2 parents 709b098 + 01cebd0 commit be9d70b
Show file tree
Hide file tree
Showing 26 changed files with 754 additions and 586 deletions.
18 changes: 16 additions & 2 deletions _themes/borg/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,25 @@

<nav class="toc">
<h3>Chapters</h3>
{{ toc }}
{% set toctree = toctree(maxdepth=2, collapse=True, includehidden=True) %}
{% if toctree %}
{{ toctree }}
{% else %}
<!-- Local TOC -->
<div class="local-toc">{{ toc }}</div>
{% endif %}
</nav>

<section class="text">
{% block body %}{% endblock %}
<footer>
{% if prev %}
<dl><dt>Previous</dt> <dd><a class="prev" href="{{ prev.link|e }}">{{ prev.title }}</a></dd></dl>
{% endif %}

{% if next %}
<dl><dt>Next</dt><dd><a class="next" href="{{ next.link|e }}">{{ next.title }}</a></dd></dl>
{% endif %}
</footer>
</section>

</section>
Expand Down
36 changes: 36 additions & 0 deletions _themes/borg/static/css/borg.css
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,39 @@ body > section {
font-size: 1.6rem;
color: #4F4F4F;
}

body > footer {
padding-bottom: 0;
padding-top: 0;
position: relative;
}
body > footer dl, section.text > footer dl {
float: left;
margin-bottom: 20px;
margin-right: 50px;
margin-top: 10px;
}
section.text > footer dl + dl {
float: right;
}
body > footer dl dt, section.text > footer dl dt {
color: #b3b3b3;
font-family: 'Comfortaa';
font-size: 18px;
margin-bottom: 5px;
}
body > footer dl dd, section.text > footer dl dd {
margin: 0 0 3px 0;
}
body > footer dl dd a, section.text > footer dl dd a {
color: #c9cbcb;
font-size: 14px;
font-weight: normal;
text-decoration: none;
}
body > footer dl dd a:hover, section.text > footer dl dd a:hover {
text-decoration: underline;
}
body > footer .clear {
clear: both;
}
15 changes: 13 additions & 2 deletions _themes/borg/static/css/documentation.css
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,19 @@
list-style: none;
}

.toc > ul > li > a {
display: none;
nav.toc ul li {
margin-bottom: 10px;
margin-left: 15px;
margin-top: 10px;
padding-left: 0;
}

nav.toc > ul > li {
margin-left: 2px;
}

a.current {
font-weight: bold;
}

.toc > ul > li > ul {
Expand Down
4 changes: 2 additions & 2 deletions conf.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-

import sys, os
from sphinx.highlighting import lexers
from pygments.lexers.web import PhpLexer
from sphinx.highlighting import lexers
from pygments.lexers.web import PhpLexer

lexers['php'] = PhpLexer(startinline=True)
extensions = []
Expand Down
8 changes: 8 additions & 0 deletions cookbooks.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Cookbooks
=========

.. toctree::
:maxdepth: 2

cookbooks/integrating_symfony2_with_behat
cookbooks/accessing_contexts_from_each_other
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
Accessing contexts from each other
Accessing Contexts from each other
==================================

When splitting the definitions in multiple contexts, it might be useful to
access a context from another one. This is particularly useful when migrating
from Behat 2.x to replace subcontexts.

Behat allows to access the environment in :doc:`hooks </guides/3.hooks>`,
Behat allows to access the environment in
:doc:`hooks </user_guide/context/hooks>`,
so other contexts can be retrieved using a ``BeforeScenario`` hook:

.. code-block:: php
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ In this cookbook we will cover:

#. Using Symfony2 test client as a Mink driver.

Installing Behat in your Symfony2 project
Installing Behat in your Symfony2 Project
-----------------------------------------

Recommended way of managing Behat dependency in your project is to use `Composer <https://getcomposer.org/)>`_.
Expand Down Expand Up @@ -46,9 +46,10 @@ In order to verify Behat initialisation you can just run following command:
.. tip::

If you don't feel familiar with Behat enough please read :doc:`/quick_intro_pt1` first.
If you don't feel familiar with Behat enough please read :doc:`/quick_start`
first.

Installing and enabling Symfony2 extension
Installing and Enabling Symfony2 Extension
------------------------------------------

Great, you have a Behat suite working in your project, now it's time to install `Symfony2Extension <https://github.com/Behat/Symfony2Extension>`_.
Expand All @@ -70,7 +71,7 @@ If it doesn't exist just create such file in your project root and fill it with
If this file already exists just change its contents accordingly.
From that point you should be able to run Behat and Symfony2 extension will be loaded and ready to work with.

Accessing application services in contexts
Accessing Application Services in Contexts
------------------------------------------

The extension we have just installed detects the default Symfony configuration and allows
Expand All @@ -91,7 +92,7 @@ to change your ``behat.yml`` configuration and tell the extension which services
This configuration will try to to match the ``$session`` dependency of your ``FeatureContext`` constructor by injecting the ``session`` service into the context.
Be careful because if such a service does not exist or its name does not match, it will not work and you will end up with a Behat exception.

Using KernelDriver with your Behat suite
Using KernelDriver with your Behat Suite
----------------------------------------

Symfony2 has a build-in Test Client, which can help you with web acceptance testing, why not make use of it?
Expand Down
55 changes: 8 additions & 47 deletions index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,53 +52,14 @@ learn, quick to use, and will put the fun back into your testing.
Behat is considered an official Cucumber implementation in PHP and is part
of one big family of BDD tools.

Quick Intro
-----------

To become a *Behat'er* in 30 minutes, just dive into the quick-start guide and
enjoy!

.. toctree::
:maxdepth: 1

quick_intro_pt1

Guides
------

Learn Behat with the topical guides:

.. toctree::
:maxdepth: 1

guides/1.gherkin
guides/2.definitions
guides/3.hooks
guides/4.contexts
guides/5.suites
guides/6.profiles
guides/7.run

Cookbook
--------

Learn specific solutions for specific needs:

.. toctree::
:maxdepth: 1

cookbooks/1.symfony2_integration
cookbooks/context_communication

More about Behaviour Driven Development
---------------------------------------

Once you're up and running with Behat, you can learn more about behaviour
driven development via the following links. Though both tutorials are specific
to Cucumber, Behat shares a lot with Cucumber and the philosophies are one
and the same.
:hidden:
:maxdepth: 2

* `Dan North's "What's in a Story?" <http://dannorth.net/whats-in-a-story/>`_
* `Cucumber's "Backgrounder" <https://github.com/cucumber/cucumber/wiki/Cucumber-Backgrounder>`_
intro
quick_start
user_guide
cookbooks
useful_resources

.. _`Cucumber`: http://cukes.info/
.. _`Cucumber`: http://cukes.info/
16 changes: 16 additions & 0 deletions intro.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Introduction
============

Behaviour Driven Development
----------------------------

Once you're up and running with Behat, you can learn more about behaviour
driven development via the following links. Though both tutorials are specific
to Cucumber, Behat shares a lot with Cucumber and the philosophies are one
and the same.

* `Dan North's "What's in a Story?"`_
* `Cucumber's "Backgrounder"`_

.. _Dan North's "What's in a Story?": http://dannorth.net/whats-in-a-story
.. _Cucumber's "Backgrounder": https://github.com/cucumber/cucumber/wiki/Cucumber-Backgrounder
28 changes: 15 additions & 13 deletions quick_intro_pt1.rst → quick_start.rst
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Building Domain Model
=====================
Quick Start
===========

Welcome to Behat! Behat is a tool to close the `Behavior Driven Development`_
(BDD) communication loop. BDD is a methodology for developing software through
Expand All @@ -12,6 +12,9 @@ makes it very easy to automate and autotest your behaviour examples against
a developing application. Automated examples are then actually used to drive
this application development TDD-style.

To become a *Behat'er* in 30 minutes, just dive into the quick-start guide and
enjoy!

Example
-------

Expand Down Expand Up @@ -175,7 +178,7 @@ The official way to install Behat is through Composer. Composer is a package
manager for PHP. Not only can it install Behat for you right now, it will be
able to easily update you to the latest version later when one comes out. If
you don't have Composer already, see
`the Composer documentation <https://getcomposer.org/download/>`_ for
`the Composer documentation`_ for
instructions. After that, just go into your project directory (or create a
new one) and run:

Expand All @@ -188,12 +191,12 @@ Then you will be able to check installed Behat version using:
.. code-block:: bash
$ vendor/bin/behat -V
Method #2 - PHAR (an easy one)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

An easier way to install Behat is to grab a latest ``behat.phar`` from
`the download page <https://github.com/Behat/Behat/releases>`_. Make sure
`the download page`_. Make sure
that you download a ``3+`` release. After downloading it, just place it in
your project folder (or create a new one) and check the installed version using:

Expand Down Expand Up @@ -593,7 +596,7 @@ Run Behat again:

.. code-block:: bash
$> vendor/bin/behat
$ vendor/bin/behat
Great! Another "instruction":

Expand Down Expand Up @@ -694,17 +697,16 @@ There are many more benefits to BDD but those are the key reasons why most BDD
practitioners do BDD in Ruby, .Net, Java, Python and JS. Welcome to the family!

What's Next?
------------
~~~~~~~~~~~~

Congratulations! You now know everything you need in order to get started
with behavior driven development and Behat. From here, you can learn more
about the :doc:`Gherkin </guides/1.gherkin>` syntax or learn how to test your
web applications by using Behat with Mink.
about the :doc:`Gherkin </user_guide/gherkin>` syntax or learn how to
test your web applications by using Behat with Mink.

.. _`Behavior Driven Development`: http://en.wikipedia.org/wiki/Behavior_Driven_Development
.. _`the Composer documentation`: https://getcomposer.org/download/
.. _`the download page`: https://github.com/Behat/Behat/releases
.. _`Mink`: https://github.com/behat/mink
.. _`What's in a Story?`: http://blog.dannorth.net/whats-in-a-story/
.. _`Cucumber`: http://cukes.info/
.. _`Goutte`: https://github.com/fabpot/goutte
.. _`PHPUnit`: http://phpunit.de
.. _`Testing Web Applications with Mink`: https://github.com/behat/mink
.. _`Behavior Driven Development`: http://en.wikipedia.org/wiki/Behavior_Driven_Development
17 changes: 17 additions & 0 deletions useful_resources.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Useful Resources
================

Integrating Behat with PHPStorm
-------------------------------

More information on integrating Behat with PHPStorm can be found in this
`blog post`_.

Behat cheat sheet
-----------------

An interesting `Behat and Mink cheat sheet`_ developed by `Jean-François Lépine`_

.. _`blog post`: http://blog.jetbrains.com/phpstorm/2014/07/using-behat-in-phpstorm/
.. _`Behat and Mink cheat sheet`: http://blog.lepine.pro/wp-content/uploads/2012/03/behat-cheat-sheet-en.pdf
.. _`Jean-François Lépine`: http://blog.lepine.pro
14 changes: 14 additions & 0 deletions user_guide.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
User Guide
==========

.. toctree::
:maxdepth: 2

user_guide/gherkin
user_guide/features_scenarios
user_guide/initialize
user_guide/writing_scenarios
user_guide/organizing
user_guide/context
user_guide/command_line_tool
user_guide/configuration
10 changes: 10 additions & 0 deletions user_guide/command_line_tool.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Command Line Tool
=================

.. toctree::
:maxdepth: 2

command_line_tool/identifying
command_line_tool/formatting
command_line_tool/informative_output

7 changes: 2 additions & 5 deletions guides/7.run.rst → user_guide/command_line_tool/formatting.rst
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
Running Tests
=============

Format Options
--------------
==============

Behat supports different ways of printing output information. Output printers
in ``behat`` are called *formats* or *formatters*. You can tell ``behat`` to
Expand Down Expand Up @@ -65,4 +62,4 @@ respectively:

.. code-block:: bash
$ behat --no-colors
$ behat --no-colors
15 changes: 15 additions & 0 deletions user_guide/command_line_tool/identifying.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Identifying Tests
=================

.. _user-guide--command-line-tool--identifying-tests--by-suite:

By Suite
--------

By default, when you run Behat it will execute all registered suites
one-by-one. If you want to run a single suite instead, use the ``--suite``
option:

.. code-block:: bash
$ vendor/bin/behat --suite=web_features

0 comments on commit be9d70b

Please sign in to comment.