You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by superfreak3 <ma...@gmail.com> on 2016/01/06 03:01:28 UTC

Re: Using Log4Net with Selenium

I noticed something strange that has happened since adding logging with
log4Net.  When exceptions occur, they are caught and written as desired to
the log.  However, running via both mstest and Visual Studio 2015, despite
the fact exceptions occur, the tests are still seen as successful.

I verified it has something to do with the logging additions as I got the
previous version from TFS and I'm able to run the tests in Visual Studio
where the problematic tests do indicate failure.

I've attached a file that shows the steps I followed to get logging to work. 
I'm not sure if the addition of an app.config file causes this to be handled
differently within the testing framework or handling in Visual Studio.

Any help would be greatly appreciated!!

Selenium_and_Log4Net_Logging.docx
<http://apache-logging.6191.n7.nabble.com/file/n60848/Selenium_and_Log4Net_Logging.docx>  



--
View this message in context: http://apache-logging.6191.n7.nabble.com/Using-Log4Net-with-Selenium-tp59639p60848.html
Sent from the Log4net - Users mailing list archive at Nabble.com.

Re: Using Log4Net with Selenium

Posted by superfreak3 <ma...@gmail.com>.
Here's the file I spoke of...



On Tue, Jan 5, 2016 at 9:01 PM, superfreak3 [via Apache Logging] <
ml-node+s6191n60848h72@n7.nabble.com> wrote:

> I noticed something strange that has happened since adding logging with
> log4Net.  When exceptions occur, they are caught and written as desired to
> the log.  However, running via both mstest and Visual Studio 2015, despite
> the fact exceptions occur, the tests are still seen as successful.
>
> I verified it has something to do with the logging additions as I got the
> previous version from TFS and I'm able to run the tests in Visual Studio
> where the problematic tests do indicate failure.
>
> I've attached a file that shows the steps I followed to get logging to
> work.  I'm not sure if the addition of an app.config file causes this to be
> handled differently within the testing framework or handling in Visual
> Studio.
>
> Any help would be greatly appreciated!!
>
> Selenium_and_Log4Net_Logging.docx
> <http://apache-logging.6191.n7.nabble.com/file/n60848/Selenium_and_Log4Net_Logging.docx>
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://apache-logging.6191.n7.nabble.com/Using-Log4Net-with-Selenium-tp59639p60848.html
> To unsubscribe from Using Log4Net with Selenium, click here
> <http://apache-logging.6191.n7.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=59639&code=bWF3YTMxNkBnbWFpbC5jb218NTk2Mzl8MTE3NTIyNTkwNQ==>
> .
> NAML
> <http://apache-logging.6191.n7.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>


Selenium and Log4Net Logging.docx (204K) <http://apache-logging.6191.n7.nabble.com/attachment/60852/0/Selenium%20and%20Log4Net%20Logging.docx>




--
View this message in context: http://apache-logging.6191.n7.nabble.com/Using-Log4Net-with-Selenium-tp59639p60852.html
Sent from the Log4net - Users mailing list archive at Nabble.com.

Re: Using Log4Net with Selenium

Posted by superfreak3 <ma...@gmail.com>.
I was just about to replay that it was as easy as throw.  Thank you so much
for the replies!

On Wed, Jan 6, 2016 at 9:40 AM, Jim Scott-8 [via Apache Logging] <
ml-node+s6191n60863h37@n7.nabble.com> wrote:

> try
> {
>      //test
> }
> catch(Exception ex)
> {
>       log.Error(ex); // log your exception
>       throw; // allow exception to continue
> }
> ------------------------------
> From: [hidden email] <http:///user/SendEmail.jtp?type=node&node=60863&i=0>
> Sent: ‎1/‎6/‎2016 6:57 AM
> To: [hidden email] <http:///user/SendEmail.jtp?type=node&node=60863&i=1>
> Subject: Re: Using Log4Net with Selenium
>
> I've found that sending exceptions to the log in the catch block will
> cause the test to be seen as successful overall.  How can I also set the
> test result for Selenium in that block.
> Â
> pseudo code:Â  Set MyTestResult = Failed. ??
>
> On Tue, Jan 5, 2016 at 10:00 PM, mawa316 . <[hidden email]
> <http:///user/SendEmail.jtp?type=node&node=60858&i=0>> wrote:
>
>> Here's the file I spoke of...
>> Â
>> Â
>>
>> On Tue, Jan 5, 2016 at 9:01 PM, superfreak3 [via Apache Logging] <[hidden
>> email] <http:///user/SendEmail.jtp?type=node&node=60858&i=1>> wrote:
>>
>>> I noticed something strange that has happened since adding logging with
>>> log4Net.  When exceptions occur, they are caught and written as desired to
>>> the log.  However, running via both mstest and Visual Studio 2015, despite
>>> the fact exceptions occur, the tests are still seen as successful.
>>>
>>> I verified it has something to do with the logging additions as I got
>>> the previous version from TFS and I'm able to run the tests in Visual
>>> Studio where the problematic tests do indicate failure.
>>>
>>> I've attached a file that shows the steps I followed to get logging to
>>> work.  I'm not sure if the addition of an app.config file causes this to
>>> be handled differently within the testing framework or handling in Visual
>>> Studio.
>>>
>>> Any help would be greatly appreciated!!
>>>
>>> Selenium_and_Log4Net_Logging.docx
>>> <http://apache-logging.6191.n7.nabble.com/file/n60848/Selenium_and_Log4Net_Logging.docx>
>>>
>>> ------------------------------
>>> If you reply to this email, your message will be added to the discussion
>>> below:
>>>
>>> http://apache-logging.6191.n7.nabble.com/Using-Log4Net-with-Selenium-tp59639p60848.html
>>> To unsubscribe from Using Log4Net with Selenium, click here.
>>> NAML
>>> <http://apache-logging.6191.n7.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>>
>>
>>
>
> ------------------------------
> View this message in context: Re: Using Log4Net with Selenium
> <http://apache-logging.6191.n7.nabble.com/Using-Log4Net-with-Selenium-tp59639p60858.html>
> Sent from the Log4net - Users mailing list archive
> <http://apache-logging.6191.n7.nabble.com/Log4net-Users-f19152.html> at
> Nabble.com.
>
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://apache-logging.6191.n7.nabble.com/Using-Log4Net-with-Selenium-tp59639p60863.html
> To unsubscribe from Using Log4Net with Selenium, click here
> <http://apache-logging.6191.n7.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=59639&code=bWF3YTMxNkBnbWFpbC5jb218NTk2Mzl8MTE3NTIyNTkwNQ==>
> .
> NAML
> <http://apache-logging.6191.n7.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: http://apache-logging.6191.n7.nabble.com/Using-Log4Net-with-Selenium-tp59639p60865.html
Sent from the Log4net - Users mailing list archive at Nabble.com.

