পৃষ্ঠাসমূহ

Search Your Article

CS

 

Welcome to GoogleDG – your one-stop destination for free learning resources, guides, and digital tools.

At GoogleDG, we believe that knowledge should be accessible to everyone. Our mission is to provide readers with valuable ebooks, tutorials, and tech-related content that makes learning easier, faster, and more enjoyable.

What We Offer:

  • 📘 Free & Helpful Ebooks – covering education, technology, self-development, and more.

  • 💻 Step-by-Step Tutorials – practical guides on digital tools, apps, and software.

  • 🌐 Tech Updates & Tips – simplified information to keep you informed in the fast-changing digital world.

  • 🎯 Learning Support – resources designed to support students, professionals, and lifelong learners.

    Latest world News 

     

Our Vision

To create a digital knowledge hub where anyone, from beginners to advanced learners, can find trustworthy resources and grow their skills.

Why Choose Us?

✔ Simple explanations of complex topics
✔ 100% free access to resources
✔ Regularly updated content
✔ A community that values knowledge sharing

We are continuously working to expand our content library and provide readers with the most useful and relevant digital learning materials.

📩 If you’d like to connect, share feedback, or suggest topics, feel free to reach us through the Contact page.

Pageviews

Thursday, February 23, 2017

JasmineJS - Inequality Check

Till now, we have discussed different methods in Jasmine which help us test different scenarios based on our requirements. In this chapter, we will learn about different matchers that will help us check the inequality condition in JS file. Following are the matchers used for this purpose.

toBeGreaterThan()

As the name suggests this matcher helps to check greater than condition. Let us modify our customerMatcher.js using the following piece of code.
describe("Different Methods of Expect Block",function (){ 
 
   var exp = 8;  
 
   it("Example of  toBeGreaterThan()", function (){
      expect(exp).toBeGreaterThan(5);
   });

}); 
In the above piece of code, we are expecting that the value of the variable “exp” will be greater than 5. Now as the value of the variable “exp” is “8” which is greater than “5”, this piece of code will generate a green screenshot.
Greaterthan Method Now again let us modify the value of the variable to “4” and make this test fail. To do that we need to modify the js file using the following piece of code.
describe("Different Methods of Expect Block",function (){  

   var exp = 4;  
 
   it ("Example of toBeGreaterThan()", function (){
      expect(exp).toBeGreaterThan(5); 
   }); 

});
This code will fail because value 4 cannot be greater than 5. Hence it will produce the following output.
Greaterthan Error

toBeLessThan()

This matcher helps to check the less than condition of the test scenario. It behaves exactly opposite to that of toBeGreaterThan() matcher. Now let us see how this matcher works. Let us modify the customerMatcher.js file accordingly.
describe("Different Methodsof Expect Block",function (){ 
  
   var exp = 4;  
 
   it("Example of toBeLessThan()", function(){ 
      expect(exp).toBeLessThan(5);    
   });    

}); 
Like the previous example, we have one variable having value as “4”. In this piece of code, we are checking whether the value of this variable is less than 5 or not. This piece of code will generate the following output.
Lessthan Method Now to make this fail, we need to assign some bigger number to the variable exp. Let us do that and test the application. We will assign 25 as the value to the exp, which will definitely throw an error and yield the following screenshot in red.
Lessthan Error

No comments:

Post a Comment