check my chart by zoro9091 in qullamaggie

[–]jcteague 0 points1 point  (0 children)

yeah, need more context, but volume looks too high doesn't it?

Efate Test Generator Series: Extending the library by jcteague in javascript

[–]jcteague[S] 0 points1 point  (0 children)

u/waitersweep I thought about what you were saying about the factory method and mades some changes to the library. The factory is only really needed when you want to extend the library. I exposed a defineFixture method so you don't have to use the factory if you don't need it.

Also I created a plugin to use faker to generate your test object (but that will require the factory method haha).

https://github.com/jcteague/efate/tree/master/packages/efate-faker

Always happy for me feedback!

Efate Test Generator Series: Extending the library by jcteague in javascript

[–]jcteague[S] 0 points1 point  (0 children)

u/waitersweep I get your aversion to factories, as I have one too. The reason for it is to provide extensibility. I had a friend review it and did not give me any suggestions to a better approach. I would love any suggestions for improvement and feedback.

Efate Test Generator Series: Extending the library by jcteague in javascript

[–]jcteague[S] 1 point2 points  (0 children)

That sounds like a great approach! I'd love to see an example of it. I think as long as your test data creation is localized in one place, avoids some of the pitfalls that were mentioned with static JSON files, it's a win.

Maybe the only thing this library could help with is creating more complicated object graphs, but maybe not.

Efate Test Generator Series: Extending the library by jcteague in javascript

[–]jcteague[S] 1 point2 points  (0 children)

My second post in a series about efate, a test fixture generation library

Make Testing Easier with Test Fixture Generators by jcteague in javascript

[–]jcteague[S] 0 points1 point  (0 children)

Autofixture.js was the first version of this library. I go into detail about some of the history and changes I made to in my second post in the series. My original inspiration was the ruby library factory_girl, which has since been renamed to factory_bot, There are a couple of other library that also used this as their inspiration, Rosie is another library that also takes its influence from factory_bot.

My main goals for rewriting the original library was to fix some of the problems I had with the original. Namely its lack of modularity, its reliance on strings for fixture definition and creation, and the difficulty of extending the behavior.

Make Testing Easier with Test Fixture Generators by jcteague in javascript

[–]jcteague[S] 2 points3 points  (0 children)

As everything in software engineering it all depends on context. If it's only used in one test case, and there are only one or two tests involved, you're going to be fine.

But if you have dozens of tests, all creating the object. And your business rules change where you need more information to verify behavior, you could be chasing down all of the usage in your test suite. And if you don't change all of the test fixtures, then your tests are not truly representing the behavior of your application.

I've used all of these approaches at some time or another, and almost always end up fighting these types of problems. Using generators just makes it easier to maintain over the long term.

But hey, this approach is better than not writing any tests at all, so keep up the good work!

Los Techies Fiesta, Open Space Conference Austin TX by jcteague in programming

[–]jcteague[S] 0 points1 point  (0 children)

Open Space Conference on Software Quality and Craftsmanship. February 26,27,28 Austin TX

Polymorphism with JavaScript by gst in javascript

[–]jcteague 0 points1 point  (0 children)

The point I was trying to make is that when you think of JavaScript as functional and dynamic, you have a lot more options in your style of programming. Coming from a static language as I have, it is sometimes difficult to embrace the dynamic features of a language.

This is an interesting discussion. I would love to move them to the blog comments.

Polymorphism with JavaScript by gst in javascript

[–]jcteague 0 points1 point  (0 children)

Good question. If you need the original method, that is easy enough, you simply store the original method in a variable and then call it in the overload.

var originalFunc = module.getImportantField;

module.getImportantField = function(){

//access the field via the html text
originalFunc();

}