Testing and verifying an Angular2+ build - unit-testing

I am having an Angular2+ application.
I have done some unit testing with Karma-Jasmine. But my assumption is that this is only for dev enviroment(pre production).
I am looking for a testing framework through which the "dist" folder build can be verified(components, web services, etc...)? so that once the build is taken, some script that do login, should able to verify the response object for login service etc...

Sounds like you are asking how to do end-to-end testing to your application in addition to unit tests. In that case Selenium and more modern Cypress are what you are looking for.

Related

How to Selenium test Django project that retrieves data through APIs?

I have a Django Project. I want to make end-to-end tests for it using Selenium.
It interacts with Other components (usually run through docker-compose) API and functions properly.
The Django Project and 'Other Components' are different repositories (obviously there are multiple 'other components')
Testing of parts that don't involve API calls, have been tested.
You can use a continuous integration like Jenkins to do your automated task like Selenium.
It's really easy to install localy and/or to serve.
How to install Jenkins : here
have a great day!

Testing gmail addon

I've created a gmail addon which uses oauth to make external api calls using UrlFetchApp and then uses cards with CardService to show some info.
It all works but there's no documentation on the gmail addon page about how to test the addon. My goal is to write some unit and integration test for my addon core working and have it run on ci services such as Travis. There are many classes the addon uses which are only available in the app script environment such as CardService, OAuth2, GmailApp so mocking all of their functions is quite a bit of work.
Has anybody developed gmail addon with tests which can run on ci services?
GMail add-ons are relatively new to the GSuite ecosystem so you're unlikely to find mocks for it. However, there have been attempts to build Test frameworks for Apps Script.
There is an "awesome list" of GAS resources maintained by Alexander Ivanov on Github with a section dedicated to testing. See link below:
https://github.com/oshliaer/google-apps-script-awesome-list#testing
In its current state it may be difficult to set up Apps Script for continuous integration but with the planned language upgrade to Chrome's V8 engine that may soon change.

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

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.

TestNG unit test at maven install, install ->deploy to jetty ->start jetty ->run test -> stop server

I have a maven project.
I want to test (spring) controller class and also wrote a test class.To successfully run this test class,I want the web app to be deployed in the (jetty )server.
How I can achieve this, when I execute maven clean install.project is
built->deployed to server->start server->run test->stop server
I have been looking at jetty plugin and cargo plugin but still finding it difficult to do what I want.
If you want to unit test your spring controllers, you do not need to have your web application deployed to jetty. Spring framework has testing support as documented here.
There are many examples in the web. You can also refer to the test classes here which uses testNG.
If you do want to run tests in jetty, then refer to these instructions. Essentially you would bind the jetty start and stop to pre-integration-test and post-integration-test phases.

How to unit test my Google OpenID consumer app?

My web app is a Google OpenID consumer (with Attribute Exchange and OAuth Extension) and I need to write some unit test for it [edit: to test the unit that is responsible to interact with google].
The problem is that default OpenID login procedure needs user interaction (entering user/pass) which is not possible in unit test.
Do you have any idea how can I solve this problem and unit test my OpenID consumer app?
(I prefer not to run my own OpenID provider.)
You need to use a remote controlled browser for this. Selenium was made for this use case.
(indeed they are called functional tests then).
Search on Google for the best way to integrate selenium tests into your web framework.
If I understand you want to test your all application and not just "unit test" it.
The actual test framework depends on the technology your application is using. For example there are many UI and web automation tools that can do what you want.
You should also unit test your core functionality or at least write several integration tests that work against an actual Openid provider but instead of running the entire application just test the functionality of the class (if you're using language that has classes) to make sure it can get the b.
I would also write a couple of unit tests that call a fake provider to test how your code behaves in case of error, connection problems and plain vanilla responses.