If this is a silly question, I apologize, but I am sincerely having a hard time understanding if we absolutely need Karma to run unit tests? I am new to Angular 2, Karma and Jasmine, and I was hoping someone with more experience than me could explain if we could just use Jasmine standalone to run unit tests.
I know that Karma is a test runner, and I know all the niceties that come with Karma (test on multiple browsers and devices, automatically rerun tests when files are changed, test coverage results, easy integration with Jenkins .. the list goes on and on!). But I am just having a hard time understanding if it completely necessary. A lot of the examples I've seen (if not all of them) use Karma, but I have not seen an example where only Jasmine is used, and would like an explanation why. Is it because of how Karma loads the spec/app files?
An example I was looking at was Jasmine standalone, and I am trying to use this example to apply to my current structure, but so far no luck:
https://github.com/jasmine/jasmine/releases
Thank you in advance for all your help!
Related
Has anyone has done kdb unit testing before? I have no idea how I should do unit testing. I am confused about time store unit testing as well.
I will load my script, Qunit script and test script. However, I am not sure how to write the test code for queries. What should I write for expected result?
QUnit a unit testing framework for kdb is documented here:
http://www.timestored.com/kdb-guides/kdb-regression-unit-tests
With the source code being available here:
https://github.com/timeseries/kdb/tree/master/qunit
If you have any specific questions, just ask.
When unit testing in magento, shoul I be using mocks for config tests?
I now there is the ecomdev module etc out there so please no answers directing me to this :)
I'm simply wondering whether any unit tests against the config for my modules should config object be mocked?
Unit testing in magento is hard. And to be honest not really possible at the moment (it will hopefully be completely different with magento 2). So if you ask me: No. don't test against mock objects, too much work, nearly no effect.
Test against the real config.
I'm working in a project with a quite large suite of tests (about 800 scenarios). Our code grew quite a lot and now I'm looking for ways to test some parts of our test library. Have you ever tested (parts of) your selenium scripts? How are you doing it? I thought about using some sample pages only for these tests, but it looks like a lot of work, doesn't it?
I know I can mock WebDriver, but white box testing doesn't seem quite right for me. Perhaps I have not yet grasped all the mock concepts properly. Any concerns or tips?
Here's one school of thought..
Create the test case manually
Ensure that the test case passes when a tester manually executes it
Create an automated selenium script to replace this test case.
Have a different dev or QA test the automation works correctly.
Integrate the automated test into some kind of nightly run.
I would not recommend having automated tests (like a unit testing or acceptence testing framework) test your selenium tests. It seems like an unnecessary layer of test automation.
We are starting to build infrastructure components in JSF2.0.
What is the best approach for unit testing them?
I tried JSFUnit in the past but wasn't satisfied with it. Is there an easier way to implement it?
This may be more integration testing than unit testing, but if you want to see how your components work in an actual browser, the selenium project has some nice features, and you can do it all through unit tests. You can look it over here: http://seleniumhq.org/docs/03_webdriver.html. I've found that between regular unit tests, unit tests using jmockit or the like, and selenium, I can cover pretty much everything when testing my components.
Cheers,
Bill
I have been doing a lot a reading about unit testing.
Unit testing seems all well and good.
But it seems to miss a lot of the fundamentals of how the web works. User Interaction.
I have not seen any way a unit test could test for unexpected input, or test to make sure that an ajax call works etc.
Am I missing something here or is unit testing not really designed well for web development?
You are not missing anything.
Ideally unit testing is about testing a small piece of code, e.g. a class in isolation. For this you may want to use a unit testing tools such as JUnit or NUnit. Some people refer to this type of tests as developer tests.
In contrast to that you may want to test web applications as a whole. Some call this acceptance testing. For the latter you could use a tool such as Selenium. Tools like Selenium can test Ajax and other JavaScript as well.
You have even more options if you take a look at a tool like WebDriver as you will find that you can implement Selenium-based tests using a unit testing tool.
Take a look at Selenium.