Actions

Difference between revisions of "Testing Area/Behat Testing/Characteristics of a good test"

From Mahara Wiki

< Testing Area‎ | Behat Testing
Line 55: Line 55:
  
 
</pre>  
 
</pre>  
 +
 +
 +
<h2>Tags</h2>
 +
 +
Always attach a @javascript tag
 +
 +
  
 
<h2>Feature</h2>
 
<h2>Feature</h2>
Line 64: Line 71:
 
   So I can  
 
   So I can  
  
 +
In order to
  
<h2>Tags</h2>
 
  
Always attach a @javascript tag
 
  
<h2>Scenario</h2>
+
<h2>Background</h2>
  
  
<h2>Background</h2>
+
<h2>Scenario</h2>
  
  

Revision as of 11:02, 16 December 2014

How to write a good test

Template

Copy and paste into your text editor and remember to save in the right directory and as a .feature file

Single scenario on a page

 @javascript @core
 Feature: 
  In order to 
  As an
  So I can

 Scenario:
  Given
  And
  When
  And
  Then 


Multiple scenarios on one page.

 @javascript @core 
 Feature: 
  In order to 
  As an
  So I can

 Background:
  Given
  And
  And
  And  

 @core_
 Scenario:
  Given
  And
  When
  And
  Then 

 @core_
 Scenario:
  Given
  And
  When
  And
  Then



Tags

Always attach a @javascript tag


Feature

Good features clearly explain what you are trying to do. If you are using a bug from Launchpad to write the test, use the title of the bug in the title of the feature.

Feature:
 In order to 
 As a
 So I can 

In order to


Background


Scenario


Steps


Comments