我有一个非常简单的Jenkins Multijob项目:
我想设置Multijob状态如下:
我知道我可以使用带有如下脚本的Groovy post构建操作,但我不知道如何设置所需的阈值级别:
void log(msg) {
manager.listener.logger.println(msg)
}
threshold = Result.SUCCESS
void aggregate_results() {
failed = false
mainJob = manager.build.getProject().getName()
job = hudson.model.Hudson.instance.getItem(mainJob)
log '-------------------------------------------------------------------------------------'
log 'Aggregated status report'
log '-------------------------------------------------------------------------------------'
log('${mainJob} #${manager.build.getNumber()} - ${manager.build.getResult()}')
job.getLastBuild().getSubBuilds().each { subBuild->
subJob = subBuild.getJobName()
subJobNumber = subBuild.getBuildNumber()
job = hudson.model.Hudson.instance.getItem(subBuild.getJobName())
log '${subJob} #${subJobNumber} - ${job.getLastCompletedBuild().getResult()}'
log job.getLastCompletedBuild().getLog()
//println subBuild
dePhaseJob = hudson.model.Hudson.instance.getItem(subBuild.getJobName())
dePhaseJobBuild = dePhaseJob.getBuildByNumber(subBuild.getBuildNumber())
dePhaseJobBuild.getSubBuilds().each { childSubBuild …
Run Code Online (Sandbox Code Playgroud) 我是 Jenkins 的新手,我正在尝试简单地从 Bitbucket 上存储的代码运行构建。我正在使用 git。我已将作业源代码控制设置为 https 协议: url: https://myaccount@bitbucket.org/myaccount/myrepo.git 凭据:用户名/密码
“build”部分指向根目录中的 pom.xml 并运行干净的测试 Maven 目标
我有 Git 插件 2.5.2
我将 Jenkins 作为 Windows 服务 (Windows 10) 运行。
构建项目时的错误是
ERROR: Timeout after 10 minutes
Run Code Online (Sandbox Code Playgroud)
git.exe config --local --remove-section credential # timeout=10 错误:获取远程存储库“origin”时出错 hudson.plugins.git.GitException:无法从https://username@bitbucket.org/username/获取myrepo.git 在 hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:799) 在 hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1055) 在 hudson.plugins.git.GitSCM.checkout(GitSCM. java:1086) 在 hudson.scm.SCM.checkout(SCM.java:495) 在 hudson.model.AbstractProject.checkout(AbstractProject.java:1270) 在 hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:604) )在 jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86) 在 hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529) 在 hudson.model.Run.execute(Run.java:1720) 在 hudson .maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:531) 在 hudson.model.ResourceController.execute(ResourceController.java:98) 在 hudson.model.Executor.run(Executor.java:404) 引起:hudson.plugins。 git.GitException:命令“git.exe -c core.askpass=true fetch --tags --progress https://username@bitbucket.org/username/myrepo.git +refs/heads/ …
经过大量的搜索和阅读,我仍然不清楚使用Webdriver处理失败的断言的最佳方法.我原以为这是一个常见的核心功能.我想做的就是:
我想为非技术受众呈现结果,因此让它使用完整堆栈跟踪抛出'NoSuchElementExceptions'是没有用的.我只想要一个好消息.
我的测试:
@Test
public void isMyElementPresent(){
// WebElement myElement driver.findElement(By.cssSelector("#myElement"));
if(driver.findElement(By.cssSelector("#myElement"))!=null){
System.out.println("My element was found on the page");
}else{
System.out.println("My Element was not found on the page");
}
}
Run Code Online (Sandbox Code Playgroud)
当我强制失败时,我仍然会抛出NoSuchElementException.我还需要尝试/捕获吗?我是否可以合并Junit断言和/或Hamcrest来生成更有意义的消息而无需System.out.println?
所以我有一些包含运行时参数的 TestNG SuiteXML 文件,如下所示:-
<!--SERVER AND TARGET PARAMS-->
<parameter name="environment" value="${environment}"/>
<parameter name="port" value="${port}"/>
Run Code Online (Sandbox Code Playgroud)
我的 POM 看起来像这样:
<?xml version="1.0" encoding="UTF-8"?>
Run Code Online (Sandbox Code Playgroud)
http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0
<groupId>co.uk.multicom.test.project</groupId>
<artifactId>fab-handler-automation</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<sl4j.version>1.7.7</sl4j.version>
<suiteFile>${suiteFile}</suiteFile>
<environment>${environment}</environment>
<port>${port}</port>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<systemProperties>
<property>
<name>javax.xml.parsers.SAXParserFactory</name>
<value>org.apache.xerces.jaxp.SAXParserFactoryImpl</value>
</property>
<property>
<name>user.language</name>
<value>en</value>
</property>
</systemProperties>
<!--<testFailureIgnore>true</testFailureIgnore>-->
<suiteXmlFiles>
<suiteXmlFile>${suiteFile}</suiteXmlFile>
</suiteXmlFiles>
<systemPropertyVariables>
<environment>${environment}</environment>
<port>${port}</port>
</systemPropertyVariables>
<properties>
<property>
<name>parallel</name>
<value>methods</value>
</property>
<property>
<name>threadCount</name>
<value>1</value>
</property>
<property>
<name>dataproviderthreadcount</name>
<value>1</value>
</property>
</properties>
</configuration> …
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 Jest 来帮助在 WebStorm 中进行 Puppeteer 测试。
这是我第一次使用 Jest,它看起来只是我需要帮助进行测试、断言、设置和拆卸等的框架......
问题是,WebStorm 无法识别关键字,例如 beforeAll、describe、afterAll。这是一个片段:
我的 package.json 文件如下所示:
{
"name": "ui-tests",
"version": "1.0.0",
"description": "End-to-end UI tests",
"author": "John Doe",
"license": "MIT",
"dependencies": {
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-scripts": "1.0.17"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "jest",
"debug": "NODE_ENV=debug npm test",
"eject": "react-scripts eject"
},
"jest": {
"testURL": "http://localhost"
},
"devDependencies": {
"faker": "^4.1.0",
"jest-cli": "^22.0.4",
"jest": "^22.0.4",
"puppeteer": "^1.9.0"
}
Run Code Online (Sandbox Code Playgroud)
}
我安装了以下插件:
有任何想法吗?
谢谢
我开始使用这些技术(包括Javascript),所以,一个初学者的问题.我正在努力弄清楚如何断言HTML属性中的给定文本是否符合预期.
HTML代码段:
<input name="8hv3a" type="radio" id="email-optout-8hv3a" value="1|optin|out" data-com.user-edited="yes">
Run Code Online (Sandbox Code Playgroud)
到目前为止,这是我的.it功能,使用了Mochai,Puppeteer和Chai(为了清晰起见,设置和拆卸已被省略:
it('opt out of email', async function () {
await page.setDefaultNavigationTimeout();
await page.waitForSelector('.widget-title');
const frame = page.frames().find(frame => frame.name() === 'iframe');
const emailOptOutButton = await frame.$('#email-optout-8hv3a');
await emailOptOutButton.click();
const emailOptOutConfirmedValue = await frame.$('#email-optout-8hv3a', e => e.getAttribute('data-com.user-edited'))
expect(emailOptOutConfirmedValue).to.include('yes')
})
Run Code Online (Sandbox Code Playgroud)
一切都在点击事件之前一直有效,但我的断言显然是错误的.错误是:
AssertionError: object tested must be an array, a map, an object, a set, a string, or a weakset, but object given
Run Code Online (Sandbox Code Playgroud)
我试过了
it('opt out of email', async function () {
await page.setDefaultNavigationTimeout();
await …
Run Code Online (Sandbox Code Playgroud) 我正在学习 Spring Boot,并且有一个关于如何从 CLI 运行的初学者问题。
在 IntelliJ 中,当使用 JUnit 运行配置或从右键单击上下文菜单中时,我在控制台中看到 Spring Boots 的独特徽标。如果我使用.gradlew clean test
测试运行完全相同,但没有任何 spring-y 的东西。
测试类:
@SpringBootTest
@Profile("dev")
class SpringBasicApplicationTests {
@Autowired
private MainPage mainPage;
@Value("${app.url}")
private String appUrl;
@Autowired
private WebDriver driver;
@Test
void performLoginTest() {
mainPage.performLogin();
}
}
Run Code Online (Sandbox Code Playgroud)
build.gradle
plugins {
id 'org.springframework.boot' version '2.4.5'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java'
id 'io.freefair.lombok' version '5.3.0'
}
apply plugin: 'io.spring.dependency-management'
group = 'com.ea'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'
repositories {
mavenCentral()
}
dependencies { …
Run Code Online (Sandbox Code Playgroud) 我正在同时学习 Playwright 和 JavaScript,所以这可能是一个基本问题 - 我想知道人们如何建议customerId
在测试之间共享状态 - 在这种情况下是变量。
例子:
test.describe.only('Generate a new customer', () => {
let customerId
let baseUrl = process.env.SHOP_URL
test('Create new customer', async ({ request }) => {
const response = await request.post(baseUrl + `/shopify/v5/customer`, {})
const responseBody = JSON.parse(await response.text())
expect(response.status()).toBe(200)
customerId = responseBody.customerId //need to persist customerId to pass into following test
})
test('Update customer details', async ({ request }) => {
const response = await request.post(baseUrl + `/shopify/v5/customer/update`, {})
{
data: { …
Run Code Online (Sandbox Code Playgroud) 我不清楚为什么我仍然在这个Webdriver测试中抛出NoSuchElementException?
任何人都可以调试或建议更有效/更多的解决方案吗?
注意 - 如果我尝试使用driver.findElements(By.id("...")),我会得到同样的错误.size()!= 0
boolean present;
try{
driver.findElement(By.cssSelector(".message-bg-color>table>tbody>tr>td>h3"));
present = true;
}catch (NoSuchElementException e){
present = false;
}
if(!present) {
// do some stuff
}
else
{
//do some otherstuff
}
Run Code Online (Sandbox Code Playgroud)
堆栈跟踪:
org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"css selector","selector":".message-bg-color>table>tbody>tr>td>h3"}
Command duration or timeout: 1.17 seconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.41.0', revision: '3192d8a6c4449dc285928ba024779344f5423c58', time: '2014-03-27 11:29:39'
System info: host: 'L-IS08381', ip: '172.19.248.194', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_51'
Session …
Run Code Online (Sandbox Code Playgroud) 我试图简单地将最新的 Selenium 2.44.0 添加到我在 IntelliJ 中的项目中,出于某种原因,它对 2.42.0 感到满意,但 2.44.0 错误与
“依赖关系 '''org.seleniumhq.selenium:selenium-java:2.44.0''' 未找到”
任何想法发生了什么?我的 POM 全文:-
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.test.testproj</groupId>
<artifactId>twitterati</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.3
</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.44.0</version>
</dependency>
</dependencies>
Run Code Online (Sandbox Code Playgroud)