小编Tem*_*Log的帖子

在Windows 7上的jenkins中执行selenium(testng)测试时找不到Chrome二进制文件

我有selenium和testng的基本登录测试.从eclipse执行时,它按预期工作并调用Google Chrome.如果从TESTNG命令行执行,它也可以正常工作.

这是我的@Before:

@BeforeMethod
public void setUp() throws Exception { 
 File file = new File("C:/Selenium-driver/chromedriver.exe"); 
 System.setProperty("webdriver.chrome.driver", file.getAbsolutePath()); 
 driver = new ChromeDriver(); 
 driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); 
 }
Run Code Online (Sandbox Code Playgroud)

但是,如果我通过Jenkins执行相同的测试,它说:

Building in workspace C:\EclipsePortable\Data\workspace\GS_TESTNG 
[G_TESTNG] $ cmd /c call C:\Windows\TEMP\hudson9049518275115936054.bat 

C:\EclipsePortable\Data\workspace\G_TESTNG>_test_login_cmd.bat 

C:\EclipsePortable\Data\workspace\G_TESTNG>cd C:\EclipsePortable\Data\workspace\G_TESTNG 

C:\EclipsePortable\Data\workspace\G_TESTNG>java -cp C:\EclipsePortable\Data\workspace\G_TESTNG\lib\*;C:\EclipsePortable\Data\workspace\G_TESTNG\bin org.testng.TestNG testng.xml 
... 
... TestNG 6.9.9 by Cédric Beust (cedric@beust.com) 
... 

[TestNG] Running: 
  C:\EclipsePortable\Data\workspace\G_TESTNG\testng.xml 

Starting ChromeDriver 2.26.436362 (5476ec6bf7ccbada1734a0cdec7d570bb042aa30) on port 36257 
Only local connections are allowed. 
FAILED CONFIGURATION: @BeforeMethod setUp 
org.openqa.selenium.WebDriverException: unknown error: cannot find Chrome binary 
  (Driver info: …
Run Code Online (Sandbox Code Playgroud)

testng selenium jenkins

7
推荐指数
2
解决办法
3万
查看次数

使用groovy从文本文件中提取一行中包含的值

我想从文本文件中提取一行中的令牌值。

文本文件中的行是:

<response>{"timestamp": "2013-11-12T14:55:43Z", "data": {"profile": null, "ticket": "f644231-6d46-44c7-add6-de3a4422871e", </response>
Run Code Online (Sandbox Code Playgroud)

常规文件是:

    // read the file from path
    def file = new File('c:/tmp/response.txt')
    // for example read line by line
    def data= file.eachLine { line ->
        // check if the line contains your data 
        if(line.contains('"ticket":')){
            return line     
        }
    }
testRunner.testCase.testSuite.project.setPropertyValue('ticket',data)
Run Code Online (Sandbox Code Playgroud)

因此,这里的可变票证中没有存储任何值。任何帮助,请

groovy text-files

3
推荐指数
1
解决办法
7204
查看次数

Groovy无法连接到postgresql数据库?

我正在使用Ready API 1.4.0,我尝试使用这个groovy代码连接到postgresql.

import groovy.sql.Sql
import java.sql.Driver

def driver = Class.forName('org.postgresql.Driver').newInstance() as Driver 

def props = new Properties()
props.setProperty("DB_user", "user") 
props.setProperty("DB_password", "user")

def conn = driver.connect("jdbc:postgresql://localhost:54320/database_name", props) 
def sql = new Sql(conn)

try {
    sql.eachRow("select * from user") {
        log.debug(it)
    }
} finally {
    sql.close()
    conn.close()
}
Run Code Online (Sandbox Code Playgroud)

然后我收到了这个错误:

java.lang.ClassNotFoundException:org.postgresql.Driver at line:4

我在bin/ext postgresql-9.4-1205.jdbc42.jar中添加了这个jar lib

有什么帮助吗?谢谢.

postgresql groovy

2
推荐指数
1
解决办法
3486
查看次数

标签 统计

groovy ×2

jenkins ×1

postgresql ×1

selenium ×1

testng ×1

text-files ×1