I have some tests written in Selenide/Java.
Also I have local Jenkins on my Windows, tests are running under this Jenkins perfectly, but i have problem with tests from same repository running on external Jenkins (Linux)
Logs from Jenkins:
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running [1mTests[m
ERROR StatusLogger No Log4j 2 configuration file found. Using default configuration (logging only errors to the console), or user programmatically provided configurations. Set system property 'log4j2.debug' to show Log4j 2 internal initialization logging. See https://logging.apache.org/log4j/2.x/manual/configuration.html for instructions on how to configure Log4j 2
1491 [main] INFO com.github.javafaker.Faker - Using default locale en
Jul 08, 2019 2:36:49 PM com.codeborne.selenide.drivercommands.LazyDriver getAndCheckWebDriver
INFO: No webdriver is bound to current thread: 1 - let's create a new webdriver
Jul 08, 2019 2:36:49 PM java.util.prefs.FileSystemPreferences$1 run
INFO: Created user preferences directory.
2687 [main] INFO io.github.bonigarcia.wdm.WebDriverManager - Reading https://chromedriver.storage.googleapis.com/ to seek chromedriver
3700 [main] INFO io.github.bonigarcia.wdm.WebDriverManager - Latest version of chromedriver is 76.0.3809.25
3704 [main] INFO io.github.bonigarcia.wdm.Downloader - Downloading https://chromedriver.storage.googleapis.com/76.0.3809.25/chromedriver_linux64.zip
4066 [main] INFO io.github.bonigarcia.wdm.Downloader - Extracting binary from compressed file chromedriver_linux64.zip
4194 [main] INFO io.github.bonigarcia.wdm.WebDriverManager - Exporting webdriver.chrome.driver as /var/lib/jenkins/.m2/repository/webdriver/chromedriver/linux64/76.0.3809.25/chromedriver
Starting ChromeDriver 76.0.3809.25 (a0c95f440512e06df1c9c206f2d79cc20be18bb1-refs/branch-heads/3809#{#271}) on port 28990
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
Jul 08, 2019 2:36:52 PM com.codeborne.selenide.drivercommands.LazyDriver getAndCheckWebDriver
INFO: No webdriver is bound to current thread: 1 - let's create a new webdriver
Starting ChromeDriver 76.0.3809.25 (a0c95f440512e06df1c9c206f2d79cc20be18bb1-refs/branch-heads/3809#{#271}) on port 30572
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
[ERROR] [1;31mTests [0;1mrun: [0;1m3[m, [1;31mFailures: [0;1;31m3[m, Errors: 0, Skipped: 0, Time elapsed: 5.878 s[1;31m <<< FAILURE![m - in [1mTests[m
[ERROR] test001_logowanie_programs(Tests) Time elapsed: 3.105 s <<< FAILURE!
java.lang.IllegalStateException: No webdriver is bound to current thread: 1. You need to call open(url) first.
at Tests.test001_logowanie_programs(Tests.java:38)
[ERROR] test002_logowanie_evaluation(Tests) Time elapsed: 0.058 s <<< FAILURE!
java.lang.IllegalStateException: No webdriver is bound to current thread: 1. You need to call open(url) first.
at Tests.test002_logowanie_evaluation(Tests.java:50)
[ERROR] test003_fail(Tests) Time elapsed: 0.159 s <<< FAILURE!
java.lang.IllegalStateException: No webdriver is bound to current thread: 1. You need to call open(url) first.
at Tests.test003_fail(Tests.java:67)
[INFO]
[INFO] Results:
[INFO]
[ERROR] [1;31mFailures: [m
[ERROR] [1;31m Tests.test001_logowanie_programs:38 » IllegalState No webdriver is bound to cu...[m
[ERROR] [1;31m Tests.test002_logowanie_evaluation:50 » IllegalState No webdriver is bound to ...[m
[ERROR] [1;31m Tests.test003_fail:67 » IllegalState No webdriver is bound to current thread: ...[m
[INFO]
[ERROR] [1;31mTests run: 3, Failures: 3, Errors: 0, Skipped: 0[m
[INFO]
[ERROR] There are test failures.
Please refer to /var/lib/jenkins/jobs/nawa_selenide/workspace/target/surefire-reports for the individual test results.
Please refer to dump files (if any exist) [date]-jvmRun[N].dump, [date].dumpstream and [date]-jvmRun[N].dumpstream.
[JENKINS] Recording test results
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 20.071 s
[INFO] Finished at: 2019-07-08T14:36:56+02:00
[INFO] Final Memory: 31M/330M
[INFO] ------------------------------------------------------------------------
Waiting for Jenkins to finish collecting data
[JENKINS] Archiving /var/lib/jenkins/jobs/nawa_selenide/workspace/pom.xml to com/nawa/1.0-SNAPSHOT/nawa-1.0-SNAPSHOT.pom
channel stopped
Finished: UNSTABLE
On every test we have: java.lang.IllegalStateException: No webdriver is bound to current thread:
Do You have experience with similar situation?
Why on local machine tests are done correctly, but on main Jenkins in company there are only failures caused by No webdriver is bound to current thread?
Only operating system is difference.
This is problem with jenkins configuration under Linux?
When I run the tests locally, using Jenkins (with Maven), I get the same message, but the WebDriver is actually created and runs my test cases.
My maven goals are: mvn clean test -Puat
Declaration of Chrome in tests:
#BeforeClass
public void setUp() throws Exception {
Configuration.holdBrowserOpen = false;
Configuration.browser = "chrome";
Configuration.timeout = 10000;
Configuration.headless = true;
SelenideLogger.addListener("AllureSelenide", new AllureSelenide().screenshots(true).savePageSource(true));
objReader.environmentPropertiesLoader();
}
_______________edit
Now i check Start Xvfb before the build, and shut it down after in Jenkins job Build Environment, i read that is very important, maybe xvfb is the cause, i dont know, now in console i have
java.io.IOException: Cannot run program "Xvfb": error=2, No such file or directory
Did anyone answer? You need to call open Url as the error says.
driver.open(URL HERE) at the end of your setup method.
this is my solution:
after open(), store current webDriver, and before use - restore webDriver
WebDriver webDriver;
// constructor
public SelenideCommand() {
Configuration.holdBrowserOpen = true;
Selenide.open("https://www.instagram.com/");
webDriver = WebDriverRunner.getWebDriver();
}
public void login(String userName, String password) {
WebDriverRunner.setWebDriver(webDriver);
Selenide.element(Selectors.byName("username")).setValue(userName);
Selenide.element(Selectors.byName("password")).setValue(password);
Selenide.elements(Selectors.byTagName("button")).get(1).click();
}
Related
I am setting up jenkins foy my selenium scripts and when I am running the
jenkins, It is running the script on headless browser.
When I am running mvn test command on local , it opens the browser and start the scripts.
But on jenkins, It just show the below console without launching a browser
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running TestSuite
1554541558637 mozrunner::runner INFO Running command: "C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe" "-marionette" "-foreground" "-no-remote" "-profile" "C:\\WINDOWS\\TEMP\\rust_mozprofile.T3HA3HnEMbw5"
1554541560097 addons.webextension.screenshots#mozilla.org WARN Loading extension 'screenshots#mozilla.org': Reading manifest: Invalid extension permission: mozillaAddons
1554541560097 addons.webextension.screenshots#mozilla.org WARN Loading extension 'screenshots#mozilla.org': Reading manifest: Invalid extension permission: resource://pdf.js/
1554541560097 addons.webextension.screenshots#mozilla.org WARN Loading extension 'screenshots#mozilla.org': Reading manifest: Invalid extension permission: about:reader*
1554541567733 Marionette INFO Listening on port 58226
[Child 56144, Chrome_ChildThread] WARNING: pipe error: 109: file z:/task_1554038299/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 341
1554541568018 Marionette WARN TLS certificate errors will be ignored for this session
Apr 06, 2019 2:36:08 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 16.171 s - in TestSuite
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 20.523 s
[INFO] Finished at: 2019-04-06T14:36:12+05:30
[INFO] ------------------------------------------------------------------------
Finished: SUCCESS
When running Automation suite on Jenkin, it would not launch Browser physically. Jenkin execute tests in headless mode. You may not be able to see the results on Browser.
when I bulid a project by using the plugin 'publish over ssh', jenkins shows me the error:
[INFO] Packaging webapp
[INFO] Assembling webapp [bc-ctq] in [/var/lib/jenkins/workspace/bc-
ctq/target/bc-ctq]
[INFO] Processing war project
[INFO] Copying webapp resources [/var/lib/jenkins/workspace/bc- ctq/src/main/webapp]
[INFO] Webapp assembled in [140 msecs]
[INFO] Building war: /var/lib/jenkins/workspace/bc-ctq/target/bc-ctq.war
[INFO] WEB-INF/web.xml already added, skipping
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.018 s
[INFO] Finished at: 2018-10-26T19:38:10+08:00
[INFO] ------------------------------------------------------------------------
SSH: Connecting from host [localhost.localdomain]
SSH: Connecting with configuration [love] ...
SSH: Disconnecting configuration [love] ...
ERROR: Exception when publishing, exception message [Permission denied]
Archiving artifacts
Finished: UNSTABLE
Send files or execute commands over SSH after the build runs
the ssh server config
I was facing similar error and it turned out to be ownership issue. The owner of your project folder should be same as the one Jenkins uses to remote SSH into your instance.
Check ownership of your folder by running ls -ltr in your parent directory.
Change ownership using sudo chown -R owner:group DirectoryName/
Check verbose output and start build, then you'll see where is the problem
I want to build a code coverage from sonarqube in Jenkins. The project is from github. I have configure everything that are necessary but the following errors still arise. Can someone please help me to solve this?
Established TCP socket on 59508
[OData] $ java -cp "D:\Program Files\plugins\maven-plugin\WEB-INF\lib\maven35-agent-1.12-alpha-1.jar;D:\downloads\apache-maven-3.5.4\boot\plexus-classworlds-2.5.2.jar;D:\downloads\apache-maven-3.5.4/conf/logging" jenkins.maven3.agent.Maven35Main D:\downloads\apache-maven-3.5.4 "D:\Program Files\war\WEB-INF\lib\remoting-3.21.1.jar" "D:\Program Files\plugins\maven-plugin\WEB-INF\lib\maven35-interceptor-1.12-alpha-1.jar" "D:\Program Files\plugins\maven-plugin\WEB-INF\lib\maven3-interceptor-commons-1.12-alpha-1.jar" 59508
<===[JENKINS REMOTING CAPACITY]===>channel started
Executing Maven: -B -f D:\Program Files\workspace\OData\pom.xml clean sonar:sonar
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------------< OData:OData >-----------------------------
[INFO] Building OData 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # OData ---
[WARNING] Attempt to (de-)serialize anonymous class hudson.maven.reporters.MavenArtifactArchiver$2; see: https://jenkins.io/redirect/serialization-of-anonymous-classes/
[WARNING] Attempt to (de-)serialize anonymous class hudson.maven.reporters.MavenFingerprinter$1; see: https://jenkins.io/redirect/serialization-of-anonymous-classes/
[INFO]
[INFO] ----------------------------< OData:OData >-----------------------------
[INFO] Building OData 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- sonar-maven-plugin:3.4.1.1168:sonar (default-cli) # OData ---
[INFO] User cache: C:\WINDOWS\system32\config\systemprofile\.sonar\cache
[ERROR] SonarQube server [https://localhost:9000] can not be reached
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.056 s
[INFO] Finished at: 2018-08-27T00:09:08+08:00
[INFO] ------------------------------------------------------------------------
Waiting for Jenkins to finish collecting data
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.4.1.1168:sonar (default-cli) on project OData: Unable to execute SonarQube: Fail to get bootstrap index from server: Unrecognized SSL message, plaintext connection? -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[JENKINS] Archiving D:\Program Files\workspace\OData\pom.xml to OData/OData/0.0.1-SNAPSHOT/OData-0.0.1-SNAPSHOT.pom
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
channel stopped
WARN: Unable to locate 'report-task.txt' in the workspace. Did the SonarScanner succedeed?
Skipping sonar analysis due to bad build status FAILURE
Finished: FAILURE
for your OData project, when your way to scan the code is via jenkins, you have to set in the settings of jenkins with the hostname, don´t recommend put "localhost" or "127.0.0.1"
Try with $HOSTNAME:
Go to Settings in Jenkins
Move to "Sonarqube Servers"
SonarQube servers
-- Sonarqube instalations
--- ie: http://myserversonarqube:9000
Regards.
Error below is self explanatory. I have below questions
Is Sonarqube running on localhost with port 9000 as Secured (i.e https) ?
Which version of maven you are using? sometimes some of the Sonar plugin versions does not work with old maven versions.
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-
plugin:3.4.1.1168:sonar (default-cli) on project OData: Unable to execute SonarQube:
Fail to get bootstrap index from server: Unrecognized SSL message, plaintext connection? -> [Help 1]
[ERROR]
I keep getting this errors (error code bellow) when I run jmeter tests through jenkins on remote slave machines :
[INFO] -------------------------------------------------------
[INFO] P E R F O R M A N C E T E S T S
[INFO] -------------------------------------------------------
[INFO]
[INFO]
[info]
[debug] JMeter is called with the following command line arguments: -n -t C:\Performance_Framework\Project\src\test\jmeter\Example.jmx -l C:\Performance_Framework\Project\target\jmeter\results\Example.jtl -d C:\Performance_Framework\Project\target\jmeter -L DEBUG -j C:\Performance_Framework\CMS\target\jmeter\logs\Example.jmx.log -r -R 10.0.20.100,10.0.20.101 -X -Djava.rmi.server.hostname 10.0.20.200 -Dsun.net.http.allowRestrictedHeaders true
[info] Executing test: Example.jmx
[info] Creating summariser <summary>
[info] Created the tree successfully using C:\Performance_Framework\Project\src\test\jmeter\Example.jmx
[info] Configuring remote engine: 10.0.20.100
[info] error unmarshalling return; nested exception is:
[info] java.lang.ClassNotFoundException: org.apache.jmeter.engine.RemoteJMeterEngineImpl_Stub (no security manager: RMI class loader disabled)
[info] Failed to configure 10.0.20.100
[info] Configuring remote engine: 10.0.20.101
[info] error unmarshalling return; nested exception is:
[info] java.lang.ClassNotFoundException: org.apache.jmeter.engine.RemoteJMeterEngineImpl_Stub (no security manager: RMI class loader disabled)
[info] Failed to configure 10.0.20.101
[info] Stopping remote engines
[info] Remote engines have been stopped
[info] Error in NonGUIDriver java.lang.RuntimeException: Following remote engines could not be configured:[10.0.20.100, 10.0.20.101]
[info] Completed Test: Example.jmx
Now my current POM settings for the machines:
<configuration>
--------------------------------
<propertiesSystem>
<java.rmi.server.hostname>10.0.20.200</java.rmi.server.hostname>
</propertiesSystem>
<remoteConfig>
<startServersBeforeTests>true</startServersBeforeTests>
<serverList>10.0.20.100,10.0.20.101</serverList>
<stopServersAfterTests>true</stopServersAfterTests>
</remoteConfig>
</configuration>
If I run the tests from JMETER GUI everything is ok, remote host start and execute the tests successfully.
I think that everything is set correctly, jmeter-server.bat is started before tests run on each slave.
Also there's something that I don't understand from this sentence on from jmeter maven plugin wiki :
runremote command being send to JMeter which will start up any remote
servers you have defined in your jmeter.properties when your first
test starts.
Which jmeter.properties file, of the project ?If yes, then i don't know how that could be defined as always the target folder is cleaned on every test run, that resulting jmeter properties file is derived.
Later Edit: I even created the jmeter.properties file and added in src/test/jmeter dir and defined there the remote hosts, but still nothing.
So what do you suggest guys?
I resolved somehow the issue with the connection by editing the jmeter-server file by adding also the java.rmi.server.hostname.
But what I don't like is the test execution time, it's horrible , even with one thread which is supposed to be be finished in less than 1-2 sec but it's still showing that is trying to receive shutdown message.
[INFO] -------------------------------------------------------
[INFO] P E R F O R M A N C E T E S T S
[INFO] -------------------------------------------------------
[INFO]
[INFO]
[info]
[debug] JMeter is called with the following command line arguments: -n -t C:\Performance_Framework\CMS\src\test\jmeter\Example.jmx -l C:\Performance_Framework\CMS\target\jmeter\results\Example.jtl -d C:\Performance_Framework\CMS\target\jmeter -L DEBUG -q C:\Performance_Framework\CMS\src\test\jmeter\jmeter.properties -j C:\Performance_Framework\CMS\target\jmeter\logs\Example.jmx.log -r -X -Djava.rmi.server.hostname 10.0.20.200 -Dsun.net.http.allowRestrictedHeaders true
[info] Executing test: SearchForModule.jmx
[info] Creating summariser <summary>
[info] Created the tree successfully using C:\Performance_Framework\CMS\src\test\jmeter\SearchForModule.jmx
[info] Configuring remote engine: 10.0.20.100
[info] Configuring remote engine: 10.0.20.101
[info] Starting remote engines
[info] Starting the test # Thu Jul 30 13:48:23 BST 2015 (1438260503717)
[info] Remote engines have been started
[info] Waiting for possible shutdown message on port 4445
Is something that is wrong on jenkins side, tomcat webapp?
First thing you need to fix are the server addresses:
https://github.com/jmeter-maven-plugin/jmeter-maven-plugin/wiki/Remote-Server-Configuration
10.0.x.100,10.0.x.101 are not correct IP addresses. This is what you can see in your error log.
I'm using the Play2 Maven plugin for one of my project and when I tried to start or run my project using the mvn play2:run command, I get to see that the build was successful, but when I tried to access the application url, I do not see anything (probably a 404). Any ideas as what is wrong?
--- (Running the application from SBT, auto-reloading is enabled) ---
[info] play - Listening for HTTP on /0.0.0.0:9000
(Server started, use Ctrl+D to stop and go back to the console...)
[success] Total time: 1 s, completed Mar 16, 2014 4:55:43 PM
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.855s
[INFO] Finished at: Sun Mar 16 16:55:43 CET 2014
[INFO] Final Memory: 11M/114M
[INFO] ------------------------------------------------------------------------
It says to hit Ctrl+D to stop the server, but how can I stop a server that is probably not running? Is this a bug or am I doing something wrong?