Exploring options to deliver Selenium test to non-tech business team who wish to run the test on their own - selenium

Our non-technical business team need to run only 1 automation test script which will be fetching data from several hundreds rows of Excel file. I've created automation that script using a Maven project (with POM framework and Extent Report), using Selenium WebDriver, Java, TestNG, and Eclipse but not sure how to deliver the test/script to the business team. Would appreciate if you guys can suggest a few options to deliver this script to the business team so that they can change few parameters in Excel file and run the script on their own. I'm getting Extent report at the end of the test, would be best if they can get the Extent report as well.
Note: Since they are non-technical, it is preferable to avoid installing and configuring Java, Eclipse, etc tools on their machine but that's not mandatory so I'm open to check several options.

I would like to suggest few options here :
Jenkins - Install it on Any server and share login and url with them. They can execute build and no technical knowledge required.
Executable JAR - Export your project as executable JAR and deliver that JAR file. All they have to do it , Double click on JAR file OR execute via batch file and it should run that script and get done the job. Make sure all data related file should be there with JAR. i.e excel file
Note : They always need JAVA in the machine regardless of what they prefer from above to use.

Usually i used to give as batch file script, if you have jenkins, integrate your bat file in it. other wise share the batch file as it is.
Create a package JAR,
Create .bat file to execute the JAR.

Related

VS CODE - Using the Test Explorer UI, how do I manually exclude/include test files

I am currently working on a SAM deployment project that includes the use of python for the Lambda. I created tests using pytest and runs great on my terminal. But its somehow hard to read on a terminal. Somehow I would like to have a testing like Visual Studio 2019's Test features, where its clean and neat, easy to review.
Using VS CODE (as I am working on python files), I installed the Test Explorer UI and support for python tests. As soon as I open it, it loads a ton of tests including the tests of the 3rd party libraries that I have on my deployment, and it clutters my test explorer. I do not want any of these tests anyway, but I do not know how to exclude them.
I also would want to only include specified test files manually (if that is possible). I do not have use for tons of tests auto-detected by the test explorer.
I know it's a late reply, but still, there is a solution. Since you're using pytest, I will give details for that test framework.
Python Test Explorer is aware of pytest arguments and most of the pytest arguments can be used to modify test discovery and execution in the same way as if pytest is used from the command line. So, for example, if you want to exclude some folder, you can use --ignore=relative/path/to/some/folder argument. See pytest documentation on --ignore option.
It works pretty much the same if you want only to include some tests or folders. There is no special option for that, just list files and folders you want to include, for example, relative/path/to/some/folder or relative/path/to/some/test_file.py. See pytest documentation on selecting tests.
Now, you have to tell Python Test Explorer what tests you want to include/exclude. This can be done with python.testing.pytestArgs option in settings.json. For example,
"python.testing.pytestArgs": ["--ignore=relative/path/to/some/folder"]
or
"python.testing.pytestArgs": [
"relative/path/to/some/folder",
"relative/path/to/some/test_file.py"
]
Full settings.json for the last example:
{
"python.pythonPath": "python",
"python.testing.pytestEnabled": true,
"python.testing.pytestArgs": [
"relative/path/to/some/folder",
"relative/path/to/some/test_file.py"
]
}
Note: These settings also can be set in pytest.ini or other pytest configuration file. In that case, there is no need to modify settings.json.

Why karate runner file is not run before running the feature files, when running Junit4 Test.java file for tests

Karate suggests that to run all tests in a CI environment, a *Test.java file should be added above the feature files (in hierarchy) and then run using - mvn test command.
I am using my Runner.java file to create test data before the tests are run and then do a clean up. I run this runner file in IDE and everything runs fine - the data is created, all feature files in the same package run and then clean-up is performed. The reason i used the Runner file to create data is because i using karate itself to create test data and the Runner file passes some information on created data to the feature files to run api tests. I had earlier posted a question regarding how to achieve this, please refer to this answer - https://stackoverflow.com/a/55931786/4741035
So now I have a *Test.java file in my project which i run using - mvn test. This runs all the feature files and tests fails as the Runner.java is not executed at all.
Why doesn't karate run the Runner file, if it is present first that the feature files?
Help is much appreciated.
If you are trying to run something "once" before all your tests, use karate.callSingle() documented here: https://github.com/intuit/karate#hooks
var result = karate.callSingle('classpath:demo/headers/common-noheaders.feature', config);
And in the above feature (or JS) you can call Java code using Java interop.
By the way I don't agree with the answer you linked because of the above approaches.

Selenium Maven Project

