TYPO3 extensions with good tests - unit-testing

I am looking for a TYPO3 extensions with good test examples - unit tests, functional etc. By good I mean - test that covers possibly lot of code and are up to date so I can actually execute them without fixing anything upfront.
Here some examples which I check:
news 7.0.7 - 261 tests, 14 failed
realurl 2.4.0 - fails to execute
femanager 4.2.2 - fails to execute
devlog 3.0.2 - fails to execute
cs_seo 3.0.2 - fails to execute
aoe_ipauth 1.1.0 - fails to execute

Checkout extensions from Oliver Klee, who started 2009 to implement tests in TYPO3 core.
oelib https://extensions.typo3.org/extension/oelib/
realty https://extensions.typo3.org/extension/realty/
seminars https://extensions.typo3.org/extension/seminars/
Also have a look at his example extension 'ext_tea' at Github https://github.com/oliverklee/ext-tea.
A TYPO3 example extension for unit testing and best practices.
Oliver Klee is giving workshops, and has more examples on Github.
Christian Kuhn implemented a view days ago the possibility in TYPO3 9.5 to run Tests using Docker. Documentation is in progress
Run Build/Scripts/runTests.sh -h to see what is possible.

Related

Pabot - Unable to run parallel robotframework tests

So, I'm working on a robotframework test project, and the goal is to run several test suites in parallel. For this purpose, pabot was chosen as the solution. I am trying to implement it, but with little success.
My issue is: after installing Pabot (which, I might say, I did by cloning the project and running "setup.py install", instead of using pip, since the corporate proxy I'm behind has proven an obstacle I can't overcome), I created a new directory in the project tree, moved some suites there, and ran:
pabot --processes 2 --outputdir pabot_results Login*.robot
Doing so results in the following error message:
2018-10-10 10:27:30.449000 [PID:9676] [0] EXECUTING Suites.LoginAdmin
2018-10-10 10:27:30.449000 PID:400 EXECUTING Suites.LoginUser
2018-10-10 10:27:30.777000 PID:400 FAILED Suites.LoginUser
2018-10-10 10:27:30.777000 [PID:9676] [0] FAILED Suites.LoginAdmin
WARN: No output files in "pabot_results\pabot_results"
Output:
[ ERROR ] Reading XML source '' failed: invalid mode ('rb') or filename
Try --help for usage information.
Elapsed time: 0 minutes 0.578 seconds
Upon inspecting the stderr file that was generated, I have this message:
Traceback (most recent call last):
File "C:\Python27\Lib\site-packages\robotframework-3.1a2.dev1-py2.7.egg\robot\running\runner.py", line 22, in
from .context import EXECUTION_CONTEXTS
ValueError: Attempted relative import in non-package
Apparently, this has to do with something from the runner.py script, which, if I'm not mistaken, came with the installation of robotframework. Since manually modifying that script does not seem to me the optimal solution, my question is, what am I missing here? Did I forget to do anything while setting this up? Or is this an issue of compatibility between versions?
This project is using Maven as the tool to manage dependencies. The version I am running is 3.5.4. I am using a Windows 10, 64bit system; I have Python 2.7.14, and Robot Framework 3.1a2.dev1. The Pabot version is 0.44. Obviously, I added C:\Python27 and C:\Python27\Scripts to the PATH environment variable.
Edit: I am also using robotframework-maven-plugin version 1.4.0.8, if that happens to be relevant.
Edit 2: added the error messages in text format.
I believe I've come across an issue similar when setting up parallel execution on my machine. Firstly I would confirm that pabot is installed using pip show robotframework-pabot.
Then you should define the directory your results are going to using -d.
I then modified the name of the -o to Output.xml to make it easy to identify.
This is a copy of the code I use. Runs optimally with 8 processes
pabot --processes 8 -d results -o Output.xml Tests
Seems that you stumbled on a bug in the prerelease version of robot framework (3.1a2.dev1).
Please install a release version of robot framework. For example 3.0.4.
Just in case anyone happens to stumble upon this issue in the future:
Since I can't use pip, and I tried a good deal of workarounds that eventually made things more unstable, I ended up saving my project and removing everything Python-related from my system, so as to allow me to install everything from scratch. In a Windows 10, 64bit system, I used:
Python 2.7.14
wxPython 2.8.12.1, win64, unicode, for py27
setuptools 40.2.0 (to allow me to use the easy_install command)
Robot Framework 3.0.4
robotremoteserver 1.1
Selenium2Library 3.0.0
and Pabot version 0.45.
I might add that, when installing the Selenium2Library the way I described above, it eventually tries to download some things from the pip repositories - which, if you have a proxy, will cause you trouble. I solved this problem by browsing https://pypi.org/simple/selenium/, manually downloading the 2.53.6 .tar.gz file, then extracting it and running setup.py install on the command line.
PS: Ideally, though, anyone should be able to use proxy settings from the command line (--proxy http://user:password#server:port) to get pip and then use it; however, for some reason, probably related to network security configurations that I didn't want to lose time with, this didn't work in my case.

Is dusk is mandatory to write phpunit test cases?how to write phpunit test cases in laravel 5.4?

I am newbie to laravel. I am using laravel 5.4 version, we have requirement of writing phpunit test cases for our application, So I have searched for writing phpunit testcases and also read the documentation in laravel website. I read about the 'dusk' feature for doing the browser tests. So, I have a doubt that is "Is the dusk is mandatory for writing the phpunit test cases in laravel 5.4? I also tried to install the 'dusk' package into our application but it is not getting installed after I run the command "composer require laravel/dusk".
below is the error that I am getting on command prompt:
c:\xampp\htdocs\ourappname>composer require laravel/dusk
using version ^1.1 for laravel/dusk
./composer.json has been updated
Loading composer repositories with package information
Updating dependies (including require-dev)
Package operations: 2 installs, 4 updates, 9 removals
- Removing maatwebsite/excel (2.1.17)
- Removing phpoffice/phpexcel (1.8.1)
- Removing jeremeamia/superclosure (2.3.0)
- Removing symfony/polyfill-php56 (v1.3.0)
- Removing symfony/polyfill-util (v1.3.0)
- Removing guzzlehttp/guzzle (6.2.3)
- Removing guzzlehttp/psr7 (1.4.2)
- Removing psr/http-message (1.0.1)
- Removing guzzlehttp/promises (v1.3.1)
- Updating psy/psysh (v0.8.3 => v0.8.5): Loading from cache
- Updating swiftmailer/swiftmailer (v5.4.7 => v5.4.8): Loading from cache
- Updating sebastian/diff (1.4.1 => 1.4.2): Loading from cache
- Updating laravel/framework (v5.4.21 => v5.4.23): Loading from cache
- Installing facebook/webdriver (1.4.1): Loading from cache
- Installing laravel/dusk (v1.1.0): Loading from cache
Writing lock file
Generating autoload files
> Illuminate\Foundation\ComposerScripts::postUpdate
> php artisan optimize
[Symfony\Component\Debug\Exception\FatalThrowableError]
Class 'Maatwebsite\Excel\ExcelServiceProvider' not found
Script php artisan optimize handling the post-update-cmd event returned with error code 1
Installation failed, reverting ./composer.json to its original content.
c:\xampp\htdocs\ourappname>
Anyone please tell me how to fix it? and also what is the process for writing the test cases in laravel 5.4? should we use 'dusk'? or any other way to do it? Thanks.
No, Dusk is not required to do unit testing. You can just use the basic tests.
Your error is related to when you installed the Excel package on your application; the Service Provider was added to your config/app.php, but now that you've removed the package from your application ("Removing maatwebsite/excel (2.1.17)") you also need to remove the Service Provider.

Kemal framework - undefined constant HTTP::FormData

I'm trying to set up a web app using the kemal framework written in the crystal language. I followed the tutorial mentioned in the getting started guide here
However, I can't get even the most basic web app to work. The line Kemal.run gives an error which traces to the line lib/kemal/src/kemal/param_parser.cr:69 and shows this error undefined constant HTTP::FormData.
I found the HTTP::FormData module https://github.com/RX14/multipart.cr. Adding this as a dependency and requiring it does not help.
Thanks in advance
You are probably using an old version of Crystal. Check with crystal -v.
HTTP::FormData has been added in Crystal 0.21.0.

pytest-django doesn't discover my tests, unless explicitly invoked

I just started using Django, and have only used PyTest for a couple of projects, but I love them both.
So I was happy to discover the pytest-django plugin that seems incredibly straight-forward and easy to use.
Per part 5 of the Django tutorial (I've been working through that), I've written a number of tests in mysite/polls/tests.py. These run flawlessly with the built-in test runner.
So, now with pytest and pytest-django installed, when I run py.test from within the project root, or py.test polls I get nothing:
When I explicitly invoke my file with py.test polls/tests.py, I get the colorful expected output:
What have I missed? I've followed the set up to the letter, and the Basic Usage docs of the plugin attest that a simple py.test should automatically find my tests. Why aren't they being found?
Following pytest naming conventions, try renaming your test file to:
test_[some text here].py
For example:
test_polls_unittests.py
Read more about pytest - tests naming conventions here.

Why Django nose test need --exe?

Why do I have to use the --exe argument while I run django-nose tests.
If I don't use it, it will skip the tests to run
e.g.
manage.py test myapp
Ran 0 tests in 0.000s
while my tests are in the correct place etc.
Running it in verbosity 3 it shows:
nosetests --verbosity 3 myapp
it shows: (changed the path names, but anyway, nose finds them but skips them!!)
nose.selector: INFO: /path_to_project/path_to_app/myapp/tests.pyc is executable; skipped
nose.selector: INFO: /path_to_project/path_to_app/myapp/tests.py~ is executable; skipped
The only way to run the tests is using the --exe argument
I Am using:
Ubuntu (both 10.4 or 11.4 doesn't matter)
Python 2.6 and 2.7
Django 1.4.3
why is that?
According to the documents you won't need --exe
But after puzzling for a while... and googling and looking here, i got this suggestion.
see Nose doesn't find Django tests
and Nose unable to find tests in ubuntu
But nowhere the explanation of this workaround for what seems to be a bug?
Or Am I missing something?
I requestion this, because the other questions are quite old, and no satisfactory answer to this problem found.....
It's not a bug - it's a feature.
Please, see good explanations here: What does "import safe" mean in Python?