How to install jasmine standalone and run first program

Install jasmine
1. Download jasmin standalone v2.0.0  from  'https://github.com/pivotal/jasmine/blob/master/dist/jasmine-standalone-2.0.0.zip'
2. put 'jasmine-standalone-2.0.0.zip' downloaded file your desire location
3. extract jasmine-standalone-2.0.0.zip

Run Program
4. Navigate to '/jasmine-standalone-2.0.0/src'  directory
5. Create 'HelloWorld.js' and open file with notepad++
6. Write following code and save
   function helloWorld() {
    return "Hello world!";
             }
   
7. Navigate to  '/jasmine-standalone-2.0.0/spec' directory
8. Create 'HelloWorldSpec.js' file and open file with notepad++
9. Write following code and save
describe("Hello world", function() {
    it("says hello", function() {
        expect(helloWorld()).toEqual("Hello world!");
    });
});
 
10. Navigate to /jasmine-standalone-2.0.0
11. Open 'SpecRunner.html' with NotePad++
12. Add two tag under header then save
     <script type="text/javascript" src="src/HelloWorld.js"></script>
     <script type="text/javascript" src="spec/HelloWorldSpec.js"></script>


13. Open 'SpecRunner.html' file with any browser
14. Out put will show in browser
         1 spec, 0 failures
            Hello world
            says hello

   
    

No comments:

Post a Comment