New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add unit tests #490
Comments
I'd love to see tests for PW! There are definitely more people interested in this: See https://processwire.com/talk/topic/19396-using-nette-tester-with-processwire/ or https://github.com/uiii/tense |
For the record, Ryan has stated on a few occasions that he's using an updated version of https://github.com/niklaka/ProcessWireTests. I'm not sure if that's still true, and his version of the test suite has never been publicly available (to my best knowledge). |
Thanks @BernhardBaumrock yes, they're like a sanity check for me, and a way to think about improvements. Tense looks great; one of the hardest bits in non-trivial/unit testing is setting up the fixture dbs etc. so it's fab to see that someone's done that grunt work. I've not come across Tester by Nette before. Seems interest is waning - article is few years old but if if you click the graphs they're bang up to date and show the same trend: Nette ↓ and 1/100th of popularity of phpunit which is rising continually with an upward curve. I note Nette make Tracy debugger, which is super though. |
I've almost no experience with testing, but I really like what the folks at Nette are doing. TracyDebugger is great and their forms component is the best I could find. Also Latte is in my opinion absolutely brilliant and far superior than the other template engines. Of course that's a matter of taste. If download numbers were the only thing that counts we'd all be using laravel: I've seen another open source project where you had to provide a test-case with every issue report that you made. That could be a good way to force people to do their homework before posting issues and also it could help to improve PW in the long run, as a test that we added once could be run on every new release and find issues before they make problems. |
@BernhardBaumrock I'm sure Tester works fine; I was just going on the idea that we have a choice:
But anyway, I'd be happy with any framework - we just need tests! I'm not sure why Ryan would be keeping tests private; maybe he wasn't sure it was in a position for others to help build on yet. It's great that this idea has some supporters though |
I fully agree, |
I definitely want tests too. I find too much minor bugs in PW, and even regression like this one. I'm currently building a somewhat big project using lot of PW features, and am saying to my client: "never update PW without testing the whole site, tools and Web API on staging server". That's not good at all. A public github repository for unit tests would be awesome, so @ryancramerdesign would not be alone to write tests. On my side I use PhpUnit. |
Adding another vote for a test suite. Any test is better than no tests for a project as complex as ProcessWire. Writing tests for a few hot paths around selectors, data integrity and security would be a great start and an important signal to new adopters. So many of the recent updates have led to subtle bugs that it has really eroded my trust in the software. I now dread upgrading the core on my customers' sites, which makes me a bit sad: backward-compatibility and long-term stability was one of the main selling points when getting into PW a few years ago. |
Short description of the enhancement
Tests are really important in software development. They help detect (and thereby can help prevent) regressions, and also can be used to document quirks. ProcessWire is big and complex and deserves this good discipline.
Current vs. suggested behavior
Currently, as far as I (and at least one other person) can see, there aren't any tests. As a new person to PW, this makes me very nervous as I've been around software too long to believe anyone can write it without bugs.
For example, the selector strings - there's some very complex logic in there - that really deserves some tests.
Why would the enhancement be useful to users?
Optional: Screenshots/Links that demonstrate the enhancement
For example, here's a crude phpunit test that documents the inconsistencies in support for case-sensitivity and UTF8 in a couple of the Selectors:
Running these tests gives this:
PHPUnit is an amazing tool for all sorts of tests, from pure unit tests through to integration and end-to-end tests. It has lots of nice features for stubs, mocks, asserting expected exceptions etc.
Tests are costly to write, granted, but they can be added to over time, and added along with new features. Even some tests would be better than none.
The text was updated successfully, but these errors were encountered: