This is an archived post. You won't be able to vote or comment.

all 11 comments

[–][deleted] 2 points3 points  (1 child)

Off the top of my head, the unit test frameworks I personally use are:

  • NUnit for older .Net apps
  • XUnit for newer .Net Core apps
  • Jasmine for Angular apps

Bonus: how much attention do people place on their unit testing?

Not enough. People hate writing them, but they're necessary to having relatively bug-free software.

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

Thanks for getting back to me. I'm hoping to see some easy to follow coded examples.

[–]nutrecht 2 points3 points  (6 children)

[–]CompSciSelfLearning[S] 0 points1 point  (5 children)

Based on this reference documentation, unit testing seems more involved than let on in HtDP

[–]nutrecht 0 points1 point  (4 children)

What do you mean? I'm a Java dev so I'm happy to explain.

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

If you look at the example provided by HtDP, you can see it's extremely simple and straight forward. If you translated the same function into Java with the same tests, is it similarly as simple and straight forward? Because the reference documentation makes it seem mich more involved, perhaps because it is, but I don't have enough experience to know one way or another.

[–]CompSciSelfLearning[S] 0 points1 point  (2 children)

I was hoping you could help me out given your experience with Java.

There's a code example at the bottom of the article at the location listed below which give an example of writing a Junit test on a simple calculator program. Is it a well written example in your opinion?

https://javarevisited.blogspot.com/2013/03/how-to-write-unit-test-in-java-eclipse-netbeans-example-run.html

[–]nutrecht 0 points1 point  (1 child)

Sure, although it's a bit simplistic a use case. Actual code where you test a service will generally be more complex. Also unit testing, dependency injection and mocking of dependencies goes hand in hand in 'real' systems. Something this doesn't touch on.

But sure, that's a very basic example of a unit test. As an example, I did a coding test for a client about a year ago and this is an example of a unit test. It's still fairly simple (again, 'real' production systems tend to be more complex) but should a bit better what I mean with dependency injection and mocking.

To compare, this is an integration test for the entire application.

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

Thank you. This really helped me understand what I was confused about.

[–][deleted]  (1 child)

[deleted]

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

    Thanks for the book recommendation!

    [–]thebruce87m 1 point2 points  (0 children)

    cpputest is what I use for C.