RE: Using Log4Net with Selenium

Posted by Jim Scott <js...@infoconex.com>.
try
{
     //test
}
catch(Exception ex)
{
      log.Error(ex); // log your exception
      throw; // allow exception to continue
}

-----Original Message-----
From: "superfreak3" <ma...@gmail.com>
Sent: ‎1/‎6/‎2016 6:57 AM
To: "log4net-user@logging.apache.org" <lo...@logging.apache.org>
Subject: Re: Using Log4Net with Selenium

I've found that sending exceptions to the log in the catch block will cause the test to be seen as successful overall.  How can I also set the test result for Selenium in that block.
 
pseudo code:Â  Set MyTestResult = Failed. ??


On Tue, Jan 5, 2016 at 10:00 PM, mawa316 . <[hidden email]> wrote:

Here's the file I spoke of...
 
 


On Tue, Jan 5, 2016 at 9:01 PM, superfreak3 [via Apache Logging] <[hidden email]> wrote:

I noticed something strange that has happened since adding logging with log4Net.  When exceptions occur, they are caught and written as desired to the log.  However, running via both mstest and Visual Studio 2015, despite the fact exceptions occur, the tests are still seen as successful. 

I verified it has something to do with the logging additions as I got the previous version from TFS and I'm able to run the tests in Visual Studio where the problematic tests do indicate failure. 

I've attached a file that shows the steps I followed to get logging to work.  I'm not sure if the addition of an app.config file causes this to be handled differently within the testing framework or handling in Visual Studio. 

Any help would be greatly appreciated!! 

Selenium_and_Log4Net_Logging.docx 




If you reply to this email, your message will be added to the discussion below:
http://apache-logging.6191.n7.nabble.com/Using-Log4Net-with-Selenium-tp59639p60848.html 
To unsubscribe from Using Log4Net with Selenium, click here.
NAML 







View this message in context: Re: Using Log4Net with Selenium
Sent from the Log4net - Users mailing list archive at Nabble.com.

Re: Using Log4Net with Selenium

Posted by superfreak3 <ma...@gmail.com>.
I've found that sending exceptions to the log in the catch block will cause
the test to be seen as successful overall.  How can I also set the test
result for Selenium in that block.

pseudo code:  Set MyTestResult = Failed. ??

On Tue, Jan 5, 2016 at 10:00 PM, mawa316 . <ma...@gmail.com> wrote:

> Here's the file I spoke of...
>
>
>
> On Tue, Jan 5, 2016 at 9:01 PM, superfreak3 [via Apache Logging] <
> ml-node+s6191n60848h72@n7.nabble.com> wrote:
>
>> I noticed something strange that has happened since adding logging with
>> log4Net.  When exceptions occur, they are caught and written as desired to
>> the log.  However, running via both mstest and Visual Studio 2015, despite
>> the fact exceptions occur, the tests are still seen as successful.
>>
>> I verified it has something to do with the logging additions as I got the
>> previous version from TFS and I'm able to run the tests in Visual Studio
>> where the problematic tests do indicate failure.
>>
>> I've attached a file that shows the steps I followed to get logging to
>> work.  I'm not sure if the addition of an app.config file causes this to be
>> handled differently within the testing framework or handling in Visual
>> Studio.
>>
>> Any help would be greatly appreciated!!
>>
>> Selenium_and_Log4Net_Logging.docx
>> <http://apache-logging.6191.n7.nabble.com/file/n60848/Selenium_and_Log4Net_Logging.docx>
>>
>> ------------------------------
>> If you reply to this email, your message will be added to the discussion
>> below:
>>
>> http://apache-logging.6191.n7.nabble.com/Using-Log4Net-with-Selenium-tp59639p60848.html
>> To unsubscribe from Using Log4Net with Selenium, click here
>> <http://apache-logging.6191.n7.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=59639&code=bWF3YTMxNkBnbWFpbC5jb218NTk2Mzl8MTE3NTIyNTkwNQ==>
>> .
>> NAML
>> <http://apache-logging.6191.n7.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>
>




--
View this message in context: http://apache-logging.6191.n7.nabble.com/Using-Log4Net-with-Selenium-tp59639p60858.html
Sent from the Log4net - Users mailing list archive at Nabble.com.