We have an app.exe that uses another 3rd party installation wizard app, InstallAnywhere, to install our application.
It is a text-based wizard - meaning a new shell is spawned (and the child process is executing some java.exe in order for its wizard steps to work) when
app.exe -i console
in the parent shell is executed.
Can pexpect be used in this case as a kind of question/answer interaction ?
We tried it with Hudson but it appears that Hudson can only monitor the parent process and not its child process. When Hudson job kicks off the python script, it starts but fails to begin at step 1 of the wizard - it hangs.
How can we overcome this ?
Thanks
If I'm reading this correctly, you want to interact with your executing installer (in this case, using pexpect) during a Hudson job, probably to do automated testing.
I'm thinking that expect may get you where you want to go if you call expect from a shell script (or batch file) that is, in turn, run from Hudson. The script would execute the tests, using your favorite flavor of expect, during which it either exits successfully or fails. Hudson would detect the failure, and you could then react accordingly. Your script, and any expect messages, would write to stdout, which Hudson would collect into your build log.
However, Flexera has a testing framework that allows you to test an installer via JUnit. Look at the bottom of this page. Or check out the JavaDocs.
This might give you more precision than an expect hack. You might even be able to write a Hudson plugin and do way with expect and shell scripts completely.
Update: after looking over the Javadocs, I found that the main class GUIAutomationFixture uses Java's Robot class. This means you probably won't be able to run this class on a headless server. You'll likely need either Windows, or a Linux/Unix box with a working X system.
Related
We run Bamboo CI Server.
There are a number of misconfigured plans (who don't correctly inherit the build.xml from the template project in our version control, or who don't set -D properties correctly according to our internal standards) that will trigger an Ant's input task.
While my template project prevents inputs by detecting whether we are running or not in Bamboo, this is not developer-fail-proof.
I would like to ask if there is any way to either crash Ant, or redirect the stdin to /dev/null at Bamboo instance level.
Currently, plans stuck at inputs will simply wait indefinitely until the main plan timeout rings, which could be a great idea to reduce.
I have a significant set of Groovy pipeline scripts for our Jenkins build process. I am in the process of moving those scripts onto another instances, and would like to replicate the set of approved scripts that were not originally white listed.
Is it possible to export the list of approved signatures and import them into another instance?
The only other solution I have is to constantly run and rerun the scripts and approving each signature as it breaks the build. Since the scripts are quite complex, and not every run is guaranteed to hit each line, this is not going to be a quick process.
The other option would be to create a master 'white list' script which runs all the currently non-approved scripts again and again until all instances had been approved.
Neither of these options is great, so I'm hoping for a simple import/export to avoid having to do this work altogether, but I certainly can't see an option available to be in the UI.
Cheers
I do not believe there is import/export functionality by default but maybe there's a plugin that'll do it.
If you have access to the directory Jenkins' is installed or runs in you should be able to find the scriptApproval.xml file.
If you explore that you'll find approvedScriptHashes and approvedSignatures etc. You can lift this file entirely and paste it in the new instance or copy across the specifics you need (either way you'll need a restart).
Looks like there's an open request for this sort of functionality here
Robot framework is keyword base testing framework. I have to test remote server so
i need to do some prerequisite steps like
i)copy artifact on remote machine
ii)start application server on remote
iii) run test on remote server
Before robot framework we do it using ant script
I can run only test script with robot . But Can we do all task using robot scripting if yes what is advantage of this?
Yes, you could do this all with robot. You can write a keyword in python that does all of those steps. You could then call that keyword in the suite setup step of a test suite.
I'm not sure what the advantages would be. What you're trying to do are two conceptually different tasks: one is deployment and one is testing. I don't see any advantage in combining them. One distinct disadvantage is that you then can't run your tests against an already deployed system. Though, I guess your keyword could be smart enough to first check if the application has been deployed, and only deploy it if it hasn't.
One advantage is that you have one less tool in your toolchain, which might reduce the complexity of your system as a whole. That means people can run your tests without first having installed ant (unless your system also needs to be built with ant).
If you are asking why you would use robot framework instead of writing a script to do the testing. The answer would be using the framework provides all the metrics and reports you would otherwise script for yourself.
Choosing a frame work makes your entire QA easier to manage, save your effort to write code for the parts that are common to the QA process, so you can focus on writing code to test your product.
Furthermore, since there is an ecosystem around the framework, you can probably find existing code to do just about everything you may need, and get answers to how to do something instead of changing your script.
Yes, you can do this with robot, decently easily.
The first two can be done easily with SSHLibrary, and the third one depends. Do you mean for the Robot Framework test case to be run locally on the other server? That can indeed be done with configuration files to define what server to run the test case on.
Here are the commands you can use from SSHLibrary of Robot Framework.
copy artifact on remote machine
Open Connection
Login or Login With Private Key
Put Directory or Put File
start application server on remote
Execute Command
For Running Tests on Remote Machine(Assuming Setup is there on machine)
Execute Command (use pybot path_to_test_file)
You may experience connections losts,but once tests are triggered they will be running on remote machine
Has anybody discovered any means to fire an ant build process automatically based on file system changes?
I basically want my ant build system to begin building similar to an IDE (compile java classes) but from some sort of command line service.
If not, there's always coding one up with Java and integrating the Ant API into it.
I am familiar with continuous integration systems like Jenkins and the like, however I need the build to be fired not check-in. Also I would like it to be independent of the IDE, as that could work on post-save.
I'm looking for an independent build service without source control requirements.
Since you are using ant I assume a java based directory polling program will help here. You can write a program using IO notification api
Notes from the page
When to Use and Not Use This API
The Watch Service API is designed for applications that need to be
notified about file change events. It is well suited for any
application, like an editor or IDE, that potentially has many open
files and needs to ensure that the files are synchronized with the
file system. It is also well suited for an application server that
watches a directory, perhaps waiting for .jsp or .jar files to drop,
in order to deploy them.
This API is not designed for indexing a hard drive. Most file system
implementations have native support for file change notification. The
Watch Service API takes advantage of this support where available.
However, when a file system does not support this mechanism, the Watch
Service will poll the file system, waiting for events.
Edit
After I wrote that this question and its answer seems to be more useful here: Is there a sophisticated file system monitor for Java which is freeware or open source?
The widely practiced way is a way of "continuous build" / "continuous integration". A sample work-flow:
You check in your code into a source control repository
Continues Integration server picks up changes from the repository and starts a build process
The build process results in either success or failure giving you a fast feedback
Lot's of continuous integration servers (Bamboo, Jenkins, Go) support Ant natively.
You can also set up post-save hooks in your IDE. Most modern ones support it: IntelliJ, NetBeans, Eclipse.
Look up "continuous integration" in google.
A friend pointed me to this:
https://serverfault.com/questions/179706/how-can-i-trigger-a-script-to-run-after-the-rsyncdaemon-received-file-changes-to
A little script to monitor for changes and execute and independent task.
If anyone has a better method that works with ANT scripts directly, let me know.
What kind of agile tools are you using for Erlang development? What continuous integration (CI) server are you using to build Erlang code? The only reference I got was from Quora question How do I integrate Erlang unit tests in Jenkins (Hudson)?.
I am also interested in the nifty details of setting them up and making talk to each other.
As a company using Erlang actively, Klarna (www.klarna.com) use Jenkins (formerly Hudson) for daily regression test on nearly every dev commit. It's an org with about 80 people total in rnd and we use distribute mode of Jenkins which allows us to have more than 10 build slaves mastered by only one Jenkins server. Basically we have a code base with Eralng code which is version controlled by tools like svn or git. All these testcases are under common test framework and all works well under Jenkins.
Previously, we tried Cruise Control and gave it up since Jenkins does much better.
As Lukas mentioned, you probably will need a tool to gen xml files sine common test doesn't export them directly. Haven't really tried that module though, we do have an implementation of common test event handler to do the job, but it was abandoned due to performance, we do have a a critical requirement on test time. right now, we use a own made script to export xml from common test log directly.
There are a lot more you could do with Erlang and Jenkins, like code coverage analyze if you compile properly and export formatted xml to Cobertour plugin, gui test with selenium etc.
For setting up Jenkins, I think Jenkins home page has a good introduction.
Regarding agile tools, I guess it's really hard to define what a agile tool. Also what I believe is it's very much depend on the size of you org. You will probably need a good process view tool (team level or depart level), a good ticket tracking tool, code review tool, communication tool. There are bunch of them implemented under open source. According to our exp, none of them seems to be able to work seamlessly with Jenkins which means you will need to select and tweak by your own requirement. BUT that's the beauty of open source isn't it :)?
If you want to do it using Jenkins, I have written a common test hook which generates JUnit XML output for your tests which Jenkins can use to produce test statistics.
https://github.com/garazdawi/cth_tools/blob/master/src/cth_junit.erl
We use Jenkins for our Python code, so I think you may use Jenkins with Erlang code.
We use buildbot with our own recipes to hook unit tests.