本文介绍了在测试运行之前和之后运行单个功能文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正在寻找在套件末尾运行功能文件的解决方案我的工作流程(并行运行)

Was looking for a solution to run a feature file at the end of the suiteMy workflow (In parallel Run)

  1. karate.callSingle('Login.feature'),所以一开始我会做一个登录,然后在整个套件中使用cookie/令牌
  2. 并行运行测试
  3. 运行Logout.feature文件

推荐答案

当前尚无直接支持.顺便说一句,没有人要求过.如果这很重要,请打开功能请求.

There is no direct support for this currently. By the way no one has ever requested this. If this is so important, kindly open a feature request.

一种解决方法是从 callSingle 设置单例/Java静态变量,然后在您的JUnit/Java并行运行器中,调用该功能以使用Java API登出(在此搜索文档)并您可以传递参数/访问静态变量.

One workaround is to set a singleton / Java static variable from callSingle and then in your JUnit / Java parallel runner, call the feature to logout using the Java API (search the docs for this) and you can pass arguments / access the static variable.

刚刚意识到 @AfterClass JUnit注释可能不足以满足您的需求.

just realized that the @AfterClass JUnit annotation may be more than sufficient for your needs.

这篇关于在测试运行之前和之后运行单个功能文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 22:47