don't stop believing

gauge 개발 환경 만들기 2 (by Docker) 본문

Testing Automation/Gauge

gauge 개발 환경 만들기 2 (by Docker)

Tongchun 2018. 6. 4. 10:29

gauge 개발환경 두 번째입니다.


Gauge로 API 자동화 툴을 만들려고 하는데 IDE는 Visual Studio Code로 진행할 예정입니다.

Visual Studio Code는 gauge plugin을 제공합니다.

Visual Studio Code를 설치하려면 아래 url에서 다운받아 설치하면 됩니다.

https://code.visualstudio.com/


Visual Studio Code가 설치되어 있다면 좌측 메뉴에서 확장을 클릭하고 gauge를 검색합니다.

gauge가 검색되면 설치를 해줍니다.


이번에는 docker image를 다시 열어 봅시다.

nglegauge 0.0.1을 가지고 api test용 Container를 만들겠습니다.  Container를 만들때 -v 옵션으로 로컬 PC와 Container에 Directory를 연결하겠습니다.

docker image를 다시 확인해 봅시다.

1
2
3
4
5
6
7
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
nglegauge 0.0.1 521e7493588b 2 days ago 965MB
tongchun/nglegauge 0.0.1 521e7493588b 2 days ago 965MB
python latest 29d2f3226daf 4 weeks ago 912MB
swift latest e8dc956c3315 5 weeks ago 1.35GB
ubuntu latest 452a96d81c30 5 weeks ago 79.6MB
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

tongchun/nglegauge 이미지로 container를 만들어 봅시다.

container를 만들때 directory를 연결해야 하니 로컬 PC에 적당한 폴더를 만들어 줍니다. 제 PC는 Mac 이라 아래와 같이 폴더를 만들었습니다.

/Users/tongchunkim/Documents/Gauge/apitest


로컬 PC에서 만든 apitest 폴더를 Container의 /apitest와 연결해 만들어 줍니다.

1
$ docker run -it --name apitest -v /Users/tongchunkim/Documents/Gauge/apitest:/apitest tongchun/nglegauge:0.0.1 /bin/bash
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Container에 연결된 후 ls -al 명령으로 root directory를 확인하면 /apitest directory가 생성된 것을 확인할 수 있습니다.

/apitest로 이동해서 gauge를 초기화 해줍니다.

1
2
3
4
5
# gauge init python
Downloading python.zip
.
Copying Gauge template python to current directory ...
Successfully initialized the project. Run specifications with "gauge run specs/".
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

gauge를 초기화하면 gauge 기본 파일들이 생성됩니다.

1
2
3
4
5
6
7
8
9
10
11
# ls -al
total 16
drwxr-xr-x 9 root root 288 Jun 4 03:01 .
drwxr-xr-x 1 root root 4096 Jun 4 03:40 ..
-rw-r--r-- 1 root root 131 Jun 4 03:01 .gitignore
drwxr-xr-x 3 root root 96 Jun 4 03:01 .vscode
drwxr-xr-x 3 root root 96 Jun 4 03:01 env
-rw-r--r-- 1 root root 64 Jun 4 03:01 manifest.json
-rw-r--r-- 1 root root 9 Jun 4 03:01 requirements.txt
drwxr-xr-x 3 root root 96 Jun 4 03:01 specs
drwxr-xr-x 4 root root 128 Jun 4 03:01 step_impl
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

연결된 directory인 로컬 PC의 apitest 폴더에도 동일한 폴더와 파일이 있는지 확인해 봅니다.

tree로 Directory구조를 확인해 보겠습니다.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# tree
.
├── env
·· └── default
·· ├── default.properties
·· └── python.properties
├── manifest.json
├── requirements.txt
├── specs
·· └── example.spec
└── step_impl
├── __init__.py
└── step_impl.py
4 directories, 7 files
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

바로 실행해 보겠습니다.

1
2
3
4
5
6
7
8
9
10
11
# gauge run specs
Python: 3.6.5
# Specification Heading
## Vowel counts in single word ✔ ✔
## Vowel counts in multiple word ✔ ✔
Successfully generated html-report to => /apitest/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: 1.257s
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

실행 잘 되는군요.

/apitest/reports/html-report/index.html로 Report도 잘 떨구네요.

여기까지 Docker를 이용한 gauge 환경구성 이었습니다.



Comments