Best Site to refer: http://ramonvictor.github.io/protractor/slides/#/
Thursday, July 9, 2015
Sunday, June 14, 2015
References
<!--https://cdivilly.wordpress.com/2009/07/20/maven-jruby-and-rails-migrations/-->
<!--http://www.weblogism.com/item/344/call-rake-from-maven-->
<!--http://www.ning.com/code/2011/09/jruby-sinatra-web-service-as-an-executable-jar/-->
<!--http://chris.chowie.net/2011/08/28/Sinatra-with-JRuby-on-Heroku/-->
<!--http://www.weblogism.com/item/344/call-rake-from-maven-->
<!--http://www.ning.com/code/2011/09/jruby-sinatra-web-service-as-an-executable-jar/-->
<!--http://chris.chowie.net/2011/08/28/Sinatra-with-JRuby-on-Heroku/-->
Wednesday, May 20, 2015
Sunday, November 30, 2014
Transforming a line item
Extending the World class is one way to extend the functionality of Cucumber. In this section we will
look at another. In a few of our step definitions we have specified that we wanted to use a specific
“line item”. In those steps we had to always take the String Cucumber passed and convert it to a
number using the to_i method. If we want Cucumber to automatically convert it for us we can use
a Transformation. Let’s look at that now.
The first thing we need to do is create a new file in the support directory named transformations.rb. The file name doesn’t matter; I just like to collect all of my transformations in the same file. On a typically large project you might see up to five or six transformations. In this file we will create our first transformation:
Transform /^line item (\d+)$/ do |line_string|
line_string.to_i
end
This structure should look familiar. It is very similar to step definitions except it begins with the
word Transform instead of Given, When, or Then. To break it down completely, what we are saying
with this code is find a capture group of a step definition (portion of a step definition surrounded by
parentheses) that contains “line item” plus a number and perform the following action on the value
of the number. In order for this Transformation to find the appropriate step definitions we will need
to move the opening parentheses to surround the entire match.
Then /^I should see "([^"]*)" as the name for (line item \d+)$/ do |name, lin\
e_item|
Now we no longer need to convert the line_item parameter to a number since the Transformation
takes care of this for us.
This technique is very useful when you have values that need to be converted and you wish to move
the logic from multiple steps to one Transformation. For example, imagine you need to perform a
lot of date handling. It would be nice to say things like today, tomorrow, or yesterday and have a
Transformation object create a date object.
Source: Cucumber and Cheese book
Friday, October 17, 2014
Wednesday, September 3, 2014
Sunday, July 27, 2014
Generate Videos during Test Automation
I understand that videos play an important role in Test Automation. Some people think that videos
are not so much important in test automation, but my experience taught me that even videos give you lot of information that lets every one knows what happens during test execution, and other information that happens during test execution.
Here, I would like to explain a very simple mechanism to have your scripts generate videos of your test scripts. We know that capturing videos are little tricky and need to depend on some third party tools. Here is a third party freeware/open source using which we can have the videos generated for our scripts.
The example I describe would be in php as some people do not get an idea how to capture videos using php, as php is not flexible to use like other high level languages such as C#, Java, etc.,
FFMpeg is an command line tool using which we can generate videos. And I do not want to describe a lot here, to let readers do their task immediately.
download the ffmepg from the link: http://ffmpeg.zeranoe.com/builds/
once you download the build extract the file and put ffmpeg.exe in your system path you define in Environment variable. example: C:\DriverCapture is my path i define in System environment varible "Path".
And then, write the command
command: ffmpeg -f dshow -i video=\"screen-capture-recorder\" -r 5 -threads 0 testMethod1.wmv
in your phpfunction. Now use shell_exec(command) to launch the video.
example:
public function StartVideoThreadForTest($testMethodName)
{
//Run the Command to Start running the video without CaptureVideo.exe
$cmd="ffmpeg -f dshow -i video=\"screen-capture-recorder\" -r 5 -threads 0 ".$testMethodName.".wmv";
shell_exec($cmd);
}
Now call this method before your test runs. To stop the video capture use the following command to stop:
shell_exec('taskkill /F /IM ffmpeg.exe');
But, When you run your script you observe that your execution does not move from video launch command, to make it work.
Create a .NET console project and put the following code in the Main method.
namespace CaptureVideo
{
class Program
{
static void Main(string[] args)
{
Process ffmpeg = new Process();
ffmpeg.StartInfo.FileName = "c:\\seleniumDrivers\\ffmpeg";
ffmpeg.StartInfo.Arguments = " -f dshow -i video=\"screen-capture-recorder\" -r 5 -threads 0 -y "+args[0]+".wmv";
ffmpeg.Start();
}
}
}
In the above program I put the ffmpeg in the c:\seleniumDrivers\ folder.
Compile the above program, you will see an exe (CompiledVideo.exe - project name) generated inthe debug folder. Noe put the compiled exe in the system path you used to place ffmpeg directory.
And now use the following php function to run the video recorder on background:
public function StartVideoThreadForTest($testMethodName)
{
//Run the Command to Start running the video without CaptureVideo.exe
//$cmd="ffmpeg -f dshow -i video=\"screen-capture-recorder\" -r 5 -threads 0 ".$testMethodName.".wmv";
$path=__DIR__.'/../../../Output/';
$cmd="CaptureVideo ".$path.$testMethodName."-".time();
shell_exec($cmd);
}
Subscribe to:
Posts (Atom)