[PYTHON] Until you install Gauge and run the official sample

Basically, the official Documents are extensive, so if you read it, you can start using it smoothly.

However, some

――It doesn't work even if you do it according to the official --The procedure is missing ――The whole is in English

I wrote it thinking that there is no point in explaining it again.

What is Gauge in the first place?

It is a tool that allows you to write specifications in Markdown and perform automatic testing. That doesn't mean you only have to write Markdown, you also need to code.

For example, in order to realize the process of "searching for something on the net" (a scenario in Gauge units)

--Transition to Google Home --Search for "hoge"

(Steps in Gauge units) is required.

Code each step as follows.

step("Goto Google's home page", () => {
  goto("google.com")
});

step("Search for <query>", (query) => {
  write(query);
  press("Enter");
});

When writing the actual test scenario, call these and write as follows.

# Search the internet

## Look for cakes
* Goto Google's home page
* Search for "Cup Cakes"

## Look for movies
* Goto Google's home page
* Search for "Star wars"

Compared to coding the test procedure with Selenium as it is, the content of the test is easy to understand at a glance because it is close to natural language, and it is said to be suitable for testers.

You might think "BDD?" When you write it like this, but Gauge's formula says "We don't provide BDD tools."

Minding the Gap between BDD and Executable Specifications | Gauge Blog

Although there are instances where our users use Gauge as a BDD Tool, our focus hasn't been BDD but on building features that give teams the confidence to release.

It says that we want to focus on features that give the team the courage to release.

1. Installation

Follow the official installation instructions.

Gauge Documentation — Gauge 0.9.9 documentation

If you select the OS, language and IDE, the installation procedure will come out according to it. I was impressed when I first saw this.

Gauge_1.PNG

This time I chose Windows / Python / Visual Studio Code.

1-1. Installation of Gauge

There is a link for the installer, so click it to download and run the installer.

During the installation process, you will be asked to select a component.

Additional plugins can be install using the command 'gauge install <plugin>'

As you can see, you can add it later, so check only the Python you need at this point.

Gauge_2.PNG

1-2. Install VS Code extension

As soon as I searched for the extension with "Gauge" in VS Code, it came out.

Install。

Gauge_3.PNG

2. Make a project

Successful procedure

Create a folder for the Gaufe project and execute the following command in it.

> gauge init python

I succeeded in an instant.

C:\>gauge init python

Telemetry
---------

This installation of Gauge collects usage data in order to help us improve your experience.
The data is anonymous and doesn't include command-line arguments.
To turn this message off opt in or out by running 'gauge telemetry on' or 'gauge telemetry off'.

Read more about Gauge telemetry at https://gauge.org/telemetry


Downloading python.zip
.
Copying Gauge template python to current directory ...
Successfully initialized the project. Run specifications with "gauge run specs/".

Compatible language plugin python is not installed. Installing plugin...
.
Successfully installed plugin 'python' version 0.3.6

Use requirements.txt in your project to install the required modules,

> pip install -r requirements.txt

Let's run.

Failed procedure

I will leave it for the time being.

Follow the Gauge Documentation — Gauge 0.9.9 documentation (https://docs.gauge.org/getting_started/create-test-project.html?os=windows&language=python&ide=vscode).

Press Ctrl + Shift + p on VS Code to bring up the command palette

Gauge: Create a new Gauge Project

choose → Select Python → You will be asked to select the root of the folder, so select it → Set the project name

After that, I kept waiting with the message "Initializing project ..." displayed, and for some reason the process did not end ...

3. Run the sample

There is a sample file in the created project, so let's run it.

The command is

> gauge run specs

is.

If successful, the following log will be displayed.

C:>gauge run specs
Python: 3.7.2
# Specification Heading
  ## Vowel counts in single word         P P
  ## Vowel counts in multiple word       P P

Successfully generated html-report to => C:\hoge\reports\html-report\index.html
Specifications: 1 executed      1 passed        0 failed        0 skipped
Scenarios:      2 executed      2 passed        0 failed        0 skipped

Total time taken: 381ms

Then, a folder called reports is created in the project, and HTML reports are output in it.

gauge-report-sample.png

If an error occurs

If you get the following error, you probably haven't got the module getgauge. Please install using requirements.txt in the previous section.

(Abbreviated so far)
subprocess.CalledProcessError: Command '['C:\\hoge\\Python\\Python37\\python.exe -m pip install getgauge==0.3.6 --user']' returned non-zero exit status 1.
Traceback (most recent call last):
File "start.py", line 8, in <module>
import grpc
ModuleNotFoundError: No module named 'grpc'
Error ----------------------------------

[Gauge]
Failed to start gauge API: Runner with pid 27004 quit unexpectedly(exit status 1).

Get Support ----------------------------
        Docs:          https://docs.gauge.org
        Bugs:          https://github.com/getgauge/gauge/issues
        Chat:          https://gitter.im/getgauge/chat

Your Environment Information -----------
        windows, 1.0.6, 2bc49db
        html-report (4.0.8), python (0.3.6), screenshot (0.0.1)

Recommended Posts

Until you install Gauge and run the official sample
Until you install Caffe and run the sample
Until you install and run matplotlib
Until you run the changefinder sample in python
Until you can install blender and run it with python for the time being
Until you build the environment with ABCI and run MaskTrack RCNN
[Introduction to machine learning] Until you run the sample code with chainer
Until you install MySQL-python
Until you install Python with pythonbrew and run Flask on a WSGI server
Until you install Anaconda for data analysis on your Mac and launch the IDE
Try and learn iptables, until you can browse the web
Install and run dropbox on Ubuntu 20.04
Run Pylint and read the results
Quickly install OpenCV 2.4 (+ python) on OS X and try the sample
Until you run python with apache
[xgboost error] Cannot find XGBoost Libarary in the candicate path, did you install compilers and run build.sh in root path
Until you install Apache and Tomcat on Linux (CentOS) and deploy Java apps
Until you can read the error log
Until you install your own Python library
Until you install Arch Linux on VMware
Until you create an Ubuntu boot USB on your Macbook and install Ubuntu on your Thinkpad
Install the Python API of the autonomous driving simulator LGSVL and execute the sample program
Install and run Python3.5 + NumPy + SciPy on Windows 10
Until you use the Kaggle API with Colab
Run unit tests the moment you save the file
Until you can use the Google Speech API
[Mac] Run the RealSense D415 sample in Python
Until you create a machine learning environment with Python on Windows 7 and run it