Difference between revisions of "Creating your first ta project"

From Test Automation Wiki
Jump to: navigation, search
Line 9: Line 9:
 
# Open the console
 
# Open the console
 
# Go to the folder where you want to create you project
 
# Go to the folder where you want to create you project
#* E.G.: <code>cd C:/ruby/projects/</code>
+
#* For example: <code>cd C:/ruby/projects/</code>
 
# Write <code>lapis_lazuli create <projectname></code>
 
# Write <code>lapis_lazuli create <projectname></code>
 
#* Where <projectname> is the name of your project without `<>`
 
#* Where <projectname> is the name of your project without `<>`
Line 32: Line 32:
 
0m10.054s
 
0m10.054s
 
</source>
 
</source>
 
=== Common issues on your first run ===
 
 
* [[cannot load such file -- (...) (LoadError)]]
 
** E.G. "cannot load such file -- watir-webdriver (LoadError)"
 
* [[unable to obtain stable firefox connection]]
 
* [[Unable to find Mozilla geckodriver Please download the server from and place it somewhere on your PATH]]
 
* [[Install ANSICON for coloured output]]
 
 
If other problems occured for you, please feel free to message [[mailto:admin@testautomation.info|contact us]] so we can add the solution to our Wiki.
 
  
 
== Folder structure ==
 
== Folder structure ==
Line 57: Line 47:
 
07. │ └─> validation_steps.rb
 
07. │ └─> validation_steps.rb
 
08. ├─┬/support/
 
08. ├─┬/support/
09. │ └─> env.rb
+
09. │ ├─> env.rb
10. ├─> example.feature
+
10. | └─> functions.rb
11. └─> mobile.feature
+
11. ├─> example.feature
12.──/log/
+
12. └─> mobile.feature
13.──/results/
+
13.──/log/
14.──/sceenshots/
+
14.──/results/
 +
15.──/sceenshots/
 
</source>
 
</source>
 +
 +
<h2>Extra information</h2>
 +
=== About Bundle gem ===
 +
  
 
=== Detailed information about every folder ===
 
=== Detailed information about every folder ===
Line 71: Line 66:
 
* 04. /features/
 
* 04. /features/
 
** This is the core of your project. It contains the test cases, the code executed in the steps of your test cases and any other code you wish to write for your solution.
 
** This is the core of your project. It contains the test cases, the code executed in the steps of your test cases and any other code you wish to write for your solution.
* 10. example.feature
+
* 05. step_definitions
 +
** This folder contains the definitions of the steps you've described in your feature files. Any file ending with "_steps.rb" will be included in the execution. So you can create the files however you feel it will be most organized.
 +
* 11. example.feature
 
** This file contains your test cases, split up in Features which contain Scenario's which Contains Steps.
 
** This file contains your test cases, split up in Features which contain Scenario's which Contains Steps.
 
** More information about writing Feature files can be found in [[Writing_gherkin_test_cases_in_cucumber]]
 
** More information about writing Feature files can be found in [[Writing_gherkin_test_cases_in_cucumber]]
* 05. step_definitions
 
** This folder contains the definitions of the steps you've described in your feature files. Any file ending with "_steps.rb" will be included in the execution. So you can create the files however you feel it will be most organized.
 
 
* 08. /support/
 
* 08. /support/
** More information about this in the Advanced tutorial.
+
** This folder contains files that support writing steps or the execution. Env.rb does things like setting up a profile before a browser is opened. Functions.rb can be used to place methods you're using often.
* 12. /log/
+
* 13. /log/
 
** This will contain logging information after each test you have executed
 
** This will contain logging information after each test you have executed
* 13. /results/
+
* 14. /results/
 
** Can be used to export results of you test run to
 
** Can be used to export results of you test run to
* 14. /screenshots/
+
* 15. /screenshots/
 
** Any screenshot taken by your scripts will be stored in this folder.
 
** Any screenshot taken by your scripts will be stored in this folder.
  
  
 
[[Category:Web Test Automation Tutorial|2]]
 
[[Category:Web Test Automation Tutorial|2]]

Revision as of 10:57, 14 March 2017

Creating the project folder

The easiest way to do this is using Lapis_Lazuli's build in create function. This will create all needed folders and files to get started. If you like, you could also do this manually.

  1. Open the console
  2. Go to the folder where you want to create you project
    • For example: cd C:/ruby/projects/
  3. Write lapis_lazuli create <projectname>
    • Where <projectname> is the name of your project without `<>`
Console result creating project


Test running the project

The project created by Lazis Lazuli has some basic scripts. To confirm it's working properly, let's run it!

Continue from where we left off in the console:

> cd <projectname>
> cucumber

You should see a browser pop-up after a few seconds and click trough some pages. In the end the console should show something like:

1 scenario (1 passed)
3 steps (3 passed)
0m10.054s

Folder structure

After creating your project, you will have a folder structure similar as below. Feel free to click around the folders and open the files. The recommended (free) program to use is Notepad++.

Textual presentation of the folder structure

01.─┬/config/
02. ├─> config.yml
03. └─> cucumber.yml
04.─┬/features/
05. ├─┬/step_definitions/
06. │ ├─> interaction_steps.rb
07. │ └─> validation_steps.rb
08. ├─┬/support/
09. │ ├─> env.rb
10. | └─> functions.rb
11. ├─> example.feature
12. └─> mobile.feature
13.──/log/
14.──/results/
15.──/sceenshots/

Extra information

About Bundle gem

Detailed information about every folder

  • 01. /config/
    • This folder contains configuration information about your project. Some handy things you can do here is write credentials that will later be re-used throughout your whole automation project.
  • 04. /features/
    • This is the core of your project. It contains the test cases, the code executed in the steps of your test cases and any other code you wish to write for your solution.
  • 05. step_definitions
    • This folder contains the definitions of the steps you've described in your feature files. Any file ending with "_steps.rb" will be included in the execution. So you can create the files however you feel it will be most organized.
  • 11. example.feature
    • This file contains your test cases, split up in Features which contain Scenario's which Contains Steps.
    • More information about writing Feature files can be found in Writing_gherkin_test_cases_in_cucumber
  • 08. /support/
    • This folder contains files that support writing steps or the execution. Env.rb does things like setting up a profile before a browser is opened. Functions.rb can be used to place methods you're using often.
  • 13. /log/
    • This will contain logging information after each test you have executed
  • 14. /results/
    • Can be used to export results of you test run to
  • 15. /screenshots/
    • Any screenshot taken by your scripts will be stored in this folder.