So, I'm using Junit for Java and I've gotten convinsed of the benefit of TDD. Now I'm working (with a team) on a webapplication for my boss (html/css/php) and proposed to write some tests in PHPunit for the WA. But I can't find any way the code processes data (but the WA does work so far). I started google-ing and found only tutorials who work with functions in the code to test.
My question is: is it even possible to use PHPunit for testing the php-code from between the html-lines?
You're talking about functional testing rather than unit testing. Codeception (built on top of PHPUnit) might be a good place to start for you, since it has more natural functional testing out of the box.
Some example:
https://codeception.com/docs/02-GettingStarted
https://codeception.com/docs/03-AcceptanceTests
Related
I am exploring the use of Robot Framework for writing unit tests in Python. We currently have some pre-existing unit tests that were developed using pytest. The unit-tests mock certain functionalities using the mock.patch method (such as connecting to and reading from DBs). Is there an equivalent mock functionality in Robot? Or should one have to write libraries to do it? I am very much a newbie when it comes to Robot and unit tests, so please go gentle on me :)
From a Stack Overflow perspective this question is quite broad. Luckily the answer to this question can be determined from the Robot Framework site:
Robot Framework is a generic test automation framework for acceptance
testing and acceptance test-driven development (ATDD).
Although you can integrate it with a unit test framework through custom Python development, the real question is whether you should. In-line with the above definition I'd recommend not mixing the Unit test layer with your other (Integration, Acceptance
etc) test layers and keeping them separate.
Define a test approach with layers so that each layer builds upon the confidence obtained from the previous ones. This will reduce the scope of testing in each following layer and thus the overall complexity of your test setup.
Some years ago I´ve tried to work with BDD and some tools of Acceptance tests, like Selenium/Web-driver, Fitnesse and JBehave.
I´d like to back to work with that in my current project, so I would like to know what the community is using of tools to perform that!
My project is based on Java.
Acceptance tests tools ?
BDD tools?
Should I consider a scripting language ?
The most successful teams are using conversations and not worrying too much about the tools!
Having said that, here are a few Java BDD tools that are in use in the community:
JBehave* (still)
Cucumber for the JVM (I don't think it's been as maven-ized as JBehave)
Fitnesse (though I recommend putting "Slim" behind it instead of "Fit")
Custom DSLs (it's not that hard).
Selenium is still the automation tool of choice for Java and the web.
*I helped write JBehave. One reason we got into it in the first place was because the acceptance tests we saw using scripts were such an astonishing mess. Meh. Also, you can't collaborate with the business or have conversations about scripts. I strongly recommend having conversations first**, then worrying about the tools!
** If you're working on your own, buy a rubber duck.
I strongly recommend spockframework + Geb. You need groovy support though. We have lot of tests running as part of CI every night. The reports are in junit format (being enhanced to be used by business users soon) and hence can be published to servers like Hudson or Sonar.
I'm a rails developer, and I want to do some capybara+(rspec or cucumber) style of integration testing with cakephp 2.0. I was using PHPUnit (the default test framework for cake 2.0) but I don't know how to integrate it with Selenium and Cake at the same time to get the full stack effect that you have on rails
So, for the experience php devs that have used cake 2.0... how do you guys do a proper integration testing?
I'm not surprised there's been no answer on this - the community of testers within CakePHP seems to be extremely small. I've worked on large projects with huge numbers of functional and unit tests (currently a suite of around 1500 tests), but to do that I needed to extend the CakePHP test suite functionality (you can take a look at my now slightly outdated TDD plugin).
When we started we didn't know a whole lot about integration testing, and setting up a decent unit testing environment was enough of a challenge. We now use Rails :)
Basically, this is not a well-worn path. To get something working will require an extension to the framework - it will also require a new test case class, which extends PHPUnit_Extensions_Selenium2TestCase, and integrates any necessary functionality from CakeTestCase and ControllerTestCase.
I hope you get somewhere! If you do, it would be great if you could share the code with the rest of the community.
We are working in a small team. We often had problems like developer1 did some changes in stored procedure or function and it affected work of developer2. Such issues are traced out by chance later. Please guide me how such issues can be stopped. Is there a free tool that we can run to test such issues?
Slowly introduce unit tests, focused integration tests and full system tests.
For all of those use a .net unit test framework to do it. It'll be what you do in the test what makes it be any of the above scenarios. Make sure to keep each of those 3 type of tests separately, as those will have a big difference on the speed it takes to execute them.
For the unit test framework I suggest NUnit but there are others, one that I've found interesting but never made the jump is xUnit.net.
For full system tests I suggest to run them in the unit test framework using WatiN. You could also go with Selenium RC.
We often had problems like developer1 did some changes in stored procedure or function and it affected work of developer2. Such issues are traced out by chance later.
For that specific type of scenario I strongly suggest focused integration tests. Full system tests might catch such scenario, but it will still left you to figure out why it broke.
Instead focus the test in the very specific db access code that makes the call to the procedure. By adding scenarios in there that reveal all the expectations developer2 had from said procedure when (s)he wrote the related .net code, regression issues with that integration code can be revealed very quickly and be dealt with very effectively. Also note that developer1 can easily run the focused integration tests that involve that procedure or area of the database many times / which is a lot more likely to happen than doing the same with full system tests.
You can do either automated unit testing using tools such as NUnit or automated black-box testing using tools such as Selenium. Note that both options (even with free tools) may need significant investment in terms of time and efforts. Typically, unit test cases are created by developers them selves while for automated black box testing, a separate team of QA is utilized - this is mostly because unit test cases are generally written in languages such as C#, VB.NET while automated black-box testing tools typically utilize scripting languages.
We are in search of an automated testing tool for our project. As we are in testing department we prefer a tool which would have less programming in it. Please suggest some tools for us .Till now we are testing our application manually.
Our project is being developed in Java.
Is there any freeware tool that I could use or is it better to go for a paid tool?
Thanks in Advance.
Less programming? You'll need something like JUnit to write unit tests if you want to do serious regression testing, but unit tests require you to write some code
Here's a big list of open-source testing tools, some of them may offer what you want: http://java-source.net/open-source/testing-tools/junit
For example, T2 claims to be a random testing tool. As one, it is fully automatic, but one must keep in mind that the code coverage of random testing is in general very limited. It should be used as a complement to other testing methods. T2 checks for internal errors, run time exceptions, method specifications, and class invariant.
Not sure if you mean a CI tool or not, but we use Hudson at Zappos and it works pretty well.
http://hudson-ci.org/
..and there's also CruiseControl: http://cruisecontrol.sourceforge.net/
If you're not talking about CI, maybe you mean QA testing - in which case you should take a look at something like Selenium (for web apps):
http://seleniumhq.org/
If you're doing GUI testing? I'm not really familiar with that area, but I've heard about WinRunner and Rational:
http://en.wikipedia.org/wiki/HP_WinRunner
http://www-01.ibm.com/software/rational/offerings/quality/
..though neither are really free tools. Something like AutoIT might help you move widgets around, but it lacks the reporting parts:
http://www.autoitscript.com/autoit3/index.shtml
There could be two answer to you question:
Besides Selenium, though it has ample of advantages, I am reading about another tool which uses same API which Selenium use. The only changes in API I have seen so far is it reduces the complexity of functions thus making it more easier and simpler for user who is learning.
The tool is called 'Helium' and it has 50% (and more) less complex functions and code as Selenium has.
The only problem with this tool is it is paid tool for learning purpose and for implementing not-so-big scale project you can use it. But yeah after some time its gonna cost you.
I have implemented some code on Helium. Please let me know , if you face any issue initially or you are thinking to implement it.
Other being, you can use Selenium Builder(http://khyatisehgal.wordpress.com/2014/05/26/selenium-builder-exporting-and-execution/) which is an advanced form of Selenium IDE. It imports your command in different languages and does work more effectively and efficiently as Selenium IDE does(http://khyatisehgal.wordpress.com/2014/05/25/selenium-builder/) . So you can import scripts in Eclipse IDE and just execute them as is.
Please let me know , if you have any doubt in any of the tool.