@Keyword
def ReadLocalPDF(String PDFFILE)
{
File pdf = new File(PDFFILE);
PDDocument doc = PDDocument.load(pdf);
String pdfText = new PDFTextStripper().getText(doc);
println(pdfText);
doc.close();
Assert.assertTrue(pdfText.contains("Radverkehr"));
Assert.assertTrue(pdfText.contains("Mobilität"));
Assert.assertTrue(pdfText.contains("xyz"));
println "PDF IS GOOD TO GO...\r";
Test Cases/Record specific/Meldungen_drucken FAILED.
Reason:
groovy.lang.MissingMethodException: No signature of method: static tools.PDFReader.ReadLocalPDF() is applicable for argument types: (java.lang.String) values:
You have to escape special character " \ ". Try this: CustomKeywords.'tools.PDFReader.ReadLocalPDF'("C:\\Users\\xyz.zx\\Downloads\\2020000012_Oberflaeche_Am_Buttegraben_7_65326_Aarbergen_9aaf27f287e908c4_-AnMelder.pdf")
When you execute katalon command, it requires the <projectName>/bin folder and the <projectName>/Libs to be filled with the *.class files. For example, you should have <projectName>/bin/keyword/tools/PDFReader.class file on the machine where Jenkins task runs.
You said you sometimes see a message java.lang.ClassNotFoundException: tools.PDFReader. This message seems to me implying that somehow <projectName>/bin/keyword/tools/PDFReader.class file is missing on the machine where Jenkins task runs
How do you build the <projectName>/bin/keyword/tools/PDFReader.class file on the machine?
Does your jenkins job clones a repository from your Git remote repository? Does the Git remote repository includes the bin/ directory commited into?
Does Katalon Studio console mode perform a full-build everytime it is invoked so that it guarantees the <projectName>/bin directory is fulfilled with the latest *.class binaries?
If Katalon Studio console mode DOES NOT perform a full-build, then I think that a Jenkins job would require a Git repository of Katalon project SHOULD NOT ignore bin/ and Libs/. Am I right?
What do you mean by this? When you open Katalon GUI on your PC, no problem. When jenkins executes katalon command remotely on your PC, problems sometimes. â right?
Here is the output of JavaClass Exception Error case:
Test Suites/Print_Record - Firefox - 20190827_175343âŚ0/3(0%)
2019-08-27 17:54:07.832 INFO c.k.katalon.core.main.TestCaseExecutor - END Test Cases/Generell/Login
2019-08-27 17:54:07.839 INFO c.k.katalon.core.main.TestCaseExecutor - --------------------
2019-08-27 17:54:07.848 INFO c.k.katalon.core.main.TestCaseExecutor - START Test Cases/Record specific/Meldungen_drucken
2019-08-27 17:54:07.972 DEBUG testcase.Meldungen_drucken - 1: delay(G_Timeout_Medium)
console.error: BroadcastService:
receivedBroadcastMessage: handler for
remote-settings/monitor_changes
threw error:
Message: Error: Polling for changes failed: http://%(server)s/dummy/blocklist//buckets/monitor/collections/changes/records?_expected=%221566864005222%22 is not a valid URLâŚ
Stack:
remoteSettingsFunction/remoteSettings.pollChanges@resource://services-settings/remote-settings.js:201:13
Test Suites/Print_Record - Firefox - 20190827_175343âŚ1/3(33%)
2019-08-27 17:54:17.980 DEBUG testcase.Meldungen_drucken - 2: if (waitForElementVisible(findTestObject(âObject Repository/ListView/Arrow_3rd_Entryâ), G_Timeout_Medium, OPTIONAL))
2019-08-27 17:54:18.127 DEBUG testcase.Meldungen_drucken - 1: click(findTestObject(âObject Repository/ListView/Arrow_3rd_Entryâ), STOP_ON_FAILURE)
2019-08-27 17:54:18.499 DEBUG testcase.Meldungen_drucken - 4: click(findTestObject(âObject Repository/Message_Toolbar/btn_printâ), STOP_ON_FAILURE)
2019-08-27 17:54:18.818 DEBUG testcase.Meldungen_drucken - 5: delay(G_Timeout_Small)
JavaScript error: , line 0: uncaught exception: 2147746132
JavaScript error: , line 0: uncaught exception: 2147746132
2019-08-27 17:54:23.828 DEBUG testcase.Meldungen_drucken - 6: tools.PDFReader.ReadLocalPDF(âC:\Users\andreas.voit\Downloads\2020000012_Oberflaeche_Am_Buttegraben_7_65326_Aarbergen_9aaf27f287e908c4_-AnMelder.pdfâ)
2019-08-27 17:54:23.841 ERROR k.k.c.m.CustomKeywordDelegatingMetaClass - ? tools.PDFReader
2019-08-27 17:54:23.843 ERROR c.k.katalon.core.main.TestCaseExecutor - ? Test Cases/Record specific/Meldungen_drucken FAILED.
Reason:
java.lang.ClassNotFoundException: tools.PDFReader
at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.getCustomKeywordClassAndSetMetaClass(CustomKeywordDelegatingMetaClass.java:100)
at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.invokeStaticMethod(CustomKeywordDelegatingMetaClass.java:45)
at Meldungen_drucken.run(Meldungen_drucken:40)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:337)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:328)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:307)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:299)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:233)
at com.kms.katalon.core.main.TestSuiteExecutor.accessTestCaseMainPhase(TestSuiteExecutor.java:169)
at com.kms.katalon.core.main.TestSuiteExecutor.accessTestSuiteMainPhase(TestSuiteExecutor.java:142)
at com.kms.katalon.core.main.TestSuiteExecutor.execute(TestSuiteExecutor.java:91)
at com.kms.katalon.core.main.TestCaseMain.startTestSuite(TestCaseMain.java:157)
at com.kms.katalon.core.main.TestCaseMain$startTestSuite$0.call(Unknown Source)
at TempTestSuite1566921223033.run(TempTestSuite1566921223033.groovy:35)
2019-08-27 17:54:23.845 INFO c.k.katalon.core.main.TestCaseExecutor - END Test Cases/Record specific/Meldungen_drucken
Here is the output if it works:
Test Suites/Print_Record - Firefox - 20190829_083022âŚ0/3(0%)
2019-08-29 08:30:37.848 DEBUG testcase.Login - 10: verifyElementVisible(findTestObject(âPage_Login/Filter_Button_GUIâ), STOP_ON_FAILURE)
2019-08-29 08:30:39.612 DEBUG testcase.Login - 11: delay(G_Timeout_Medium, STOP_ON_FAILURE)
2019-08-29 08:30:49.633 INFO c.k.katalon.core.main.TestCaseExecutor - END Test Cases/Generell/Login
2019-08-29 08:30:49.643 INFO c.k.katalon.core.main.TestCaseExecutor - --------------------
2019-08-29 08:30:49.643 INFO c.k.katalon.core.main.TestCaseExecutor - START Test Cases/Record specific/Meldungen_drucken
2019-08-29 08:30:49.788 DEBUG testcase.Meldungen_drucken - 1: delay(G_Timeout_Medium)
Test Suites/Print_Record - Firefox - 20190829_083022âŚ1/3(33%)
2019-08-29 08:30:59.800 DEBUG testcase.Meldungen_drucken - 2: if (waitForElementVisible(findTestObject(âObject Repository/ListView/Arrow_3rd_Entryâ), G_Timeout_Medium, OPTIONAL))
2019-08-29 08:30:59.961 DEBUG testcase.Meldungen_drucken - 1: click(findTestObject(âObject Repository/ListView/Arrow_3rd_Entryâ), STOP_ON_FAILURE)
2019-08-29 08:31:00.402 DEBUG testcase.Meldungen_drucken - 4: click(findTestObject(âObject Repository/Message_Toolbar/btn_printâ), STOP_ON_FAILURE)
2019-08-29 08:31:00.943 DEBUG testcase.Meldungen_drucken - 5: delay(G_Timeout_Small)
JavaScript error: , line 0: uncaught exception: 2147746132
JavaScript error: , line 0: uncaught exception: 2147746132
2019-08-29 08:31:05.949 DEBUG testcase.Meldungen_drucken - 6: tools.PDFReader.ReadLocalPDF(âC:\Users\andreas.voit\Downloads\2020000012_Oberflaeche_Am_Buttegraben_7_65326_Aarbergen_9aaf27f287e908c4_-AnMelder.pdfâ)
PDF IS GOOD TO GOâŚ
2019-08-29 08:31:07.060 INFO k.k.c.m.CustomKeywordDelegatingMetaClass - tools.PDFReader.ReadLocalPDF is PASSED
2019-08-29 08:31:07.061 INFO c.k.katalon.core.main.TestCaseExecutor - END Test Cases/Record specific/Meldungen_drucken
The solution from the other post is to insert a WebDriverWait Command.
But Iâm not sure how I could insert WebDriverWait into my testcase confortable. I mean, I donât want to insert the raw selenium code into each testcase. And using a custome keyword is not an option, because it is the problem.