nant scripts written to read values from .xls - cruisecontrol.net

Is there anyway by which we can read a value from an .xls file using nant scripts.The nant scripts should ask the input from the user and based on the inputs the nant.build should search the .xls file and when it sees the match,it should copy the corresponding mail ID and echo that mail ID to some other file and that echoed value should be placed in the mail section of the cruise control.NET .
Please get back to me for any more clarifications
Thanks
GNR

You should write an NAnt extension. It is relatively easy to do.
See this tutorial here
As an example project see my question here and here.

I'll re-phrase my answer :
"Is there anyway by which we can read a value from an .xls file using nant scripts"
If you are talking about using the 'core' NAnt functionality, which is that funcationality that is provided within the basic installation of NAnt, then I would say "No" or "Not very easily".
You can however extend NAnt using .NET libraries to perform whatever function you want, as long as you can code that function in a .NET language.
So, for you to solve your problems, the steps you need to under-take in my view are :
(a) Write a .NET library with methods that undertake the function(s) you describe
(b) Use the 'extensibility' of NAnt to turn your library in (a) into a custom task you can then call directly from your NAnt script
Obviously, you need to be able to break your problem down so that you can code it for part (a). Once you have done that, part (b) is reasonably trivial, and the tutorial I supplied in the link should easily walk you through this.

Related

Handling Excel Spreadsheets with Cucumber

I am planning to work on the Cucumber feature file with Groovy code (Katalon Studio) for step definitions. I wanted to use the excel file in Cucumber file or to see is there any other option to use it.
I have not yet tried as of now any other option. I am thinking just passing the cucumber step file without any parameter and then using the excel file with in the step definition and access excel file and get the corresponding value.
I see there is a post in this forum suggesting to use QMetry Automation Framework for this type of question. But it does not look like this will help on this or should I use the passing the row index from cucumber file and based on that retrieve the value. Please guide on this.
Handling excel spreadsheets with Cucumber Scenario Outline
You should know that this is not supported by Cucumber.
As specified in the FAQ:
"We advise you not to use Excel or csv files to define your test cases; using Excel or csv files is considered an anti-pattern.
One of the goals of Cucumber is to have executable specifications. This means your feature files should contain just the right level of information to document the expected behaviour of the system. If your test cases are kept in separate files, how would you be able to read the documentation?
This also means you shouldn’t have too many details in your feature file. If you do, you might consider moving them to your step definitions or helper methods. For instance, if you have a form where you need to populate lots of different fields, you might use the Builder pattern to do so."
If you are using cucumber java 5+ you can add qaf-cucumber dependency. It should work with groovy as well. It will enable to have examples from external source like CSV, XML, JSON, EXCEL, DB.

Retrieve contents of a ZIP file on SharePoint without downloading it

I have written a bit of automated code that checks a SharePoint site and looks for a ZIP file (lets call it doc.zip). If doc.zip is found, it downloads it, and then checks for a file (say target.docx). doc.zip is about 300MB, and so I want to only download where necessary.
What I would like to know is that given SharePoint has some ZIP search capability, is it possible to write code using CSOM (c#) to find doc.zip, and then run some code to retrieve the contents of doc.zip without downloading it.
Just to re-iterate, I am comfortable with searching for files in a folder on SP, downloading the file, and unpacking zip entries. What I need is to retrieve a ZIP files content on SP without downloading it.
E.g. is there a SP command:
cxt.Load(SomeZipFileQuery);
cxt.ExecuteQuery();
Thanks in advance.
This capability is not available. I do like the idea. Having the ability to "parse" zip files on the server side and then download the relevant bits would be ideal. Perhaps raise this on uservoice to see if others also find this us https://sharepoint.uservoice.com
Ok, I have proven yet again that stubbornness will prevail.
I have figured out that if I use the /_api/search?query='myfile.zip' web REST API to search for my file, this search will also match ZIP files that contain the file I need. And it works perfectly.
Of course there is added (pain) of parsing an XML response, but it works very nicely for my code example.
At least if someone is looking for this solution here it is. I wont bore anyone with code, as the /_api/search has probably been done to death already on other threads.

Random value created in embedded JavaScript, how do I return this into my LoadRunner script?

I am currently creating a script that has an embedded JavaScript file which creates a random value which is causing my script to fail, I've found the function which creates this within the .js file. Is there a way of capturing/returning the generated value from this into my script?
Thanks
Yes. There are many ways. You can reproduce the algorithm in C. Or, you can execute the JavaScript function from within your web virtual user. I prefer to convert to C, but that is not the path for all.
Boris Kozorovitzky, from the HP LoadRunner R&D team,
has a great article on just this topic, located at
http://h30499.www3.hp.com/t5/HP-LoadRunner-and-Performance/How-to-use-JavaScript-in-your-HP-LoadRunner-scripts/ba-p/6197321#.VZvDXRNVhHw
Enjoy!

Starting with Email-ext plug-in

problems using Email-ext
using groovy/jelly script(Default)
Fail to send emails
attachment pattern doesn't work
solution to above problems:
1.create a new job in jenkins and make a note of your job workspace plays an important role.
Email-ext comes with some ready made default scripts which we can use to send emails with attachments.
place the scriptname you are using inside defalut contents use the pattern below
{script,template="nameofthetemplate}
2.make a note that there are no commiters option in this plug-in infact use triggers and send emails to recipents list by selecting one of the options a.developers b.culprits c.recipentslist d.requestors
3.This is the critical point because attachment section in jenkins use Ant script.so Ant script work mainly on realtive addressing rather than absolute addressing.
so content in attachment pattern should be some thing like this
**/foldername/*.txt
(anyextension)
Note:make sure the floder exists in your job workspace
Hope this helps to some extent

A Batch File which contains a Lotus Script

Is it possible to run a batch file containing a lotus script? Would it also be possible to include a lotus script and then another language for example ksh's? If yes then could you please give me some samples or tutorials on how to do it?
What I need to do is this:
There is already an existing batch file which contains a ksh's that updates the value in an excel files every time it is executed.
What I need to do is include two new functions, first I need to download the excel file from a rich text in a document of lotus notes, then run the functions above written in ksh's after that
I need to re-upload it or update the excel file which is in the lotus notes document. I used lotus script for the added functionality.
I also don't know how to use or create ksh's and batch files. Thanks.
I personally would turn around the logic: why not use a scheduled LotusScript or Java- Agent, detach the file from the richtextitem and then run the ksh from there (e.g. using the Shell- Command of LotusScript)...
That way you can code the stuff you need in the languages that are best for your purpose. You could even attach the ksh to a configuration document and detach it on the fly Or build the ksh completely on the fly (with write commands)... That makes this solution replicate to any number of servers without having to distribute your ksh to each of them...
LotusScript runs only within a scripting host engine provided by IBM Lotus, but LotusScript isn't the only way to access Lotus Notes data.
You haven't said what platform you are running ksh on. You mention that you are operating on Excel files, so if you are running your scripts on Windows it may be possible for you to use the Lotus Notes COM classes. Those classes are almost exactly the same as the back-end classes that you would have available in LotusScript, but I have no idea whether any version of ksh (not to mention whatever version you are using) supports the CreateObject call or any other way to access COM classes.
However, a ksh script can certainly run Java programs, and there are Java classes for Lotus Notes that are (again) almost exactly the same as the back-end classes that you would use in LotusScript. It seems to me that the obvious thing for you to do is write a small Java program to retrieve the file from the Domino server, and another Java program to re-upload it after. Then have your script run the program to do the download, run the commands to modify the Excel data, and then run the program to do the upload.

Resources