From 3902ca6332db6f827651ec55edecc4c171ee7675 Mon Sep 17 00:00:00 2001 From: puneet0191 Date: Sat, 31 Oct 2015 21:34:54 +0530 Subject: [PATCH 1/3] Updating Robo File to add the functionality to run each method. --- RoboFile.php | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 59 insertions(+), 1 deletion(-) diff --git a/RoboFile.php b/RoboFile.php index 1dc93c9..751824c 100644 --- a/RoboFile.php +++ b/RoboFile.php @@ -155,12 +155,70 @@ class RoboFile extends \Robo\Tasks $pathToTestFile = 'tests/' . $suite . '/' . $test; - $this->taskCodecept() + //loading the class to display the methods in the class + require 'tests/' . $suite . '/' . $test; + + //logic to fetch the class name from the file name + $fileName = explode("/", $test); + $className = explode(".", $fileName[1]); + + //if the selected file is cest only than we will give the option to execute individual methods, we don't need this in cept file + $i = 1; + if (strripos($className[0], 'cest')) + { + $class_methods = get_class_methods($className[0]); + $this->say('[' . $i . '] ' . 'All'); + $methods[$i] = 'All'; + $i++; + foreach ($class_methods as $method_name) + { + + $reflect = new ReflectionMethod($className[0], $method_name); + if(!$reflect->isConstructor()) + { + if ($reflect->isPublic()) + { + $this->say('[' . $i . '] ' . $method_name); + $methods[$i] = $method_name; + $i++; + } + } + } + $this->say(''); + $methodNumber = $this->ask('Please choose the method in the test that you would want to run...'); + $method = $methods[$methodNumber]; + } + if(isset($method)) + { + if($method != 'All') + { + $this->taskCodecept() + ->test($pathToTestFile . ':' . $method) + ->arg('--steps') + ->arg('--debug') + ->run() + ->stopOnFail(); + } + else + { + $this->taskCodecept() + ->test($pathToTestFile) + ->arg('--steps') + ->arg('--debug') + ->run() + ->stopOnFail(); + } + + } + else + { + $this->taskCodecept() ->test($pathToTestFile) ->arg('--steps') ->arg('--debug') ->run() ->stopOnFail(); + } } /** From ba916e5e0e10b3e3513b80ca40e2476402bf0b5f Mon Sep 17 00:00:00 2001 From: puneet0191 Date: Sat, 31 Oct 2015 21:35:31 +0530 Subject: [PATCH 2/3] Updating Composer File --- composer.lock | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/composer.lock b/composer.lock index 2ac7273..e603d79 100644 --- a/composer.lock +++ b/composer.lock @@ -499,18 +499,16 @@ ], "authors": [ { - "name": "Henrik Bjornskov", - "email": "henrik@bjrnskov.dk", - "homepage": "http://henrik.bjrnskov.dk" + "name": "Yaroslav Kiliba", + "email": "om.dattaya@gmail.com" }, { "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" + "email": "ever.zet@gmail.com" }, { - "name": "Yaroslav Kiliba", - "email": "om.dattaya@gmail.com" + "name": "Henrik Bjrnskov", + "email": "henrik@bjrnskov.dk" } ], "description": "Resource Watcher.", @@ -527,12 +525,12 @@ "source": { "type": "git", "url": "https://github.com/joomla-projects/joomla-browser.git", - "reference": "b0056ff0018c529cc2a143f6d78004bce8f9d5b0" + "reference": "cdc02b3e3d7c112d83d625db7ea410dac4ce3142" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/joomla-projects/joomla-browser/zipball/b0056ff0018c529cc2a143f6d78004bce8f9d5b0", - "reference": "b0056ff0018c529cc2a143f6d78004bce8f9d5b0", + "url": "https://api.github.com/repos/joomla-projects/joomla-browser/zipball/cdc02b3e3d7c112d83d625db7ea410dac4ce3142", + "reference": "cdc02b3e3d7c112d83d625db7ea410dac4ce3142", "shasum": "" }, "require": { @@ -570,7 +568,7 @@ "acceptance testing", "joomla" ], - "time": "2015-10-31 11:00:18" + "time": "2015-10-31 15:09:12" }, { "name": "joomla-projects/robo", From 277ff5c803b15fa1b2ff6570138d0f8be1dac597 Mon Sep 17 00:00:00 2001 From: javier gomez Date: Sun, 1 Nov 2015 16:19:12 +0100 Subject: [PATCH 3/3] Improve logics in run:test method --- RoboFile.php | 37 +++++++++---------------------------- 1 file changed, 9 insertions(+), 28 deletions(-) diff --git a/RoboFile.php b/RoboFile.php index 5990e69..5b68639 100644 --- a/RoboFile.php +++ b/RoboFile.php @@ -204,37 +204,18 @@ class RoboFile extends \Robo\Tasks $methodNumber = $this->ask('Please choose the method in the test that you would want to run...'); $method = $methods[$methodNumber]; } - if(isset($method)) - { - if($method != 'All') - { - $this->taskCodecept() - ->test($pathToTestFile . ':' . $method) - ->arg('--steps') - ->arg('--debug') - ->run() - ->stopOnFail(); - } - else - { - $this->taskCodecept() - ->test($pathToTestFile) - ->arg('--steps') - ->arg('--debug') - ->run() - ->stopOnFail(); - } - } - else + if(isset($method) && $method != 'All') { - $this->taskCodecept() - ->test($pathToTestFile) - ->arg('--steps') - ->arg('--debug') - ->run() - ->stopOnFail(); + $pathToTestFile = $pathToTestFile . ':' . $method; } + + $this->taskCodecept() + ->test($pathToTestFile) + ->arg('--steps') + ->arg('--debug') + ->run() + ->stopOnFail(); } /**