<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Testing Tools Archives - scmGalaxy</title>
	<atom:link href="https://www.scmgalaxy.com/tutorials/category/testing-tools/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.scmgalaxy.com/tutorials/category/testing-tools/</link>
	<description>A Platform for Software Engineers</description>
	<lastBuildDate>Sat, 27 Feb 2021 10:15:17 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1</generator>
	<item>
		<title>Tools for Java test automation by Daniel Wildt</title>
		<link>https://www.scmgalaxy.com/tutorials/tools-for-java-test-automation-by-daniel-wildt/</link>
					<comments>https://www.scmgalaxy.com/tutorials/tools-for-java-test-automation-by-daniel-wildt/#respond</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Tue, 09 Jan 2018 12:35:23 +0000</pubDate>
				<category><![CDATA[Testing Tools]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[Java test automation Tools]]></category>
		<category><![CDATA[Test automation]]></category>
		<category><![CDATA[Testing]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/?p=4738</guid>

					<description><![CDATA[<p>Tools for Java test automation by Daniel Wildt Tools for Java test automation by Daniel Wildt</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/tools-for-java-test-automation-by-daniel-wildt/">Tools for Java test automation by Daniel Wildt</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Tools for Java test automation by Daniel Wildt</p>
<p><strong><a href="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2018/01/Tools-for-Java-test-automation-by-Daniel-Wildt.pdf">Tools for Java test automation by Daniel Wildt</a></strong></p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/tools-for-java-test-automation-by-daniel-wildt/">Tools for Java test automation by Daniel Wildt</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/tools-for-java-test-automation-by-daniel-wildt/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>SQL Injection: How to check or test for vulnerabilities</title>
		<link>https://www.scmgalaxy.com/tutorials/sqj-injection/</link>
					<comments>https://www.scmgalaxy.com/tutorials/sqj-injection/#respond</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Thu, 22 Oct 2015 15:38:05 +0000</pubDate>
				<category><![CDATA[Testing Tools]]></category>
		<category><![CDATA[Blind Injection]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[SQL injection]]></category>
		<category><![CDATA[Tautology Based Injection]]></category>
		<category><![CDATA[Test]]></category>
		<category><![CDATA[vulnerabilities]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/2015/10/22/sqj-injection/</guid>

					<description><![CDATA[<p>SQJ Injection There are a number of ways of testing an application for vulnerabilities such as SQL Injection. The tests [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/sqj-injection/">SQL Injection: How to check or test for vulnerabilities</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div><img fetchpriority="high" decoding="async" class="alignnone size-full wp-image-3090 aligncenter" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2015/10/sql-injection.png" alt="sql-injection" width="600" height="400" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2015/10/sql-injection.png 600w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2015/10/sql-injection-300x200.png 300w" sizes="(max-width: 600px) 100vw, 600px" /></div>
<div><strong>SQJ Injection</strong></div>
<div>There are a number of ways of testing an application for vulnerabilities such as SQL Injection. The tests break down into three different methodologies:</div>
<div></div>
<div><strong>Blind Injection:</strong></div>
<div></div>
<div>MySQL example:</div>
<div></div>
<div>http://localhost/test.php?id=sleep(30)</div>
<div>If this SQL statement is interpreted by the database then it will take 30 seconds for the page to load.</div>
<div></div>
<div><strong>Error Messages:</strong></div>
<div></div>
<div>http://localhost/test.php?id='&#8221;</div>
<div>If error reporting is enabled and this request is vulnerable to sql injection then the following error will be produced:</div>
<div></div>
<div>You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near &#8216;&#8221;&#8216; at line 5</div>
<div></div>
<div><strong>Tautology Based Injection:</strong></div>
<div></div>
<div>http://localhost/test.php?username=&#8217; or 1=1 /*&amp;password=1</div>
<div>In this case supplying a Tautology, or a statement that is always true provides a predictable result. In this case the predictable result would be logging in the attacker with the first user in the database, which is commonly the administrator.</div>
<div></div>
<div>There are tools that automate the use of the methods above to detect SQL Injection in a web application. There are free and open source tools such as Wapiti and Skipfish that do this.</div>
<div></div>
<div><strong>More &#8211;</strong></div>
<div></div>
<div><a href="http://stackoverflow.com/questions/10281349/testing-if-a-site-is-vulnerable-to-sql-injection" target="_blank" rel="noopener">http://stackoverflow.com/questions/10281349/testing-if-a-site-is-vulnerable-to-sql-injection</a></div>
<div></div>
<div><a href="http://thecybersaviours.com/how-to-find-out-if-a-website-is-vulnerable-to-sql-injection" target="_blank" rel="noopener">http://thecybersaviours.com/how-to-find-out-if-a-website-is-vulnerable-to-sql-injection</a></div>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/sqj-injection/">SQL Injection: How to check or test for vulnerabilities</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/sqj-injection/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>JUnit 4 Test Logging Tips using SLF4J</title>
		<link>https://www.scmgalaxy.com/tutorials/junit-4-test-logging-tips-using-slf4j/</link>
					<comments>https://www.scmgalaxy.com/tutorials/junit-4-test-logging-tips-using-slf4j/#comments</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Tue, 09 Mar 2010 13:23:24 +0000</pubDate>
				<category><![CDATA[Testing Tools]]></category>
		<category><![CDATA[Guide]]></category>
		<category><![CDATA[Instruction]]></category>
		<category><![CDATA[JUnit]]></category>
		<category><![CDATA[JUnit 4]]></category>
		<category><![CDATA[JUnit 4 and SLF4J Implementation]]></category>
		<category><![CDATA[JUnit 4 Test using SLF4J]]></category>
		<category><![CDATA[JUnit tests]]></category>
		<category><![CDATA[Log]]></category>
		<category><![CDATA[Log statements]]></category>
		<category><![CDATA[Logging techniques]]></category>
		<category><![CDATA[Logging tips]]></category>
		<category><![CDATA[Simple Logging Facade for Java]]></category>
		<category><![CDATA[SLF4J]]></category>
		<category><![CDATA[Test]]></category>
		<category><![CDATA[Test logging]]></category>
		<category><![CDATA[Test logging techniques]]></category>
		<category><![CDATA[Test logging Tips]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Tutorial]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/2010/03/09/junit-4-test-logging-tips-using-slf4j/</guid>

					<description><![CDATA[<p>When writing JUnit tests developers often add log statements that can help provide information on test failures. During the initial [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/junit-4-test-logging-tips-using-slf4j/">JUnit 4 Test Logging Tips using SLF4J</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img decoding="async" class="alignnone size-full wp-image-4134 aligncenter" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2010/03/junit-4-test-logging-tips.png" alt="junit-4-test-logging-using-slf4j" width="600" height="400" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2010/03/junit-4-test-logging-tips.png 600w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2010/03/junit-4-test-logging-tips-300x200.png 300w" sizes="(max-width: 600px) 100vw, 600px" /></p>
<p>When writing JUnit tests developers often add log statements that can help provide information on test failures. During the initial attempt to find a failure a simple System.out.println() statement is usually the first resort of most developers.</p>
<p>Replacing these System.out.println() statements with log statements is the first improvement on this technique. Using SLF4J (Simple Logging Facade for Java) provides some neat improvements using parameterized messages. Combining SLF4J with JUnit 4 rule implementations can provide more efficient test class logging techniques.</p>
<p>Some examples will help to illustrate how SLF4J and JUnit 4 rule implementation offers improved test logging techniques. As mentioned the inital solution by developers is to use System.out.println() statements. The simple example code below shows this method.</p>
<p><span style="background-color: #c0c0c0;">01    import org.junit.Test;<br />
02<br />
03    public class LoggingTest {<br />
04<br />
05      @Test<br />
06      public void testA() {<br />
07        System.out.println(&#8220;testA being run&#8230;&#8221;);<br />
08      }<br />
09<br />
10      @Test<br />
11      public void testB() {<br />
12        System.out.println(&#8220;testB being run&#8230;&#8221;);<br />
13      }<br />
14    }</span></p>
<p>The obvious improvement here is to use logging statements rather than the System.out.println() statements. Using SLF4J enables us to do this simply whilst allowing the end user to plug in their desired logging framework at deployment time. Replacing the System.out.println() statements with SLF4J log statements directly results in the following code.<br />
view source</p>
<p><span style="background-color: #c0c0c0;">01    import org.junit.Test;<br />
02    import org.slf4j.Logger;<br />
03    import org.slf4j.LoggerFactory;<br />
04<br />
05    public class LoggingTest {<br />
06<br />
07      final Logger logger =<br />
08        LoggerFactory.getLogger(LoggingTest.class);<br />
09<br />
10      @Test<br />
11      public void testA() {<br />
12        logger.info(&#8220;testA being run&#8230;&#8221;);<br />
13      }<br />
14<br />
15      @Test<br />
16      public void testB() {<br />
17        logger.info(&#8220;testB being run&#8230;&#8221;);<br />
18      }<br />
19    }</span></p>
<p>Looking at the code it feels that the hard coded method name in the log statements would be better obtained using the @Rule TestName JUnit 4 class. This Rule makes the test name available inside method blocks. Replacing the hard coded string value with the TestName rule implementation results in the following updated code.</p>
<p><span style="background-color: #c0c0c0;">01    import org.junit.Rule;<br />
02    import org.junit.Test;<br />
03    import org.junit.rules.TestName;<br />
04    import org.slf4j.Logger;<br />
05    import org.slf4j.LoggerFactory;<br />
06<br />
07    public class LoggingTest {<br />
08<br />
09      @Rule public TestName name = new TestName();<br />
10<br />
11      final Logger logger =<br />
12        LoggerFactory.getLogger(LoggingTest.class);<br />
13<br />
14      @Test<br />
15      public void testA() {<br />
16        logger.info(name.getMethodName() + &#8221; being run&#8230;&#8221;);<br />
17      }<br />
18<br />
19      @Test<br />
20      public void testB() {<br />
21        logger.info(name.getMethodName() + &#8221; being run&#8230;&#8221;);<br />
22      }<br />
23    }</span></p>
<p>SLF4J offers an improved method to the log statement in the example above which provides faster logging. Use of parameterized messages enable SLF4J to evaluate whether or not to log the message at all. The message parameters will only be resolved if the message will be logged. According to the SLF4J manual this can provide an improvement of a factor of at least 30, in case of a disabled logging statement.</p>
<p>Updating the code to use SLF4J parameterized messages results in the following code.</p>
<p><span style="background-color: #c0c0c0;">01    import org.junit.Rule;<br />
02    import org.junit.Test;<br />
03    import org.junit.rules.TestName;<br />
04    import org.slf4j.Logger;<br />
05    import org.slf4j.LoggerFactory;<br />
06<br />
07    public class LoggingTest {<br />
08<br />
09      @Rule public TestName name = new TestName();<br />
10<br />
11      final Logger logger =<br />
12        LoggerFactory.getLogger(LoggingTest.class);<br />
13<br />
14      @Test<br />
15      public void testA() {<br />
16        logger.info(&#8220;{} being run&#8230;&#8221;, name.getMethodName());<br />
17      }<br />
18<br />
19      @Test<br />
20      public void testB() {<br />
21        logger.info(&#8220;{} being run&#8230;&#8221;, name.getMethodName());  }<br />
22      }<br />
23    }</span></p>
<p>Quite clearly the logging statements in this code don’t conform to the DRY principle.</p>
<p>Another JUnit 4 Rule implementation enables us to correct this issue. Using the TestWatchman we are able to create an implementation that overrides the starting(FrameworkMethod method) to provide the same functionality whilst maintaining the DRY principle. The TestWatchman Rule also enables developers to override methods invoked when the test finishes, fails or succeeds.</p>
<p>Using the TestWatchman Rule results in the following code.</p>
<p><span style="background-color: #c0c0c0;">01    import org.junit.Rule;<br />
02    import org.junit.Test;<br />
03    import org.junit.rules.MethodRule;<br />
04    import org.junit.rules.TestWatchman;<br />
05    import org.junit.runners.model.FrameworkMethod;<br />
06    import org.slf4j.Logger;<br />
07    import org.slf4j.LoggerFactory;<br />
08<br />
09    public class LoggingTest {<br />
10<br />
11      @Rule public MethodRule watchman = new TestWatchman() {<br />
12        public void starting(FrameworkMethod method) {<br />
13          logger.info(&#8220;{} being run&#8230;&#8221;, method.getName());<br />
14        }<br />
15      };<br />
16<br />
17      final Logger logger =<br />
18        LoggerFactory.getLogger(LoggingTest.class);<br />
19<br />
20      @Test<br />
21      public void testA() {<br />
22<br />
23      }<br />
24<br />
25      @Test<br />
26      public void testB() {<br />
27<br />
28      }<br />
29    }</span></p>
<p>And there you have it. A nice test code logging technique using JUnit 4 rules taking advantage of SLF4J parameterized messages.</p>
<p>I would be interested to hear from anyone using this or similar techniques based on JUnit 4 rules and SLF4J.</p>
<p>Reference: <a href="http://www.catosplace.net/" target="_blank" rel="noopener">http://www.catosplace.net/</a></p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/junit-4-test-logging-tips-using-slf4j/">JUnit 4 Test Logging Tips using SLF4J</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/junit-4-test-logging-tips-using-slf4j/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
