Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
Bloody
Mar 3, 2013

GameCube posted:

I've spent the past three weeks writing unit tests and every time I finish one somebody changes the functionality and doesn't update the test so I have to go fix it again. I don't think this is how unit tests are supposed to work

auto-deny merge requests that have broken tests

Adbot
ADBOT LOVES YOU

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord

Bloody posted:

auto-deny merge requests that have broken tests

then people will just delete the failing tests

GameCube
Nov 21, 2006

and then when it doesn't auto-deny it gives the false impression that everything's cool, when they actually added a bunch of untested logic. oops

Finster Dexter
Oct 20, 2014

Beyond is Finster's mad vision of Earth transformed.

GameCube posted:

I've spent the past three weeks writing unit tests and every time I finish one somebody changes the functionality and doesn't update the test so I have to go fix it again. I don't think this is how unit tests are supposed to work

Do you have a CI server? Set that bugger to send giant flame out messages when tests don't pass and sets the person committing as the owner of that issue. For bonus efficiency and "agile"ness set up some flashing lights and/or sirens as information radiators.

Unit tests work best when there can be automated public shaming.

simble
May 11, 2004

Assert(true)

Space Whale
Nov 6, 2014
.NET experts, lend me your ears.

When your Exception's internal reason is "An unexpected error occurred" and it's for an API, what the fuckety gently caress does that mean?

simble
May 11, 2004

Can you post an actual stack trace and error message?

Space Whale
Nov 6, 2014

simble posted:

Can you post an actual stack trace and error message?

quote:

Properties.Exception.Data.RequestError {"Reason":"An unexpected error occurred.","Code":null,"Errors":null}

