How to add tests like karma/jasmine to existing Ionic project? I know that there are some ionic generators that also add some test stuff...
But is there something similar for existing projects?
Thanks for any help!
Yes, there are couple of good generators. The most popular one is generator-ionic. It's a Yeoman generator and it has a build-in setup for static code analysis, running unit tests and checking code coverage. Another good alternative is generator-mcfly. It also include infrastructure for running tests and some more UI components.
Related
I am looking to develop a React JS web app, using react-boilerplate for development
https://github.com/react-boilerplate/react-boilerplate
But the above boilerplate doesn't seem to be updated quite often, which boilerplate should be used for building simple web apps
Create React App is pretty much a single command setup with all the basic React boilerplate code for you from the command line.
Although as others have said, ideally you should look into setting up your own boilerplate to suit your own needs and maintain it as you best see fit.
There is not a simple good answer to this problem. Ideally, you should create your own boilerplate and maintain it over time, because only you will know what are your most common needs. There are no perfect boilerplates and almost every boilerplate is opinionated.
You might try to create a boilerplate for yourself from React CRA or other sources that might fit your needs in a great measure. It takes time in the beginning, but after a while you might update it every few months to make sure it is up to date and make it the starting point for all your new projects.
Sometimes a good point of inspiration would be the Yeoman Generators. Take
a look here: Yeoman Generators
React-boilerplate no longer to maintain, it has some library doesn't upgrade yet. You can try this repository, same about structure and way to use.
https://github.com/react-boilerplate/react-boilerplate-cra-template
React-boilerplate is not being maintained. You can use ARc which is a React starter kit based on the Atomic Design methodology, while I'll suggest you use create-react-app which is strongly recommended by the community.
Till now I have been reading the Angular JS official docs, and some other sites which have demonstrated Unit testing in Angular JS. But all of them have just started the explanation with an example file which contains some test code. But nowhere could I find the Pre-steps to write the unit testing code. Something like, where do we write our test cases? any Specific folder location? How to run the tests etc. Can anyone please guide?
Really appreciate the help and time spent on the question.
The question where to put the unit tests is more like a matter of personal taste and which directory layout you choose. I prefer a feature-driven layout, putting all files for a feature in a directory and that includes the unit tests as well. If you do that, you have to follow certain naming conventions like:
myfeature.module.js
myfeature.controller.js
myfeature.controller.spec.js /* this is the unit test */
myfeature.html
myfeature.less
I suggest reading the angular styleguide from John Papa and if you want to get kickstarted, use one of the generators out there. In my one (cc-angular) I tried to stick to these rules and jasmine with karma and e2e tests are built in.
I'm searching some similar to PHPUnit Skeleton Generator just for Angular, maybe you could help me to find one ?
I'd recommend looking into the ng-boilerplate project. It sets you up with a sane structure, including where to put tests and running them.
You should familiarize yourself with yeoman which is a very nice scaffolding tool for JS projects.
It works around the concept of generators, different generators can generate different files for you. For example the angular-generator will help you with setting up an angular project and also add controllers, services and such.
I have some question regarding the NUnit test project and very new with NUnit.
For every wpf project there should be a test project or a single test project for a solution?
The test project will be class library project?
Thanks in advance. I am waiting for your quick response
Your first question is addressed here already: Which is better? Unit-test project per solution or per project? In a nutshell, there's no hard and fast rule, just be consistent and when possible try to mimic how you expect your libraries to be used.
For your second question, yes, it should be a library. It won't have anything other unit tests -- which are just classes with methods -- so there's no reason to make it an application or any other type of project.
I need to test an angular application and I'm thinking which testing framework to use.
Can someone please list the differences between those 2 testing framework, what is good / bad in each. when should each of them should be used? can the one replace the second?
Edit 1:
I'll try to focus my question. what I'm really interested in is the technical abilities of the 2 frameworks.
for example, some of the differences I have found:
selenium webdriver has the ability to run on grid in parallel on multiple machines, on the other side, angular scenarios runs much faster than selenium.
with selenium I can use keyboard keys such as Enter, Backspace and more and also do drag and drop actions.
selenium is not dependent on the app technology, angular is for angular apps only
Those are the type of differences I'm looking for - what can be done with one and can't be done with the other
thanks
Both should be used for testing an angular application. However, in my experience, they serve different purposes.
Angular e2e tests are your best friends when integrating new features into your application, or changing already existing features. They are there to make sure your application still behaves as expected if you are making changes to your code. These tests are much faster than selenium, do not need to be as in-depth, and, in my experience, are best executed before you push a new feature to your version control server.
Selenium tests should be used for regression testing. These tests should be far more in-depth than Angular e2e tests, and should be performed before pushing code into production.
UPDATE: This question may be less relevant now. As of January 2014, Angular plans to move from their own E2E suite to the protractor library for function tests, which use Selenium Webdriver.
If you're starting a new Angular project, you may want to look into using Protractor, as it is going to replace the current method of E2E Testing in the near future.
(Source: http://docs.angularjs.org/guide/dev_guide.e2e-testing)
I am struggling with this question as well.
Here is my thinking today:
1) Use Angular e2e testing for integration/regression testing the UI with mocks of your external dependencies (like the app server).
2) Use Selenium for integration/regression testing the complete system in a test/qa environment.
It seems Angular e2e testing helps fill in the gaps that unit testing leaves in testing view and controller logic that is tied to UI events. All of the Angular tests should mock external dependencies.
Selenium seems like the best fit for testing the entire system as the user will experience it.
This is such a subjective question, and therefore I'd first tell you to do some research. There is not much difference.
It is a very new project, whereas Selenium is a lot more mature. For instance, the JSON Wire Protocol that WebDriver is built on top of, is an actual W3C spec. This shows the project is very mature and very stable.
Due to the above, Selenium has a much much wider set of documentation, and a much wider community.
With Selenium you have a variety of different languages to use to code the tests in, as well as use the IDE. Angular limits use to pure JavaScript. For a lot of manual testers, this is a skill most do not have.
Both Selenium and Angular are open source, which (believe me) helps tremendously in debugging problems and understanding design decisions in their respective API's.