Page 1 sur 1

Unable to execute selenium test cases with jenkins and SqaushTA

Publié : mer. juin 19, 2019 12:15 pm
par imhashir
Hi!

Following is my test case path:

src/squashTA/resources/com/java/src/main/org/ta/UntitledTestCase2.java

My test file name is test2.ta and the code is:

Code : Tout sélectionner

SETUP :

LOAD com/java/src/main AS javaTestCodeFile

TEST :

CONVERT javaTestCodeFile TO script.java (compile) AS seleniumTestCompiled
CONVERT seleniumTestCompiled TO script.java.selenium2 (script) USING $(org.ta.UntitledTestCase2) AS seleniumTest
EXECUTE execute WITH seleniumTest AS javaTestresults
ASSERT javaTestresults IS success
This is the error that I am getting:

Code : Tout sélectionner

[ERROR] It must have java sources in a java subdirectory in resources directory
[ERROR] Test Automation Engine error (non SUT) : method 'convert' from engine component of class 'org.squashtest.ta.plugin.commons.converter.FileToJavaCodeBundle' with argument 'org.squashtest.ta.framework.components.FileResource'  has thrown an exception.
org.squashtest.ta.framework.exception.BadDataException: Java code compilation failed:
Usage: javacTask <options> <source files>
where possible options include:
  -g                         Generate all debugging info
  -g:none                    Generate no debugging info
  -g:{lines,vars,source}     Generate only some debugging info
  -nowarn                    Generate no warnings
Can anyone please point out where I am wrong and how I can get this fixed.
It would really help a lot.
Thank You.

Re: Unable to execute selenium test cases with jenkins and SqaushTA

Publié : mer. juin 26, 2019 7:29 pm
par jpjoly
Hi,

It seems these two levels shouldn't exist : src and main. Try to remove them.
You should then load only com (LOAD com AS ...).

By the way, why don't you use the build-in shortcut described here :
https://sites.google.com/a/henix.fr/wik ... uts-macros ?

Yours,

The Squash Team

Re: Unable to execute selenium test cases with jenkins and SqaushTA

Publié : jeu. juin 27, 2019 3:07 pm
par imhashir
Hey!

Thanks for the reply.
I did what you said. Now my directory structure is:

src/squashTA/resources/com/java/org/ta/UntitledTestCase2.java

And my test file is:

Code : Tout sélectionner

SETUP :

LOAD com AS javaTestCodeFile

TEST :

CONVERT javaTestCodeFile TO script.java (compile) AS seleniumTestCompiled
CONVERT seleniumTestCompiled TO script.java.selenium2 (script) USING $(org.ta.UntitledTestCase2) AS seleniumTest
EXECUTE execute WITH seleniumTest AS javaTestresults
ASSERT javaTestresults IS success
Here's the error I got this time:

Code : Tout sélectionner

[INFO] Beginning execution of ecosystem tests
[INFO] Beginning execution of test first-test.ta
[INFO] Beginning execution of test test2.ta
[ERROR] Test Automation Engine error (non SUT) : method 'convert' from engine component of class 'org.squashtest.ta.plugin.selenium.converters.JavaBundleToJavaSelenium2Converter' with argument 'org.squashtest.ta.plugin.commons.resources.JavaCodeBundle'  has thrown an exception.
org.squashtest.ta.framework.exception.BadDataException: Class not found
	at org.squashtest.ta.plugin.selenium.converters.AbstractJavaBundleToJavaSeleniumConverter.containsJUnitClasses(AbstractJavaBundleToJavaSeleniumConverter.java:97)
	at 
As for the second method that you proposed, here's the code and directory structure:

Image

And here is the error log on jenkins:

Code : Tout sélectionner

https://imgur.com/ik35CdZ.png
Please help.

Re: Unable to execute selenium test cases with jenkins and SqaushTA

Publié : ven. juin 28, 2019 10:21 am
par Gautier
Hi,

The layout of the project seems now correct. But yet there still might be a misspell on the name of the Selenium class implementing the Selenium script. Please try the follwong shortcut :

# EXECUTE_SELENIUM2 com WITH MAIN CLASS org.ta.UntitledTestCase2

This should work providing that :
- "com" is a correcly layed out java bundle (screen capture shows that it is)
- org.ta.UntitledTestCase2 is indeed the qualified name of the class "UntitledTestCase2"

If this does not work please reply with a screen capture of "UntitledTestCase2.java".

Sincerly yours,

The Squash Team

Re: Unable to execute selenium test cases with jenkins and SqaushTA

Publié : ven. juin 28, 2019 12:54 pm
par imhashir
Hi!