at FOO.Api.Common.Clients.V2.ApiGetRequest`1.Read(IApiHttpRequestSettings settings)
at FOO.Web.Mvc.Areas.Rates.Controllers.WidgetController.GetRates(String id, ShippingRatesOutputFilterType filter)
at lambda_method(Closure , ControllerBase , Object[] )
at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)

fgsfds

GameCube
Nov 21, 2006

Space Whale posted:

.NET experts, lend me your ears.

When your Exception's internal reason is "An unexpected error occurred" and it's for an API, what the fuckety gently caress does that mean?

it means whoever wrote the code that threw that exception is a lazy bitch and you shouldn't use that api

simble
May 11, 2004

well i guess whoever wrote the poo poo api you're calling is wrapping useful exceptions into poo poo exceptions. gl with that. you need to ask them what the gently caress actually happens when i call your poo poo api with <your request>

simble fucked around with this message at 17:39 on May 19, 2016

simble
May 11, 2004

tell them simble from the internet said they're poo poo

Space Whale
Nov 6, 2014
an ebay widget hits it for quotes to ship a FOO to the buyer by Zip

How exactly does one go about catching exceptions no matter where it happens and just throwing it up to the controller to get logged? Or would I have to do try/catch in EVERY class in the chain from controller -> middle layers -> talk to the icky Database?

prefect
Sep 11, 2001

No one, Woodhouse.
No one.




Dead Man’s Band
i believe i have found evidence of developers committing node_modules directories to source control

am i now allowed to murder them? (for the checking-in thing, not for using node in general)

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
committing node_modules means that your build doesn't break when left-pad is unpublished from npm

prefect
Sep 11, 2001

No one, Woodhouse.
No one.




Dead Man’s Band

Plorkyeran posted:

committing node_modules means that your build doesn't break when left-pad is unpublished from npm

i'm seeing that there's something called "npm shrinkwrap" that fixes the versions you want to download. does that work?

Bloody
Mar 3, 2013

Symbolic Butt posted:

then people will just delete the failing tests

so also fail on coverage less than x%

Bloody
Mar 3, 2013

then start firing people

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

prefect posted:

i'm seeing that there's something called "npm shrinkwrap" that fixes the versions you want to download. does that work?

no. that just saves the exact version of your deps to a file so that everyone uses the exact same versions rather than the random different versions depending on when you ran npm install, but installing those specific versions still relies on them continuing to actually exist on npm's servers.

prefect
Sep 11, 2001

No one, Woodhouse.
No one.




Dead Man’s Band

Plorkyeran posted:

no. that just saves the exact version of your deps to a file so that everyone uses the exact same versions rather than the random different versions depending on when you ran npm install, but installing those specific versions still relies on them continuing to actually exist on npm's servers.

ah, but we have an internal server that caches stuff when downloaded, so we should always have a copy of whatever's been downloaded before

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
you should absolutely be using npm shrinkwrap for all js-using applications unless supporting a range of dependency versions is actually a requirement, though

prefect
Sep 11, 2001

No one, Woodhouse.
No one.




Dead Man’s Band

Plorkyeran posted:

you should absolutely be using npm shrinkwrap for all js-using applications unless supporting a range of dependency versions is actually a requirement, though

good; i will be pitching that idea at the developers as well. thanks :tipshat:

Bloody
Mar 3, 2013

why is vstest bad

Bloody
Mar 3, 2013

oh you literally only get code coverage if you have VS enterprise lmao gently caress that

Bloody
Mar 3, 2013

excellent - my test passes most of, but not all of, the time

GameCube
Nov 21, 2006

so far i like vs2015's test explorer thing, but my only other experience is running tests from the command line so what do i know

Bloody
Mar 3, 2013

i think i may have uncovered a lingering bug that i thought was fixed thanks to the power of unit testing :monocle:

Finster Dexter
Oct 20, 2014

Beyond is Finster's mad vision of Earth transformed.

simble posted:

well i guess whoever wrote the poo poo api you're calling is wrapping useful exceptions into poo poo exceptions. gl with that. you need to ask them what the gently caress actually happens when i call your poo poo api with <your request>

There are legitimate arguments for throwing generic faults from a service API. Any information (especially stack traces and the like) provides bad actors with all kinds of useful information when trying to hack a secured api. Basically, if you have to log in to use the API, you shouldn't be showing everyone your underwear when an exception occurs.

Finster Dexter
Oct 20, 2014

Beyond is Finster's mad vision of Earth transformed.
Holy balls, I refactored out 1500 lines of unmitigated sql bullshit (including passing unfiltered inputs via string concatenation) and replaced it with about 100 lines of clean, easy-to-maintain EntityFramework code that fixed a whole pile of bugs.

Everyone in the company is flipping their poo poo because I added the EF config section and a binding redirect to an updated MySql.Data.dll. Someone loving kill me now. I'm chain-firing email responses to every non-technical piece of poo poo complaining about having to update configs on 50 different client sites.

Sorry I made you do your job, dipshits, now maybe you'll spend some time looking into a deployment solution that doesn't suck poo poo, motherfucker. gently caress I'm pissed right now.

jesus WEP
Oct 17, 2004


Bloody posted:

why is vstest bad
use nunit + dotcover

HoboMan
Nov 4, 2010

so any book i read is just "write unit tests and everything else is easy".
how am i supposed to write unit tests for this Web Forms hellmess? only info i can find about it is just "lol, good luck"

Space Whale
Nov 6, 2014
Appfabric caching took a poo poo and this is all a consequence of it.

My first gut instinct was "something went down".

I just didn't have the confidence to drop the mic.

DaTroof
Nov 16, 2000

CC LIMERICK CONTEST GRAND CHAMPION
There once was a poster named Troof
Who was getting quite long in the toof

HoboMan posted:

so any book i read is just "write unit tests and everything else is easy".
how am i supposed to write unit tests for this Web Forms hellmess? only info i can find about it is just "lol, good luck"

if it's an existing web forms site that was written without unit tests in mind, you'd probably need do some major refactoring to split the code into actual testable units

you could also build integration tests instead, but idk how practical or useful or maintainable they would be in your case

JawnV6
Jul 4, 2004

So hot ...
got late confirmation on a phone interview time, wasn't able to get to a co-working space, AT&T showed me 3 bars while my interviewer called multiple times and left a voicemail

so now I look like a terrible person instead of merely a terrible programmer. fml

prefect
Sep 11, 2001

No one, Woodhouse.
No one.




Dead Man’s Band

JawnV6 posted:

got late confirmation on a phone interview time, wasn't able to get to a co-working space, AT&T showed me 3 bars while my interviewer called multiple times and left a voicemail

so now I look like a terrible person instead of merely a terrible programmer. fml

you're not terrible because of your phone's service provider :sympathy:

Finster Dexter
Oct 20, 2014

Beyond is Finster's mad vision of Earth transformed.

HoboMan posted:

so any book i read is just "write unit tests and everything else is easy".
how am i supposed to write unit tests for this Web Forms hellmess? only info i can find about it is just "lol, good luck"

Yeah, trying to unit test legacy code that wasn't built with unit testing (or really any design principles) in mind will just be a horrible waste of time. Sometimes, the only thing you can do, is implement in small bite-size chunks. For instance, you have to fix a bug with a grid view. Start by removing the backend code from the presentation layer and put it into its own data access layer (create one if it doesn't exist). Make that layer testable. The trick is that you have to have an eye to long-term health. If you'll never touch a thing ever again, then it might not be worth the refactoring.

HoboMan
Nov 4, 2010

DaTroof posted:

if it's an existing web forms site that was written without unit tests in mind, you'd probably need do some major refactoring to split the code into actual testable units

you could also build integration tests instead, but idk how practical or useful or maintainable they would be in your case

what i'm hearing here is books telling me how to be a programmer have failed me again and i should put them in the trash where they belong
reading: for chumps

Finster Dexter
Oct 20, 2014

Beyond is Finster's mad vision of Earth transformed.

JawnV6 posted:

got late confirmation on a phone interview time, wasn't able to get to a co-working space, AT&T showed me 3 bars while my interviewer called multiple times and left a voicemail

so now I look like a terrible person instead of merely a terrible programmer. fml

I know you don't need the advice, but I would just call them and explain what happened. I would also say something like, "yeah, I know it sounds lame, but if you'd be willing to reschedule another interview, I'm very interested in showing you how great of a programmer I am." or some such. They either tell you to gently caress off, or they give you a new interview because you suddenly look like someone who is willing to go after the job NO MATTER WHAT and that just has go-getter written all over them.

Finster Dexter
Oct 20, 2014

Beyond is Finster's mad vision of Earth transformed.

HoboMan posted:

what i'm hearing here is books telling me how to be a programmer have failed me again and i should put them in the trash where they belong
reading: for chumps

Books are important, but you always have to filter programming books through the bullshit that real-world programming entails. Most of them leave out the parts where you have to deal with incompetency in other departments, or legacy code-bases.

JawnV6
Jul 4, 2004

So hot ...

Finster Dexter posted:

I know you don't need the advice, but I would just call them and explain what happened. I would also say something like, "yeah, I know it sounds lame, but if you'd be willing to reschedule another interview, I'm very interested in showing you how great of a programmer I am." or some such. They either tell you to gently caress off, or they give you a new interview because you suddenly look like someone who is willing to go after the job NO MATTER WHAT and that just has go-getter written all over them.

I appreciate it. yeah, I got in touch with the hiring manager and basically said this. he said we wouldn't have time for the full thing and would need to reschedule. arranged a landline for then, shot off an email to the recruiter with the same information. he rescheduled 2 days ago, so we're effectively even, but it's still a couple points marked down in the guy's head that I could've/should've avoided. not that I think I'll be a marginal candidate either way...

he seemed mostly surprised I was able to reach him at all. "... and... how did you get this number?"

Adbot
ADBOT LOVES YOU

Bloody
Mar 3, 2013

i am confident i have unearthed the source of my bug. thanks testing. thesting.

when u design a data link that depends on backpressure to make sure it doesnt gently caress up the state of your system, make sure that backpressure actually works

especially when you're somewhere around the threshold for a non-realtime (ie desktop) host to sometimes or, worse yet, usually be slow enough that the backpressure isnt needed. cuz then at some point its gonna just blaze through your poo poo and blow up your fifo or state or whatever and rip u

  • Locked thread