Hacker Newsnew | past | comments | ask | show | jobs | submit | more BiteCode_dev's commentslogin

The README lacks of an example of input and output.


It does, but their documentation's Quickstart has an example:

https://pynguin.readthedocs.io/en/latest/user/quickstart.htm...


This looks like they combined the exploration strategy of property based testing with unit testing. This is not even testing, it tries to find some examples that result in different code paths. There is no concept of "expected result, given a certain input" and it does not try to find extreme cases or equivalence classes. Using it will result in a heap of buggy code that has a useless "but tested" sticker.


I think you are thinking of the use case wrong. In my work I come across a lot of untested legacy code. An autogenerated tests would be like guardrails when working with these code bases. I am not going to work with them blindly, it doesn't even do variable names yet, but its boilerplate stuff I would have written anyways. If this code gives me extensive coverage, adding test cases for specific things becomes trivial.


Agreed. I went digging and found one in the docs. https://pynguin.readthedocs.io/en/latest/user/quickstart.htm...


If you do TDD, yes.

But there are a lots of projects out there that don't, and write tests afterward.

I do.

It's usually much, much faster and easier for me to write the tests after I figure out how to make what I want to work. I sometimes need to change the API a little to be more testable, but it's still faster.

In fact, if I write a test first, I have to write it with an abstract idea on how my code will work and need to understand the problem perfectly, which I rarely do. My understanding of the problem and solution grows as I write the code. It helps me ask the right questions, it reveals issues I didn't think about, I shows part of the API I didn't know by heart and above all, it cleans my initial idea of the workflow for this part of the code.

So if I write the test first, it will take a lot of time to think it through, and I will realize later I got it wrong and have to rewrite it anyway. You could argue I need to better define my problem or get better specs, but my experience is that they are always wrong as long as you haven't written any code: "no plan survive the contact with the enemy".

Not to mention you may not have written the untested code in the first place.

So I'd love a tool that can output test boiler plate for me.


Slightly off-topic but I thought it might be interesting: you can easily modify tests to adapt to your changing architecture as well.

Personally I use TDD to have an easy entry point to run through my code, so the first instance of a test for an api might only check status code

It makes the process very iterative, as you can continuously run through your code just by saving


> you can easily modify tests to adapt to your changing architecture as well.

Can you? Surely it depends; most systems end up with more LOC in the tests than the tested code, and the tests multiply the cost of refactoring.

I've had success with the "happy path first" kind of TDD, where you write a use case and implement to that and only then come back and fill in other tests.


I might've been too unclear in my comment. I was indeed speaking specifically about the issue the parent comment had with writing detailed tests before the application logic is implemented, just to be forced to change them because the initial idea for the api had to be changed.

Changing existing apis comes with a very different set of challenges


Let's say you test an api, since yoy are taling about status code. You have to test all kind of cases with wrong inputs, various user states and so on.

You can of course write the test to simulate all that, but's way harder than just using your user UI which lets you discover it and put a breakpoint in the endpoint to inspect. I may not remember where to get the header data in this framework, or maybe the client send me a weird queryset param and I must figure out why, or I my validation is failing in some case and I must check it out. I can't simulate something I don't know about or don't understand yet.

Plus using the UI will make you realize you forgot to limit input length or what happen if the user doesn't have any phone number or if it's tuesday.

The minimal use case you will write your code against will likely be only good in theory in your mind unless you do something very basic. You will probably throw it away in the end in exhange for IRL code learned by feed back, and you'll have written all that for nothing.

This is were TDD proponents say ypu shoud write the minimal case and see all that stuff incrementally, but again, it's way easier and faster to just fiddle with the UI and write the code I need then test each case that imagine each case incrementally, and find the proper incatation to make the whole thing works.

I'm exagerating for the sake of the argument, but that's the result I get every time I work on a project where the team requires TDD. Incidently, those are the projects with the worst UI as well, because dev don't use it enough.


your whole argument is a straw-man.

i don't think that anyone would disagree that you can get caught up in writing too many tests too early, consequently loosing sight out of your objective and ending up with a bad implementation.

My point was that just writing super easy and happy-path tests at the start is a valid strategy for TDD as well, and does not cause any of your imaginary issues.


Aggressive tone and a throw away account, this is the end of the thread for me.


Rereading my comment does indeed sound very aggressive. It wasn't intentional and I'm sorry for that. I have to work on that.


This is one of the most important project for humanity. Of course they want to secure it.


> Most large companies are working on honest-to-god SPAs.

Most devs don't work at large companies, at least not tech oriented large companies. I'm almost certain most projects don't come out from such companies either, statistically.

In fact, most projects are not SPA, nor using any kind of AI, Big Data, or another buzzword.