Thanks for getting back to me. I tried what you asked but still got the error.

Here's screen capture of code file:

Image

Here's screen capture of test2.ta:

Image

These are jenkins logs:

Code : Tout sélectionner

[ERROR] Test Automation Engine error (non SUT) : method 'convert' from engine component of class 'org.squashtest.ta.plugin.selenium.converters.JavaBundleToJavaSelenium2Converter' with argument 'org.squashtest.ta.plugin.commons.resources.JavaCodeBundle'  has thrown an exception.
org.squashtest.ta.framework.exception.BadDataException: Class not found
	at org.squashtest.ta.plugin.selenium.converters.AbstractJavaBundleToJavaSeleniumConverter.containsJUnitClasses(AbstractJavaBundleToJavaSeleniumConverter.java:97)
	at org.squashtest.ta.plugin.selenium.converters.JavaBundleToJavaSelenium2Converter.convert(JavaBundleToJavaSelenium2Converter.java:42)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.squashtest.ta.backbone.tools.ReflectionUtils.invoke(ReflectionUtils.java:252)
	at org.squashtest.ta.backbone.engine.wrapper.ResourceConverterHandler.convert(ResourceConverterHandler.java:106)
	at org.squashtest.ta.backbone.engine.instructionrunner.DefaultConvertResourceRunner.applyConverter(DefaultConvertResourceRunner.java:130)
	at org.squashtest.ta.backbone.engine.instructionrunner.DefaultConvertResourceRunner.convertResource(DefaultConvertResourceRunner.java:94)
	at org.squashtest.ta.backbone.engine.instructionrunner.DefaultConvertResourceRunner.doRun(DefaultConvertResourceRunner.java:54)
	at 
And this is another error that's appearing later in log, don't know if its because of previous one or something else:

Code : Tout sélectionner

[ERROR] The execution raised an error in the TEST phase of the TA script 'test2.ta' with the message: 'Test Automation Engine error (non SUT) : method 'convert' from engine component of class 'org.squashtest.ta.plugin.selenium.converters.JavaBundleToJavaSelenium2Converter' with argument 'org.squashtest.ta.plugin.commons.resources.JavaCodeBundle'  has thrown an exception.
Details: Class not found'.
[INFO] Exporting results
[INFO] Cleaning resources
[INFO] Squash TA : build complete.
[INFO] All the files from C:\Users\Hashir\AppData\Local\Temp\Squash_TA were properly deleted.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:24 min
[INFO] Finished at: 2019-06-28T15:44:32+05:00
[INFO] Final Memory: 39M/478M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.squashtest.ta:squash-ta-maven-plugin:1.10.0-RELEASE:run (default) on project my.sqaush.ta.project: Build failure : there are tests failures
[ERROR] Test statistics : 2 test runs, 1 passed, 1 tests didn't pass
[ERROR] Tests failed / crashed :
[ERROR] -----------
[ERROR] tests:
[ERROR] ==> test2.ta
[ERROR] -> [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] 
[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/MojoFailureException
[JENKINS] Archiving I:\SquashAndBI\SquashTAWorkspace\my.sqaush.ta.project\pom.xml to org.suashtest.tutorial2/my.sqaush.ta.project/1.0/my.sqaush.ta.project-1.0.pom
channel stopped

Re: Unable to execute selenium test cases with jenkins and SqaushTA

Publié : ven. juin 28, 2019 4:10 pm
par Gautier
Hi,

Ok ! thanks to the last screenshots we are able to pinpoint the problem. There is a discrepancy between the declared name of the package in your selenium script, the layout of your bundle in the squashTA/resources folder and the qualified name used in the shortchut.

A possible solution would be to :

1- let "package com.exemple.tests
2- Change the resources layout from
"squashTA/resources/com/java/org/ta" "to squashTA/resources/selenium-bundle/java/com/example/tests"
3- In "test2.ta" change the uses of the shortcut to # EXECUTE_SELENIUM2 slenium-bundle WITH MAIN CLASS com.example.tests.UntitledTestCase2

The rationale behind is that the bundle has now a more idiomatic name : "selenium-bundle" and more importantly the bundle layout is consistent with the java package of your class and the call its qualified name in your TA test.

Sincerly yours,

The Squash Team

Re: Unable to execute selenium test cases with jenkins and SqaushTA

Publié : ven. juin 28, 2019 9:14 pm
par imhashir
Hey!

Thanks a lot for your help. This worked for me. Had to install firefox 38.0.6 though. It was having some compatibility issues with the latest version.

But still, thanks a lot for your help :)