In the previous lecture, we learned how can we work with tables to handle test data from the feature file.I will paste the feature and step definitions from earlier lecture and then we will talk about the shortcomings and how Specflow.Assist.Dynamic can help us to overcome them Feature File Feature : SpecFlowFeature2 In order to show specflow capabilities for working on tables We are going to write some scenarios here Scenario : Verify specflow can read data from table and print on console Given I have dummy student data as below | StudentId | StudentName | Division | Age | | 100 | James | Engineering | 30 | ...
We may come across a scenario where we need to execute code after/before a particular event like given below We want to create some folder where we can store screenshots/ logfile before starting the test We may want to log details of the scenario in a log file after executing each step We want to know after each step if that step was successful and if not we want to take a screenshot as an evidence We want to clean up the database before/after each scenario/feature We may want to open/close browser for every scenario Hooks help us to execute logic when a certain event occurs, let's check how I will start with creating a new project called SeleniumHooks and added folders where we can keep our feature, feature definitions and hooks file We will add a feature file and implement the steps Feature : SpecFlowFeature1 In order to avoid silly mistakes As a math idiot I want to be told th...
Namespaces You would have recognized our class is wrapped in namespace block in our earlier lectures. Namespaces are used to organize classes in separate containers, you can consider them as an address of your class that helps the compiler to find the class. They are automatically added around the class and usually has the same name as the project they belong Here we can see Class1 is inside namespace NameSpaceDemo Imagine your application has multiple Class1 classes and now how do you guide the compiler on which one to pick, namespaces helps here. You can access the class using Namespace then dot the class name. NameSpaceDemo . Class1 Below one of the built-in namespace System . Console . WriteLine( "Test Namespace" ); Here System is the Namespace The console is the Class name WriteLine is the method name Properties Properties allow you to control the accessibility of class variables. Can be also called as guard ac...
Comments
Post a Comment