So I don't think that's it.

I think that large companies are just the loudest, also creating/promoting popular FOSS projects, and they have great engineers that are on many social networkd, including HN, or write famous blogs.

And so people have the impression that you need an SPA into a docker mix among other microservices each horizontally scaled in the cloud, monitored using an observability framework, using a big data pipeline for processing things they will store in their NoSQL sharded DB accessible through a GraphQL Api.

Because Jack working at GAFAM for $500k has the time, env and will to sing about it, but Juan working in a Madrid bank is just spending his company time fixing the Tomcat server quietly.


> Most devs don't work at large companies.

that would be very surprising. Companies like IBM, Microsoft, ATOS, CapGemini ... employ literally hundreds of thousands of devs each


It's not as if all of them are working on a SPA or the backend of a SPA.

On the other side, the long tail of devs working in medium and small companies are probably working on both a frontend and a backend. This is especially true when there are one or two developers in all the company, when the company business is selling some service or physical product and software is a cost and not the source of income. And a medium company in the USA is a large one in many countries, a small one a medium one.

So the sum of devs in the long tail can be much larger than the sum of the devs in the top companies.


Fixed it with "at least not large tech oriented" because banks, supermarkets, the media industry, the entertainment industry, etc. employ a ton of devs, but they won't likely use Kubernatis for most of their stack.


Doing consulting gigs for boring business that are completly unrelated for the fashion of the week at Silicon Valley coffee shops.


That is so messed up. A non state institution can non only claim you committed an offense, but it doesn't even have to justify itself.


yes messed up, how could we point this the other way?

if we held a copyright to kittehpix and took measures to monitor for infringement, could we not just claim that opsec has been flagrantly and repeatedly violating our copyright and have thier ISP disconnect opsec. It all seems to be set up "sos a good old boys word is all thats nessecary" fashion


I'm 36 and after 18 years of being behind a keyboard, I'm just starting to be a decent programmer, so I hope not.


I'm ready to pay, I pay for a lot of stuff: netflix, audible, dynalist, pycharm, etc.

But with youtube you pay twice, once with your money, and the second time with your private life. And Google's track record clearly shows it's not a good idea to trust them with it.

Google is the only one responsible for my total defiance toward them. They catered to it year after year. Now they are just harvesting the result. They can't have their cake and eat it.


I would argue you also pay with your time, what percentage of total view time is wasted on long intros, sponsored plugs and telling people to do all the typical social media stuff which has nothing to do with real content.


Thankfully, there is a wonderful extension for that: https://addons.mozilla.org/fr/firefox/addon/sponsorblock/

Try it, and you will for a brief moment feel like when you installed a regular adblocker the first time 15 years ago: "WOW". With this + ublock origin + youtube enhancer, the site is a completely different experience.

It's the experience I would happily pay for, if it wouldn't mean giving away my whole life to Google's monster AI.


Putting a square into a round role does not make sense, but you may now be able to design a compatible square or round hole that one can move to.


On the other hand every single app at one point would happily import your contacts no matter how they were formatted...

The incompatibility is by design.


Contact data is relatively uniform - you got names, addresses, phone numbers, maybe a few dates. Even with the handling of different addresses per contact, different systems already show divergent behaviour, even when they use the vcard standard.

This becomes immeasurably more difficult with information from, let's say, Amazon: A competitor would not have the articles I've viewed, or the comments I have left under questions, or a compatible rating system.

Even social networking sites ... how useful is it to import twitter exports of my tweets answering to someone if neither that someone nor the content I answered to is available in the target system?

Sometimes, it is by design - in the majority of cases, it's just different people implementing different use-cases differently.


Can't really blame facebook for once. Even 0bin.net must obey take down requests. In fact, we often have to comply for requests that don't match our jurisdiction because hosting will shut you down without checking anything.

Facebook have their own infra but still, they can't ignore the law.


In germany there is minimal payment infra, but civil dressed cops will make you pay randomly a heavy fine if they catch you.


It's worth mentioning it is a criminal offense but there is a scale for repeat offenders. The first time the fine is not that much but by repeatedly evading fares you can eventually end up with community service or jail time. There is talk of decriminalizing it due to the overhead of this too and the fact that it hasn't really worked and mostly targets vulnerable people.


> civil dressed cops

They are not cops. The only reason they can demand showing the ticket is because of the terms of service.


I think the fine is same as in France (60 Euros for Schwarzfahren) or at least in Munich it's 60 Euros.


They found out that this is cheaper and more efficient than turnstiles. I saw the paper a long time ago, because I couldn't believe it.


Cops or people employed by the transportation provider? I only saw civil employees in my life so far.


Are those cops really?

Anyway, those people always act like thugs. I wish there was no need for them.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: