首页 > 其他分享 >【自动化测试】Pytest+Appium+Allure 做 UI 自动化的那些事

【自动化测试】Pytest+Appium+Allure 做 UI 自动化的那些事

时间:2022-12-10 12:55:20浏览次数:56  
标签:Appium container runner image access Allure entrypoint 自动化 Docker

Override the entrypoint of an image

Introduced in GitLab and GitLab Runner 9.4. Read more about the extended configuration options.

Before explaining the available entrypoint override methods, let’s describe how the runner starts. It uses a Docker image for the containers used in the CI/CD jobs:

  1. The runner starts a Docker container using the defined entrypoint. The default from Dockerfile that may be overridden in the .gitlab-ci.yml file.
  2. The runner attaches itself to a running container.
  3. The runner prepares a script (the combination of before_scriptscript, and after_script).
  4. The runner sends the script to the container’s shell stdin and receives the output.

To override the entrypoint of a Docker image, define an empty entrypoint in the .gitlab-ci.yml file, so the runner does not start a useless shell layer. However, that does not work for all Docker versions.

  • For Docker 17.06 and later, the entrypoint can be set to an empty value.
  • For Docker 17.03 and earlier, the entrypoint can be set to /bin/sh -c/bin/bash -c, or an equivalent shell available in the image.

The syntax of image:entrypoint is similar to Dockerfile’s ENTRYPOINT.

Let’s assume you have a super/sql:experimental image with a SQL database in it. You want to use it as a base image for your job because you want to execute some tests with this database binary. Let’s also assume that this image is configured with /usr/bin/super-sql run as an entrypoint. When the container starts without additional options, it runs the database’s process. The runner expects that the image has no entrypoint or that the entrypoint is prepared to start a shell command.

With the extended Docker configuration options, instead of:

  • Creating your own image based on super/sql:experimental.
  • Setting the ENTRYPOINT to a shell.
  • Using the new image in your CI job.

You can now define an entrypoint in the .gitlab-ci.yml file.

For Docker 17.06 and later:

image:
  name: super/sql:experimental
  entrypoint: [""]

For Docker 17.03 and earlier:

image:
  name: super/sql:experimental
  entrypoint: ["/bin/sh", "-c"]

Define image and services in config.toml

Look for the [runners.docker] section:

[runners.docker]
  image = "ruby:latest"
  services = ["mysql:latest", "postgres:latest"]

The image and services defined this way are added to all jobs run by that runner.

Access an image from a private Container Registry

To access private container registries, the GitLab Runner process can use:

To define which option should be used, the runner process reads the configuration in this order:

  • DOCKER_AUTH_CONFIG CI/CD variable.
  • DOCKER_AUTH_CONFIG environment variable set in the runner’s config.toml file.
  • config.json file in $HOME/.docker directory of the user running the process. If the --user flag is provided to run the child processes as unprivileged user, the home directory of the main runner process user is used.

Requirements and limitations

  • Available for Kubernetes executor in GitLab Runner 13.1 and later.
  • Credentials Store and Credential Helpers require binaries to be added to the GitLab Runner $PATH, and require access to do so. Therefore, these features are not available on shared runners, or any other runner where the user does not have access to the environment where the runner is installed.

Use statically-defined credentials

There are two approaches that you can take to access a private registry. Both require setting the CI/CD variable DOCKER_AUTH_CONFIG with appropriate authentication information.

  1. Per-job: To configure one job to access a private registry, add DOCKER_AUTH_CONFIG as a CI/CD variable.
  2. Per-runner: To configure a runner so all its jobs can access a private registry, add DOCKER_AUTH_CONFIG as an environment variable in the runner’s configuration.

标签:Appium,container,runner,image,access,Allure,entrypoint,自动化,Docker
From: https://www.cnblogs.com/sdfasdf/p/16971411.html

相关文章

  • tep支持pytest-xdist分布式执行用例及合并Allure报告
    tep近期更新频率较快,一方面是作者在积极投入到tep工具开发中;另一方面是我们聚集了20位小伙伴,一起合力打造EasyPytest测试平台,teprunner的FastAPI升级版本,依托于tep,帮你高......
  • allure环境搭建
    1、首先在官网下载allure:​​https://qameta.io/allure-report/​​2、下载解压后,配置环境变量3、在cmd命令行中查看allure是否配置成功4、python安装allure环境5、生成allu......
  • pytest-web自动化小项目2
    一、项目目录结构page/:用于存放page层封装(对于page层的封装文件,命名规范为“xxx_page.py”)test_case/:测试用例目录(对于test_dir层的封装文件,命名规范为“test_x......
  • Selenium 自动化中实现双击操作
    在selenium中,以name定位为例,单击元素的代码为:driver.find_element_by_name(“name”).click(),那么,实现双击操作的代码能不能写成:driver.find_element_by_name(“name”).do......
  • pytest + yaml 框架 -10.allure 生成报告
    前言本插件是基于pytest框架开发的,所以pytest的插件都能使用,生成报告可以用到allure报告pip安装插件pipinstallpytest-yaml-yoyoallure报告功能在v1.0.8版本......
  • 蜻蜓:GitLab结合fortify实现自动化代码扫描实践
    一、背景在甲方做安全的同学可能会有一项代码审计的工作,通常需要从gitlab把代码拉取下来,然后使用代码审计工具进行扫描,然后对结果进行人工确认;在这个流程中需要做的事情比......
  • 自动化测试高手课-学习笔记
    课程链接github链接Job框架1自动化测试我对自动化测试架构师的定义是,不仅仅是写代码让自动化测试跑起来,而且能够超脱于工具框架的层面,对测试需求和自动化ROI一起抽......
  • 关于手机app或者小程序自动化如何移动滑块
    1.前言最近由于某多频繁升级为了有数据无奈弄了自动化.自动化难点在于滑块处理2.自动化工具选择airtest1.正常协议过滑块首先计算出缺口图片到滑块图片的距离然后与本......
  • jekins接口自动化windows部署一本地代码
    一、登录jekins管理端,新建项目(新建item)      二、进入项目详情-首次构建,生成工作空间三、查看构建历史记录--控制台输出,  四、找到工作空间目录 ......
  • Acrel-1000变电站综合自动化系统在某机械制造公司35kV变电站改造应用
    摘要:随着国家经济的发展,企业的业务扩大,用电负载需求也不断提供,使我国电站综合自动化系统不断在应用中获得改善,让电站综合自动化改造技术持续提高。目前大部分先进设备以及......