我想完整输入我的 Python 项目。但我坚持使用可以使用不同参数调用的构造函数。
我试图从最终的构造函数中删除类型,我试图删除一些构造函数......但仍然遇到同样的问题。
class PageObject(ABC):
logger = logging.getLogger(__name__)
@overload
def __init__(self, driver: Driver) -> None:
...
@overload
def __init__(self, by: Tuple[By, str], driver: Driver) -> None:
...
@overload
def __init__(self, context: WebElement, driver: Driver) -> None:
...
@overload
def __init__(self, by: Tuple[By, str], parent: "PageObject") -> None:
...
@overload
def __init__(self, parent: "PageObject") -> None:
...
def __init__(
self,
by: Optional[Tuple[By, str]] = None,
context: Optional[WebElement] = None,
parent: Optional["PageObject"] = None,
driver: Optional[Driver] = None,
) -> None: …Run Code Online (Sandbox Code Playgroud) Since several days, I tried to see where is my mistake in my configuration to run in parallel my Selenium tests.
I have a Selenium Grid with 2 nodes. In my pom.xml, I have set surefire to run 2 by 2 the methods of my tests with a particular category then other tests.
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<executions>
<execution>
<id>default-test</id>
<goals>
<goal>test</goal>
</goals>
<configuration>
<parallel>methods</parallel>
<perCoreThreadCount>false</perCoreThreadCount>
<threadCount>2</threadCount>
<reuseForks>false</reuseForks>
<groups>
com.something.categories.Safe,
com.something.categories.Parallel
</groups>
</configuration>
</execution>
<execution>
<id>no-safe</id>
<goals>
<goal>test</goal> …Run Code Online (Sandbox Code Playgroud) junit selenium maven maven-surefire-plugin selenium-webdriver
我的团队拥有一个非回归测试项目。在这个项目中,有代码和非回归测试。与经典项目一样,我们希望使用 linter 或其他工具来分析我们的代码。但我们不想在每个提交的每个分支上运行测试,它们会持续几个小时。我们想手动启动这些测试。
要专门在 master 上运行测试,我们的 Jenkinsfile 中有以下内容:
stage("Test") {
when {branch "master"}
steps {
sh 'pipenv run pytest -n5 --dist=loadscope --junitxml report.xml |
}
post {
always {
junit 'report.xml'
}
}
}
Run Code Online (Sandbox Code Playgroud)
但是,一旦我们将分支合并到 master 中,就会触发 master 上的构建并启动测试。
为了避免这种情况,我想我必须使用when块的triggeredBy参数: https: //jenkins.io/doc/book/pipeline/syntax/
但我找不到哪个TriggerBy映射手动启动事件(当我们单击Jenkins界面中的运行按钮时发送的事件)。