How to set Jenkins browser resolution to larger dimension - maven

I'm trying to set larger resolution for my tests because if the resolution is under 414 it goes to mobile page. And every time I run my tests it fails because of the resolution. I tried to set higher resolution but Jenkins didn't accept it. No matter what site I try I got the same results. I run Jenkins in combination with Selenium and Maven. This is the code I'm using in Selenium:
WebDriver driver = new ChromeDriver();
System.out.println(driver.manage().window().getSize());
driver.get("https://www.apple.com/");
driver.manage().window().setSize(new Dimension(800, 600));
System.out.println(driver.manage().window().getSize());
I also tried with driver.manage().window().maximize(); which gives also the result of 272. This is what I get on Jenkins console output:
Running GitProject.gittest.AppTest
Configuring TestNG with:
org.apache.maven.surefire.testng.conf.TestNG652Configurator#5f8ed237
Starting ChromeDriver 2.33.506106
(8a06c39c4582fbfbab6966dbb1c38a9173bfb1a2) on port 20546
Only local connections are allowed.
Oct 16, 2017 9:21:34 AM org.openqa.selenium.remote.ProtocolHandshake
createSession
INFO: Detected dialect: OSS
(400, 272)
(800, 272)
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 13.885 sec
Results :
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

Related

#QuarkusIntegrationTest : Unable to determine the status of the running process. See the above logs for details

