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.
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.
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.
This time I chose Windows / Python / Visual Studio Code.
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.
As soon as I searched for the extension with "Gauge" in VS Code, it came out.
Install。
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.
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 ...
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.
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