I am new to automated testing. I am trying to set up a Maven project for my Selenium test automation work. I put all the packages pertaining to envVariables, library, settings, resultLog, errScreenshots etc under src/test/java.
I have a couple of questions here
i)I showed this framework to my developer and he asked me to move some of the packages under src/test/resources. I am not sure whether this needs to be done or whatever I have configured is correct. If I need to move the packages to resources folder, what packages should I move? Can somebody please advise me on how to configure this?
ii) what should the src/main/java folder contain? I thought it will contain the src code of my application and test folder would contain unit tests and selenium tests. But my developer says the test folder will contain only unit test that test the classes in the src/main/java. It should not contain my selenium tests. Can somebody please explain this to me?
Regards
vasu
I am not sure about the structure of your automation project. I prefer the following hierarchy in MAVEN projects
src
|-----main
| |-----java
| |-----Pages (contains application code arranged as one Class per Page)
| |-----Steps (calls the page objects and methods called in Pages)
|-----test
|------java
| |-----Test (Opens browser and calls steps to perform test - TestNG)
|------resources
|-----InputSheets
|-----Environment Variables
The results are saved in C or D drive and are time stamped to avoid getting overwritten.
The automation helper library is created as a separate Maven project and is added as a dependency to the test project. In this way the helper library is independent from the test project and can be used across all projects if need arises.
All this being said, much of the structure is a matter of choice and varies according to your project requirements.
"src/main/" is for production code or test automation framework, not for test cases. "src/test/" is for testing stuff, including selenium tests. "java" folders are for classes, "resource" folders are for configuration and test data.
I suggest creating a separate maven module for your testing stuff: test framework and test cases.
Please refer maven directory layout page for more information.
UPDATE: I have created sample maven project to show how run selenium test with selenide.

Can you run jar files in Pentaho spoon tool?

I want to run a jar file that has java code, inside the Pentaho spoon tool. This run is a single step by accepting an input, running the java class on top of this data and then providing the output somewhere. Is this possible with Pentaho Spoon?
This is very easy. Just pop the jar file into the lib directory with the other jars, and call it from the modified javascript step. ( Or maybe even the java class step if thats more suitable for what you're trying to do )
I've done this several times - most recently for some custom decoding which had to be done in java, and couldnt be done in the java step because janino didnt support it.
A different approach:
leave the jar in your project directly, no copying necessary
create a simple bash script "run.sh" in your project folder with
"java -jar yourjar.jar" in it. you can also add that line directly
within spoon and skip this step
to your job, add a "execute shell script" and point to run.sh
done, the result code of the script determines success or not
why this way? I hate the way the api is documented, no code completion in spoon, Java or Javascript, this way you can write your code outside and rely on working systems

Unable to use Performance Plugin with Hudson

I have been trying to integrate JMeter test with Maven and Hudson. I came across this beautiful post on Maven JMeter and got it set up easily.
And then I got to know that Hudson has a performance plugin using with JMeter results could be directly displayed on Hudson dashboard.
Now problem I face is in using Performance plugin of Hudson.
Performance plugin says to specify path of JMeter Report files wherein default path is considered as "**/*.jtl" if no path is specified.
My Maven JMeter tests produce this file under "target\jmeter-reports\GoogleAdvanceSearch.xml"
Notice that an "xml" file is generated here but it is same as ".jtl" file.
I provided the entire path this xml file under "report files" section of Hudson but when ever I initiate a build I encounter following exception after performance test execution -
Performance: Recording JMeter reports 'C:\SelNG\jmeter2\target\jmeter-reports\GoogleAdvanceSearch-100905.xml'
Performance: no JMeter files matching 'C:\SelNG\jmeter2\target\jmeter-reports \GoogleAdvanceSearch-100905.xml' have been found. Has the report generated?. Setting Build to FAILURE
But I know that file is physically available at the location I specified.
To double check if problem is coz of "xml" file and not having ".jtl" file as specified in performance plugin of Hudson. Now I created a build file which would execute JMeter tests and generate ".jtl" file. Now get to see following ".jtl" file generated. "C:\SelNG\jmeter\GoogleSearch.jtl". I specified this path under "Performance Report > Report files" section of Hudson plugin but again encountered same exception on build execution
Performance: Recording JMeter reports 'C:\SelNG\jmeter\GoogleSearch.jtl'
Performance: no JMeter files matching 'C:\SelNG\jmeter\GoogleSearch.jtl' have been found. Has the report generated?. Setting Build to FAILURE
Finished: FAILURE
Though I know that file 'C:\SelNG\jmeter\GoogleSearch.jtl' is physically available at specified location.
What is that I am missing in here? has any one of u come across such problem while using Hudson-Performance plugin?
Thanks in advance
~ T
I hope this will help you a little.
Hudson select job. Choose configure.
Let's focus on paths
This is my path to tests
c:\Hudson\data\jobs\template-peformance-test2-mvn\workspace\trunk\src\test\jmeter\
This is my path to report files
c:\Hudson\data\jobs\template-peformance-test2-mvn\workspace\trunk\target\jmeter-reports\
For Hudson the root starts in job workspace.
My Build conf:
Root POM: trunk\pom.xml
Goals and options: celan verify
Then in Post Build Actions
selected Publish Performance test result report
Performance report JMeter
Report files */target/jmeter-reports/*.xml