I'm currently learning Quarkus and I have an issue with Native testing.
In this repository (the dev branch), I can package into JAR and binary and run them ([AdinhLux/quarkus-1-intro][https://github.com/AdinhLux/quarkus-1-intro/tree/dev]).
I'm just encountering an issue when running the below command line. It seems my Maven was looking for an information into .target/quarkus.log but nothing is written.
mvn verify -Pnative
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running org.agoncal.quarkus.starting.BookResourceIT
Jul 20, 2022 4:48:58 PM org.jboss.threads.Version <clinit>
INFO: JBoss Threads version 3.4.2.Final
Executing "/Users/adinhlux/development/IntelliJProjects/rest-book/target/rest-book-1.0.0-SNAPSHOT-runner -Dquarkus.http.port=8081 -Dquarkus.http.ssl-port=8444 -Dtest.url=http://localhost:8081 -Dquarkus.log.file.path=/Users/adinhlux/development/IntelliJProjects/rest-book/target/quarkus.log -Dquarkus.log.file.enable=true"
Waited 60 seconds for target/quarkus.log to contain info about the listening port and protocol but no such info was found
[ERROR] Tests run: 3, Failures: 0, Errors: 1, Skipped: 2, Time elapsed: 61.737 s <<< FAILURE! - in org.agoncal.quarkus.starting.BookResourceIT
[ERROR] org.agoncal.quarkus.starting.BookResourceIT.shouldCountAllBooks Time elapsed: 0.012 s <<< ERROR!
java.lang.RuntimeException: java.lang.IllegalStateException: Unable to determine the status of the running process. See the above logs for details
I'm running my project on macOS Monterey M1 with the following settings :
sdk install java 17.0.4-oracle
brew install --cask graalvm/tap/graalvm-ce-java17
sdk install maven 3.8.6
sdk install quarkus 2.10.2.Final
xattr -r -d com.apple.quarantine /Library/Java/JavaVirtualMachines/graalvm-ce-java17-22.1.0/Contents/Home
export JAVA_HOME=$(/usr/libexec/java_home -v 17)
export PATH=$JAVA_HOME/bin:$PATH
cd $JAVA_HOME/bin
gu install native-image
I resolved my issue .
In application.properties you need this :
quarkus.log.category."org.agoncal".level=DEBUG

jmeter execution comparison with previous build in Jenkins

I am interested to publish jmeter report in Jenkins and set the pipeline as "failed" if there are degradation in terms of performances between the previous executions.
Below the configuration set in my Jenkinsfile for my jmeter results:
perfReport filterRegex: '',
relativeFailedThresholdNegative: 0,
relativeFailedThresholdPositive: 0,
relativeUnstableThresholdNegative: 0,
relativeUnstableThresholdPositive: 0,
sourceDataFiles: 'resultsJmeter/output/*.xml'
}
Is there any way to evaluate automatically the previous executions (if any) ?
As per Performance Trend Reporting article:
You can configure the error percentage thresholds and the relative percentage thresholds which would make the project unstable or failed or set them to -1 to disable the feature
As per How to Use the Jenkins Performance Plugin
Set the following values:
Unstable: 10
Failed: 60
This configuration will mark the build as unstable when errors are at 10% and as failed when 60% of our requests failed.
The relevant pipeline syntax would be:
perfReport errorFailedThreshold: 60, errorUnstableThreshold: 10, filterRegex: '', sourceDataFiles: 'resultsJmeter/output/*.xml'
for the relative to the previous build:
perfReport relativeFailedThresholdNegative: 10, relativeFailedThresholdPositive: 60, relativeUnstableThresholdNegative: 5, relativeUnstableThresholdPositive: 30, sourceDataFiles: 'resultsJmeter/output/*.xml', filterRegex: ''

Test output of junit test was truncated

In quite a few cases, I noticed that the junit test output was truncated .
e.g. https://builds.apache.org/job/HBase-2.0-hadoop3-tests/org.apache.hbase$hbase-server/218/testReport/junit/org.apache.hadoop.hbase.master.procedure/TestDisableTableProcedure/org_apache_hadoop_hbase_master_procedure_TestDisableTableProcedure/ :
sun.misc.Unsafe.park(Native Method)
java.util.concurrent.locks.LockSupport.park(LockSupport.jav
...[truncated 1107895 chars]...
r$Handler.run(Server.java:2661)
If someone has seen this before, please advise whether there is any config which controls the truncation.
I'm not sure where you have looked what about this: https://builds.apache.org/job/HBase-2.0-hadoop3-tests/org.apache.hbase$hbase-server/218/testReport/junit/org.apache.hadoop.hbase.master.procedure/TestDisableTableProcedure/org_apache_hadoop_hbase_master_procedure_TestDisableTableProcedure/ if you take a look a line before there you can see: ...[truncated 1107895 chars].......this means about 1 MiB has been truncated ...which is done as far as I know by Jenkins...
Furthermore on the usual console log you can see things like this:
[ERROR] Tests run: 5, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 763.13 s <<< FAILURE! - in org.apache.hadoop.hbase.master.procedure.TestDisableTableProcedure
[ERROR] org.apache.hadoop.hbase.master.procedure.TestDisableTableProcedure Time elapsed: 749.128 s <<< ERROR!
org.junit.runners.model.TestTimedOutException: test timed out after 780 seconds
If you have the need to investigate that more in depth you need to stop the build system and take a look into the workspace of the build and take a look on the surefire reports directory...
Apart from that it makes no sense to start such build by a timer trigger...better you commit trigger instead...

Getting unable to discover open pages. Can't run my test suite from jenkins in chrome browser

I'm getting this stack trace.
Default Logging level is set to ERROR
Loping for strBrowserType chrome
Starting ChromeDriver (v2.9.248315) on port 42027
Tests run: 32, Failures: 1, Errors: 0, Skipped: 31, Time elapsed: 67.337 sec <<< FAILURE! - in TestSuite
setupSuite(com.ambab.carworkz.testcases.ServiceEstimatorTestTc) Time elapsed: 66.668 sec <<< FAILURE!
org.openqa.selenium.WebDriverException:
unknown error: unable to discover open pages
(Driver info: chromedriver=2.9.248315,platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 61.06 seconds
Build info: version: '2.53.0', revision: '35ae25b1534ae328c771e0856c93e187490ca824', time: '2016-03-15 10:43:46'
System info: host: 'ROBER-QA', ip: '192.168.0.70', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_91'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Results:
Failed tests:
ServiceEstimatorTestTc>Base.setupSuite:114 ยป WebDriver unknown error: unable t...
Tests run: 32, Failures: 1, Errors: 0, Skipped: 31
[ERROR] There are test failures.
I'm running test suite from jenkins in chrome browser that is the time when I'm facing this issue. If I directly run the suite from eclipse IDE then it runs fine. When I run the same test suite in firefox then also it runs fine.
I've installed the latest version of chrome, and chrome driver. Running jenkins job with maven.
Tried using no-sandbox as well as changes in chrome browser setting of automatic detect setting. Jenkins also I'm running the job on master and there is no slave. Tried every possible solution regarding this problem. If any more solution there then please let me know.
I've added this stuff and it solved it in my case. There also may be problem with user that is running jenkins (it should be set to Admin)
ChromeOptions options = new ChromeOptions();
options.AddUserProfilePreference("download.default_directory", DownloadsPath);
options.SetLoggingPreference(LogType.Browser, LogLevel.Severe);
options.AddArguments("ignore-certificate-errors");
options.AddArguments("--allow-running-insecure-content");
options.AddArguments("test-type");
options.AddArguments("start-maximized");
options.AddArguments("--disable-extensions");
options.AddArguments("no-sandbox");
var ChromeService = ChromeDriverService.CreateDefaultService();
ChromeService.HideCommandPromptWindow = true;
instance = new ChromeDriver(ChromeService, options, TimeSpan.FromSeconds(200));

selenium rc with cruise control - testng error message - could not instantiate 'test'

I'm currently trying to set up cruisecontrol to run my selenium test suite. Everything works fine until I run the build, I got the following message:
calling target(s) [execute-test] in build file C:\Project\src\build.xml
Entering C:\Project\src\build.xml...
Exiting C:\Project\src\build.xml.
task location="C:\Project\src\build.xml:30: " name="antcall" time="0 seconds"
target name="execute-test" time="0 seconds"
task location="C:\Project\src\build.xml:37: " name="testng" time="0 seconds"
Executing 'C:\Program Files (x86)\Java\jdk1.6.0_06\jre\bin\java.exe' with arguments:
'-ea'
'-classpath'
'C:\testng;C:\testng\testng-5.9-jdk15.jar;C:\testng\commons-lang-2.0.jar;C:\testng\testng-5.9-jdk14.jar'
'org.testng.TestNG'
'#C:\DOCUME~1\SERVER~1\LOCALS~1\Temp\1\testng10509'
The ' characters around the executable and arguments are
not part of the command.
[Parser] Running:
C:\Project\src\TestSuite.xml
[TestRunner] Running the tests in 'testInpagePlacement' with parallel mode:false
[RunInfo] Adding method selector: org.testng.internal.XmlMethodSelector#9664a1 priority: 10
[ClassHelper] Could not instantiate testcase1: testcase1
[ClassHelper] Could not instantiate testcase1: testcase1
===============================================
[Smoke test]
[Total tests run: 0, Failures: 0, Skips: 0]
===============================================
[org.testng.TestNGException:]
[Cannot find class in classpath: testcase1]
at org.testng.xml.XmlClass.getSupportClass(XmlClass.java:55)
at org.testng.internal.Utils.xmlClassesToClasses(Utils.java:79)
at org.testng.TestRunner.initMethods(TestRunner.java:289)
at org.testng.TestRunner.init(TestRunner.java:235)
at org.testng.TestRunner.init(TestRunner.java:197)
at org.testng.TestRunner.(TestRunner.java:141)
at org.testng.SuiteRunner$DefaultTestRunnerFactory.newTestRunner(SuiteRunner.java:488)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:250)
at org.testng.SuiteRunner.run(SuiteRunner.java:204)
at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:877)
at org.testng.TestNG.runSuitesLocally(TestNG.java:842)
at org.testng.TestNG.run(TestNG.java:751)
at org.testng.TestNG.privateMain(TestNG.java:914)
at org.testng.TestNG.main(TestNG.java:887)
The tests failed.
This was run on a network server, I'd tested the testsuite.xml locally through intellij and everything works fine. I feel like this is a config issue with the network server, please let me know if my assumption is wrong and point me to the right direction to fix this issue.
Thanks.
You don't have your classes (tests & target classes) on the classpath.

Resources