What is the bare minimum installation suite for unit testing in AngularJS? - unit-testing

I'm attempting to learn AngularJS. One of the things that attracts me is its claim of separation of concerns and unit testability. So it defeats me completely to understand why I should need to install Node.js, or any web server, to test (say) an AngularJS controller which does no DOM manipulation or call out to any web services.
Can anyone give me a definitive bare-minimum list of what is required to unit test AngularJS code?

I'm going assume that you understand the difference between end-to-end testing and unit testing in Angular, so you're only asking about what it takes to do unit testing, right?
Basically you're going to need pretty much everything that comes with the seed project. The seed project uses Karma as the test runner to execute the javascript that you've written. Step 02 of the AngularJS Tutorial (found here) walks through writing some simple tests and executing them using Karma. Everything required to do that comes with the seed-project.
Those required things are:
An angularjs app
Node.js (installed)
Karma
Some jasmine-style unit tests
If you don't want to use the seed project, you can use Step 02 of the tutorial as a spring board and just follow the Karma docs to download and install Karma and get it running.
I hope that helps.

Related

Framework for E2E tests akka-http

Asking this question because I am trying to figure out the framework which is most widely used for integration testing akka-http. How to automate those tests in Jenkins? Probably a rookie question but ideas are appreciated. Thanks
EDIT from comments:
What have you tried so far? So far I tried implementing 1. Jest 2. Using Testkit, IntegrationPatience Where are you stuck? Both the approaches doesn't look like standard to me and since I have app deployed in multiple locations, I am trying to understand if there is any framework out there which I can use to setup. The app is deployed to multiple data centers which may have different environment variables.
There are a bunch of ways to test a microservice developed using akka-http:
Unit testing
Functional / Integration testing
E2E testing
Load testing
Unit testing using route-testkit (https://doc.akka.io/docs/akka-http/current/routing-dsl/testkit.html)
Functional testing & E2E testing using Akka HTTP client API (https://doc.akka.io/docs/akka-http/current/client-side/index.html) with API contracts you can validate the status codes and response body.
Load testing can be achieved using a bunch of tools, specifically in Scala you can take a look at Gatling.

Do I need a unit-testing framework if I'm already using Cypress in a Vue.js app?

When scaffolding a new project with the Vue.js CLI, it offers a choice of both unit-testing and E2E-testing frameworks.
Unit-testing functionality is perfectly adequate in Cypress. My question, then: is there an advantage to using a distinct unit-testing framework if I'm already using Cypress?
There is a third-party adapter made by a Cypress contributor here called cypress-vue-unit-test(along with unit-test adapters for other popular frameworks).
You should check that out and see if it meets your needs over, say, Jest
From this tutorial about unit testing vuejs, some Jest advantages over Cypress are:
Built in code coverage
Snapshot testing
Module mocking utilities
Also see repo for vue-test-utils

Testing Angular and Django Rest Framework apps

Let's say I have a frontend application written in Angular and a backend application written in Django and Django Rest Framework. I created unit tests for backend application (with pytest) and I'm about to create some functional tests for the frontend application. The thing is that the frontend app needs access to the backend app in order to work correctly. I can write some mocks to handle that, but I am not sure if this is the best way to do that.
My question is, what is the best way to handle that? Should I use a single git repo for both applications or maybe a better way is to use two repositories, but then how to handle the tests for frontend application?
I was also thinking about using selenium with pytest, but then I would have to use a single repository. I am a little bit confused and would really use some good advice. Thanks!
Unit tests as the name suggests is testing separate units of the code in isolation. Meaning that it does not have to depend on any other part, else, you wouldn't know if the test is failing for that particular unit or the units it depends on.
As a result, all tests should mock the request to the backend and return valid responses (or invalid, if you're testing for error handling). The same applies to any other external service that the unit depends on.

Testing phantomJS scripts

I have a phantomjs script that navigates to some pages and store some information about them in a file. Now I want to unit test this script. My problem is that usually the frameworks test my code on client side, so I can't use the PhantomJS API.
I tried to use jasmine-node (https://github.com/mhevery/jasmine-node). It works "server-side", but I can't use all the PhantomJS API because it obviously run my tests with nodejs instead of phantom. Is there a better option to test PhantomJS apps at server-side?
I found two solutions. I think the most complete way to test phantomJS at "server side" is to use CasperJS.
Another solution I have found looking at the phantomjs source code. They use jasmine for testing and it's possible to apply the same idea to my own tests. The run-tests.js is the starting point for this approach.

Unit tests and functional tests in CodeIgniter

Is there any testing framework for CodeIgniter?
You can try the builtin Unit testing framework, take a look as well at this post
Just a simple one
Currently codeigniter doesn't have full supported unit testing. If your on the github repo however there is a branch the community is working on to add phpunit to the core. I would suggest cloning that repo and starting from there.