如何使用travis-ci.org测试需要键盘输入的项目?

Ado*_*rea 2 python continuous-integration python-2.7 python-3.x travis-ci

我试图在travis-ci(持续集成平台)中测试一个简单的菜单算法,等待用户输入执行任务(CRUD), 如:

显示,添加,删除,更新注册表或退出.

以下是示例代码:

Python代码

这是我的.travis.yml文件:

language: python
python:
  - "2.6"
  - "2.7"
  - "3.2"
  - "3.3"
  - "3.4"
  - "3.5"
  - "3.5-dev" # 3.5 development branch
  - "nightly" # currently points to 3.6-dev
# command to install dependencies
# install: "pip install -r requirements.txt"
# command to run tests
script: 
  - python 1aula_agenda.py
Run Code Online (Sandbox Code Playgroud)

这是travis-ci.org的输出:

0.00s$ source ~/virtualenv/python2.7/bin/activate
$ python --version
Python 2.7.9
$ pip --version
pip 6.0.7 from /home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages (python 2.7)
Could not locate requirements.txt. Override the install: key in your .travis.yml to install dependencies.
$ python 1aula_agenda.py
0. Visualizar
1. Inserir um contato
2. Remover um contato
3. Alterar um contato
4. Sair do programa
Escolha uma opcao: 
No output has been received in the last 10 minutes, this potentially indicates a stalled build or something wrong with the build itself.
The build has been terminated
Run Code Online (Sandbox Code Playgroud)

我怎样才能做到这一点特拉维斯测试所有的选项0,1,2,3,4,并添加一个名称,并在选项1和3的情况下是多少?

Ado*_*rea 5

可以testing.txt使用电池测试创建一个文件来测试程序的功能.

testing.txt包含程序所需的键盘输入.例如,测试你的例子

0
1
"John Smith"
"1235-5387"
0
4
Run Code Online (Sandbox Code Playgroud)

并在.travis.yml文件中包含testing.txt:

language: python
python:
  - "2.6"
  - "2.7"
  - "3.2"
  - "3.3"
  - "3.4"
  - "3.5"
  - "3.5-dev" # 3.5 development branch
  - "nightly" # currently points to 3.6-dev
# command to install dependencies
# install: "pip install -r requirements.txt"
# command to run tests
script: 
  - python 1aula_agenda.py < testing.txt
Run Code Online (Sandbox Code Playgroud)