Hi Guys and thank you in advance, I am new two jenkins and I have a test automation project that i usually run it on different environment, now here is how my current project look like in jenkins
QA must to point to a specific configuration file example:
projectName/config/liveEnvironment.text
and the suites must point to the suite to be triggered:
projectName/suites/IAsuite.xml
and here is my ant command:
now what should the variable format look like in the ant, and how can it get it from the choice parameters.
thank you
The parameters are set as environment variables.
In other words you should be able to call them with the normal syntax $variable_name
Related
Full transparency, I really don't know my way around maven. I have created an automated test suite using cucumber, and I run all my tests through maven commands e.g. simplest one is below
mvn clean verify -Dcucumber.options="--tags '#TestTag'"
The above, will run all cucumber tests with the tag #TestTag. Parallel runs and everything else is running fine. However, I would love a user interface of sorts where I can pass the tag parameters amongst other items that I have added to the pom as properties (e.g. -Dnumber.of.devices=2, -Dtype.of.run=fragmented).
Something like a dropdown that lists all my available tags, a swith to mark it as distributed/fragmented, a dropdown to set the number of devices to run against. At the moment, I'm manually creating each maven command for each run, saving them when neccesary to Intellij configurations. But is there any tool out there that I can just add the parameters I care about, and it will run the command with those parameters added to my mvn clean verify command?
Something like
mvn clean verify -Dnumber.of.devices=<NUMBER_ENTRY> -Dtype.of.run=<FRAGMENTED_OR_DISTRIBUTED> -Dcucumber.options="--tags '<CUCUMBER_TAGS>'"
I have already taken care of how those properties will determine the type of run I want.
I would have thought there would be something like this that exists, but can't find anything. I'm totally aware that what I'm asking is ridiculous/silly. Anyway, if anyone can point me towards something or offer advice why this isn't a thing, I'd be very much appreciative.
Thanks
Jenkins. It was Jenkins. I avoided it because reading about it seemed kind of daunting. But once I set it up, it was pretty easy. I now have all my configs as I want them, looking forward to digging into the million plugins they have available.
Is there any jenkins property which can i access in my java code to identify that code is running on jenkins ? I have around 1000 of test cases running on different jenkins CI, which is managed by different teams. I dont want to set any manual flag or string properties in each of my jenkins build, There should be some property which can be use to identify this ?
You can take a look at this page which calls out all the environment variables that are exposed by Jenkins. So you could have your Java code query any of these environment variables to determine if the java is being run in a Jenkins environment or is it being run from a dev box or an IDE even.
I'm using Netbeans with Maven and TestNG. When running tests with the maven surefire plugin, I can setup some configuration parameters, in particular the logging level used for my tests (trace):
-Dorg.slf4j.simpleLogger.defaultLogLevel=trace
-Dorg.slf4j.simpleLogger.logFile=System.out
However, when running a specific test file (CTRL + F6) or test method ("run focused test method"), Netbeans does not use surefire (which is good) and therefore ignores those parameters.
Is there a way to change the JVM parameters used by Netbeans when it runs tests that way?
This is somewhat similar to this other post but my question is specific to Netbeans.
From the documentation of Netbeans 7.2 (see Netbeans 7.2 changes, section Maven) :
... Now Test File always runs Maven by default, just like Test Project ...
What version of Netbeans are you using? Probably you should just upgrade to 7.2.
In the Project Properties, you can create profiles under Run. In theses profiles you can customize VM Options. You can add your parameters here, create a Test config and Run config.
Set fork property in the surefire plugin configuration in Maven. This will start a new JVM. Now, the second part is how to read the JVM parameters that you want into the new JVM. Depending on what you want to do, you might need to be read them from the environment.
In my case i went to project/properties, then "Actions" category. There you'll find "Test file" and "Debug test" actions. Select them and place whatever properties you need in "Set properties" box.
Not sure if this is only applicable for Maven projects...
I'm setting some environment variables by some windows batch commands in the pre-build steps for a Jenkins build. I need to use these variables for a few java selenium test cases which will run during as part of the build.
set HD_KF_TC_IN_LOOK_UP_KET_FEATURE_XLS = %WORKSPACE%\selenium_input_files\Key_Features\en_US
I have tried to retrieve these environment variable values by using System.getEnv(HD_KF_TC_IN_LOOK_UP_KET_FEATURE_XLS) commands. But this is not working as the values for these variables is always NULL.
Please let me know where I'm I going wrong?
As indicated in my comment, I do not completely understand your setup. In general, however, environment variables set in one Jenkins build step do not propagate outside of it and can't be accessed from other build steps. You need to use EnvInject plugin to achieve that.
I need to pass a VM parameter to every test that is run in the project. Setting this manually doesn't seem to be the most convenient solution, so is there any possibility to pass the parameter to every test automatically.
Thank you for help.
We change the JRE Configuration in Eclipse (Preferences>Java>Installed JREs). There you can set default VM Arguments which are used for anything you run with that JRE.
Now simply configure your project to use this JRE (Java Build Path) and you should be on the right way.
Eclipse have already a built-in JUnit for you.
You can use JUnit to run different parameters on your main program.
Run your test once, this creates a run configuration.
Run-> Run Configurations -> JUnit, select your run configuration, then you have an arguments tab to specify JVM or program arguments.
You can then duplicate this run configuration to use for other tests. I'm not aware of any way to make a default setting to be applied to all future test launches.
I think you are using "Program Argument" instead of "VM argument" now. If you use VM argument it's mean globally applied to all of your tests.