· 7 years ago · Oct 03, 2018, 12:04 PM
1Test Name: FacebookLoginFunctionalityWithInvalidCrenditials
2Test FullName: ReportDemoPOC.Feature.TestFacebookLoginFunctionalityFeature.FacebookLoginFunctionalityWithInvalidCrenditials
3Test Source: C:Usersashish.vermaDesktopTest-Automation-ReportGenerateNewCodeReportDemoPOCReportDemoPOCFeatureLoginFeature.feature : line 3
4Test Outcome: Failed
5Test Duration: 0:00:17.026
6
7Result StackTrace:
8--TearDown
9 at OpenQA.Selenium.Remote.HttpCommandExecutor.MakeHttpRequest(HttpRequestInfo requestInfo)
10 at OpenQA.Selenium.Remote.HttpCommandExecutor.Execute(Command commandToExecute)
11 at OpenQA.Selenium.Remote.DriverServiceCommandExecutor.Execute(Command commandToExecute)
12 at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
13 at OpenQA.Selenium.Remote.RemoteWebDriver.Close()
14 at ReportDemoPOC.SeleniumDriver.Close() in C:Usersashish.vermaDesktopTest-Automation-ReportGenerateNewCodeReportDemoPOCReportDemoPOCSeleniumDriver.cs:line 35
15 at ReportDemoPOC.Start.TearDown() in C:Usersashish.vermaDesktopTest-Automation-ReportGenerateNewCodeReportDemoPOCReportDemoPOCStart.cs:line 50
16 at lambda_method(Closure , IContextManager )
17 at TechTalk.SpecFlow.Bindings.BindingInvoker.InvokeBinding(IBinding binding, IContextManager contextManager, Object[] arguments, ITestTracer testTracer, TimeSpan& duration)
18 at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.InvokeHook(IBindingInvoker invoker, IHookBinding hookBinding, HookType hookType)
19 at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.FireEvents(HookType hookType)
20 at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.FireScenarioEvents(HookType bindingEvent)
21 at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnScenarioEnd()
22 at TechTalk.SpecFlow.TestRunner.OnScenarioEnd()
23 at ReportDemoPOC.Feature.TestFacebookLoginFunctionalityFeature.ScenarioTearDown()
24--WebException
25 at System.Net.HttpWebRequest.GetResponse()
26 at OpenQA.Selenium.Remote.HttpCommandExecutor.MakeHttpRequest(HttpRequestInfo requestInfo)
27--SocketException
28 at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
29 at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
30Result Message:
31TearDown : OpenQA.Selenium.WebDriverException : A exception with a null response was thrown sending an HTTP request to the remote WebDriver server for URL http://localhost:55991/session//window. The status of the exception was ConnectFailure, and the message was: Unable to connect to the remote server
32 ----> System.Net.WebException : Unable to connect to the remote server
33 ----> System.Net.Sockets.SocketException : No connection could be made because the target machine actively refused it 127.0.0.1:55991
34
35using AventStack.ExtentReports;
36using AventStack.ExtentReports.Reporter;
37using AventStack.ExtentReports.Reporter.Configuration;
38using NUnit.Framework;
39using System;
40using System.Collections.Generic;
41using System.Linq;
42using System.Text;
43using System.Threading.Tasks;
44using TechTalk.SpecFlow;
45
46namespace ReportDemoPOC {
47
48public
49class Start {
50public
51 static ExtentReports extent;
52public
53 static ExtentHtmlReporter htmlReporter;
54public
55 static ExtentTest test;
56
57 static Start()
58 {
59 if (extent == null) {
60 BasicSetUp();
61 }
62 }
63 [BeforeScenario] public void Setup()
64 {
65 SeleniumDriver.Intitialize();
66 SeleniumDriver.Navigate();
67 test = extent.CreateTest(ScenarioContext.Current.ScenarioInfo.Title);
68 }
69
70 [AfterScenario] public void TearDown()
71 {
72 if (ScenarioContext.Current.TestError != null) {
73 var error = ScenarioContext.Current.TestError;
74 var errormessage = "<pre>" + error.Message + "</pre>";
75 //Add capture screen shot line here
76
77 extent.AddTestRunnerLogs(errormessage);
78 test.Log(Status.Error, errormessage);
79 test.Fail(errormessage);
80 }
81 SeleniumDriver.Close();
82 }
83
84 [OneTimeSetUp] public static void BasicSetUp()
85 {
86 string pth = System.Reflection.Assembly.GetCallingAssembly().CodeBase;
87 // string pth = System.IO.Directory.GetCurrentDirectory();
88 string actualPath = pth.Substring(0, pth.LastIndexOf("bin"));
89 string projectPath = new Uri(actualPath).LocalPath;
90 Console.WriteLine(" -----------Project Path--------------------------------------");
91 Console.WriteLine(projectPath);
92 // string reportPath = projectPath + "Reports\" + FeatureContext.Current.FeatureInfo.Title + ".html";
93 string reportPath = projectPath + "Reports\TestRunReport.html";
94 // Console.WriteLine("Report Path is " + reportPath);
95
96 htmlReporter = new ExtentHtmlReporter(reportPath);
97 htmlReporter.Configuration().Theme = Theme.Dark;
98
99 htmlReporter.Configuration().DocumentTitle = "SpecFlow Test Resport Document";
100
101 htmlReporter.Configuration().ReportName = "Feature Run Results";
102
103 extent = new ExtentReports();
104
105 extent.AttachReporter(htmlReporter);
106 //extent.LoadConfig(projectPath + "Extent-Config.xml");
107 }
108
109 [AfterFeature()] public static void EndReport()
110 {
111 extent.Flush();
112 // extent.Close();
113 }
114}
115}
116
117using NUnit.Framework;
118using ReportDemoPOC.Page;
119using System;
120using System.Collections.Generic;
121using System.Linq;
122using System.Text;
123using System.Threading.Tasks;
124using TechTalk.SpecFlow;
125
126namespace ReportDemoPOC.Steps
127{
128 [Binding]
129 [TestFixture] class LoginSteps : Start {
130 LoginPage loginPage;
131
132 [Given(@"I am at Facebook login page")] public void GivenIAmAtFacebookLoginPage()
133 {
134 //Navigate();
135 loginPage = new LoginPage();
136 }
137
138 [When(@"I enter ashusoni(.*)@gmail.com in the Email or Phone textbox")] public void WhenIEnterAshusoniGmail_ComInTheEmailOrPhoneTextbox(String p0)
139 {
140 loginPage.enterValueInUser("abcd" + p0 + "@gmail.com");
141 }
142
143 [When(@"I Enter (.*) in the password")] public void WhenIEnterInThePassword(String p0)
144 {
145 loginPage.enterValueInPassword(p0);
146 }
147
148 [When(@"Click on the Login button")] public void WhenClickOnTheLoginButton()
149 {
150 loginPage.clickOnLoginButton();
151 }
152
153 [Then(@"Application should display an error message")] public void ThenApplicationShouldDisplayAnErrorMessage()
154 {
155 Console.WriteLine("Verification");
156 loginPage.Shutdown();
157 }
158 }
159}