<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Sdhegde</id>
	<title>Expertiza_Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Sdhegde"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Sdhegde"/>
	<updated>2026-05-18T00:53:27Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=114592</id>
		<title>CSC/ECE 517 Fall 2017/M1754 Mutation Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=114592"/>
		<updated>2017-12-07T02:07:46Z</updated>

		<summary type="html">&lt;p&gt;Sdhegde: /* Subsequent steps */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Servo uses the Web Platform Test (WPT) suite for testing, but does not perform an evaluation of the breadth of the tests. The goal of this project is to use techniques from mutation testing to evaluate the performance of the WPT suite when bugs are deliberately introduced into the code base. &lt;br /&gt;
&lt;br /&gt;
The implementation of this project was done by writing python scripts that would modify the source code to generate mutants and run tests on them expecting failures. The scripts would temporarily modify the source codes, call the corresponding tests and revert back to the original code by reversing the changes that were made earlier. This process was repeated for multiple iterations by modifying various parts of the source code in random order.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use. [https://servo.org Servo] is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks. [https://en.wikipedia.org/wiki/Servo_(layout_engine)]&lt;br /&gt;
&lt;br /&gt;
===Web-platform-tests===&lt;br /&gt;
The [https://github.com/w3c/web-platform-tests web-platform-tests Project] is a W3C-coordinated attempt to build a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This, in turn, gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.&lt;br /&gt;
&lt;br /&gt;
===Mutation Testing===&lt;br /&gt;
Mutation Testing is a type of software testing where we mutate (change) certain statements in the source code and check if the test cases are able to find the errors.The goal of Mutation Testing is to assess the quality of the test cases which should be robust enough to fail mutant code. This method is also called as a Fault-based testing strategy as it involves creating faults in the program.Faults are introduced into the source code of the program by creating many versions called mutants. Each mutant should contain a single fault, and the goal is to cause the mutant version to fail which demonstrates the effectiveness of the test cases.[https://www.guru99.com/mutation-testing.html ]&lt;br /&gt;
&lt;br /&gt;
=='''Project description'''==&lt;br /&gt;
===Environment Setup===&lt;br /&gt;
* Clone the repository from [https://github.com/dsandeephegde/servo link]&lt;br /&gt;
* The steps to set up the environment for different OS are mentioned in readme file [https://github.com/servo/servo link].&lt;br /&gt;
&lt;br /&gt;
====Install packages==== &lt;br /&gt;
&lt;br /&gt;
Example, In OSX(homebrew):&lt;br /&gt;
&lt;br /&gt;
 brew install automake pkg-config python cmake yasm&lt;br /&gt;
 pip install virtualenv&lt;br /&gt;
&lt;br /&gt;
====Running test after setup====&lt;br /&gt;
&lt;br /&gt;
After the setup, make sure that everything works in your machine by building and running tests.&lt;br /&gt;
&lt;br /&gt;
build in release mode:&lt;br /&gt;
&lt;br /&gt;
 ./mach build --release&lt;br /&gt;
&lt;br /&gt;
run WPT tests:&lt;br /&gt;
&lt;br /&gt;
 ./mach test -wpt --release&lt;br /&gt;
&lt;br /&gt;
===Initial steps===&lt;br /&gt;
&lt;br /&gt;
*Implemented a simple mutator as a Python script that finds random uses of &amp;amp;&amp;amp; in Servo's code base and replaces them by ||.&lt;br /&gt;
*Built the mutated implementation of Servo with ./mach build -r and run it on the WPT test suite with ./mach test-wpt:  This produced test failures.&lt;br /&gt;
*Introduced test mapping framework to map source files to WPT test.&lt;br /&gt;
*Optimized the number of test runs by using test mapping to run only relevant tests for a mutant.&lt;br /&gt;
*Automated this process by writing scripts in a new python/servo/mutation directory, and called them from scripts in /etc/ci.&lt;br /&gt;
* Mutation test can be ran using either of the following command from the servo directory:&lt;br /&gt;
&lt;br /&gt;
 python python/servo/mutation/init.py components/script/dom&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 python etc/ci/mutation_test.py&lt;br /&gt;
&lt;br /&gt;
===Existing Mutation Strategy===&lt;br /&gt;
&lt;br /&gt;
* Replace random occurrence of &amp;amp;&amp;amp; with ||&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
Before Mutation:&lt;br /&gt;
    if a &amp;amp;&amp;amp; b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
After Mutation:&lt;br /&gt;
    if a || b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
This will produce a bug. When a is true and b is false also when a is false and b is true the value of c will be wrong. If our WPT test catches this bug then we can say mutant is killed. Otherwise mutant has lived.&lt;br /&gt;
&lt;br /&gt;
===Mutation Strategies===&lt;br /&gt;
There will be many strategies to mutate a file, like the existing one. And the strategies will be picked randomly during the execution of the program.&lt;br /&gt;
Some of the strategies are:&lt;br /&gt;
* Replace &amp;amp;&amp;amp; to ||&lt;br /&gt;
* Make 'if condition' to 'if true'&lt;br /&gt;
* Make 'if condition' to 'if false'&lt;br /&gt;
* Change String literals&lt;br /&gt;
* Change Comparision operators&lt;br /&gt;
* Duplicate statements&lt;br /&gt;
* Change arithmetic operations.&lt;br /&gt;
&lt;br /&gt;
As the build and WPT test run take a lot of time to run. Mutation Test Strategies are implemented with these key features&lt;br /&gt;
* The mutants produces only run-time bugs.&lt;br /&gt;
* The mutants do not cause any compilation failure.&lt;br /&gt;
* The mutants do not produce False Positives.&lt;br /&gt;
&lt;br /&gt;
===Mutation Strategy Examples===&lt;br /&gt;
* The example for this strategy has already been mentioned in the [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/M1754_Mutation_Testing#Existing_Mutation_Strategy Existing Mutation Strategy] section.&lt;br /&gt;
* Make 'if condition' to 'if true'&lt;br /&gt;
Example:&lt;br /&gt;
Before Mutation:&lt;br /&gt;
&lt;br /&gt;
    if a == 0 &lt;br /&gt;
    {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
After Mutation:&lt;br /&gt;
&lt;br /&gt;
    if true &lt;br /&gt;
    {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    }&lt;br /&gt;
* Make 'if condition' to 'if false' &lt;br /&gt;
Example:&lt;br /&gt;
Before Mutation:&lt;br /&gt;
&lt;br /&gt;
    if a == 0 &lt;br /&gt;
    {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After Mutation:&lt;br /&gt;
&lt;br /&gt;
    if false&lt;br /&gt;
    {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    }&lt;br /&gt;
* Change Comparision operators&lt;br /&gt;
Example:&lt;br /&gt;
Before Mutation:&lt;br /&gt;
&lt;br /&gt;
    if a &amp;gt;= 1 &lt;br /&gt;
    {&lt;br /&gt;
        c = a * 10;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After Mutation:&lt;br /&gt;
&lt;br /&gt;
    if a &amp;gt; 1&lt;br /&gt;
    {&lt;br /&gt;
        c = a * 10;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
*Change String literals&lt;br /&gt;
Example:&lt;br /&gt;
Before Mutation:&lt;br /&gt;
&lt;br /&gt;
    if a &amp;gt; 0 &lt;br /&gt;
    {&lt;br /&gt;
        c = &amp;quot;a is possitive&amp;quot;;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After Mutation:&lt;br /&gt;
&lt;br /&gt;
    if a &amp;gt; 0 &lt;br /&gt;
    {&lt;br /&gt;
        c = &amp;quot; &amp;quot;;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
* Duplicate statements&lt;br /&gt;
Before Mutation:&lt;br /&gt;
    for (i=0;i&amp;lt;5;i++)&lt;br /&gt;
    {&lt;br /&gt;
     counter++;&lt;br /&gt;
    }&lt;br /&gt;
    if (counter%2==0)&lt;br /&gt;
    {&lt;br /&gt;
     x=x+y;&lt;br /&gt;
    }&lt;br /&gt;
After Mutation:&lt;br /&gt;
&lt;br /&gt;
    for (i=0;i&amp;lt;5;i++)&lt;br /&gt;
    {&lt;br /&gt;
     counter++;&lt;br /&gt;
     counter++;&lt;br /&gt;
    }&lt;br /&gt;
    if (counter%2==0)&lt;br /&gt;
    {&lt;br /&gt;
     x=x+y;&lt;br /&gt;
    }&lt;br /&gt;
* Change arithmetic operations. &lt;br /&gt;
Before Mutation:&lt;br /&gt;
    &lt;br /&gt;
    if (counter%2==0)&lt;br /&gt;
    {&lt;br /&gt;
     x=x+y;&lt;br /&gt;
    }&lt;br /&gt;
After Mutation:&lt;br /&gt;
    &lt;br /&gt;
    if (counter%2==0)&lt;br /&gt;
    {&lt;br /&gt;
     x=x-y;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
===Other Enhancements===&lt;br /&gt;
* Randomized the test order to increase the performance of testing.&lt;br /&gt;
* Introduced logging instead of print statements.&lt;br /&gt;
* Added Retry Mechanism when mutation cannot be performed on a file by a strategy.&lt;br /&gt;
&lt;br /&gt;
===Excecution Flow===&lt;br /&gt;
&lt;br /&gt;
[[File:Mutation_testing.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Design Plan==&lt;br /&gt;
&lt;br /&gt;
===Strategy Design Pattern===&lt;br /&gt;
There are multiple strategies for mutating a file. Each strategy has the implementation of its strategy in the mutate_line method. The Mutator picks up random strategy during the execution of the program and mutates the file.&lt;br /&gt;
&lt;br /&gt;
[[File:UML_Mutation_Testing_(1).jpg]]&lt;br /&gt;
&lt;br /&gt;
===Code snippet===&lt;br /&gt;
&lt;br /&gt;
    class Mutator:&lt;br /&gt;
        def __init__(self, strategy):&lt;br /&gt;
            self._strategy = strategy&lt;br /&gt;
        def mutate(self, file_name):&lt;br /&gt;
            return self._strategy.mutate_random_line(file_name)&lt;br /&gt;
&lt;br /&gt;
    class Strategy:&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            self._replace_strategy = {}&lt;br /&gt;
    &lt;br /&gt;
        def mutate_random_line(self, file_name):&lt;br /&gt;
            line_numbers = []&lt;br /&gt;
            for line in fileinput.input(file_name):&lt;br /&gt;
                if re.search(self._replace_strategy['regex'], line):&lt;br /&gt;
                    line_numbers.append(fileinput.lineno())&lt;br /&gt;
            if len(line_numbers) == 0:&lt;br /&gt;
                return -1&lt;br /&gt;
            else:&lt;br /&gt;
                mutation_line_number = line_numbers[random.randint(0, len(line_numbers) - 1)]&lt;br /&gt;
                for line in fileinput.input(file_name, inplace=True):&lt;br /&gt;
                    if fileinput.lineno() == mutation_line_number:&lt;br /&gt;
                        line = re.sub(self._replace_strategy['regex'], self._replace_strategy['replaceString'], line)&lt;br /&gt;
                    print line.rstrip()&lt;br /&gt;
                return mutation_line_number&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    class AndOr(Strategy):&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            Strategy.__init__(self)&lt;br /&gt;
            self._replace_strategy = {&lt;br /&gt;
                'regex': r'\s&amp;amp;&amp;amp;\s',&lt;br /&gt;
                'replaceString': ' || '&lt;br /&gt;
            }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    class IfTrue(Strategy):&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            Strategy.__init__(self)&lt;br /&gt;
            self._replace_strategy = {&lt;br /&gt;
                'regex': r'(?&amp;lt;=if\s)(.*)(?=\s\{)',&lt;br /&gt;
                'replaceString': 'true'&lt;br /&gt;
            }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    class IfFalse(Strategy):&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            Strategy.__init__(self)&lt;br /&gt;
            self._replace_strategy = {&lt;br /&gt;
                'regex': r'(?&amp;lt;=if\s)(.*)(?=\s\{)',&lt;br /&gt;
                'replaceString': 'false'&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
The project is about writing a python script to change the source code and run tests. It does not add any functionality to Servo. So there is no scope for testing in this project.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://www.guru99.com/mutation-testing.html&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://github.com/servo/servo&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo/wiki/Mutation-testing-project&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sdhegde</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=114591</id>
		<title>CSC/ECE 517 Fall 2017/M1754 Mutation Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=114591"/>
		<updated>2017-12-07T02:06:26Z</updated>

		<summary type="html">&lt;p&gt;Sdhegde: /* Mutation Strategy Examples */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Servo uses the Web Platform Test (WPT) suite for testing, but does not perform an evaluation of the breadth of the tests. The goal of this project is to use techniques from mutation testing to evaluate the performance of the WPT suite when bugs are deliberately introduced into the code base. &lt;br /&gt;
&lt;br /&gt;
The implementation of this project was done by writing python scripts that would modify the source code to generate mutants and run tests on them expecting failures. The scripts would temporarily modify the source codes, call the corresponding tests and revert back to the original code by reversing the changes that were made earlier. This process was repeated for multiple iterations by modifying various parts of the source code in random order.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use. [https://servo.org Servo] is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks. [https://en.wikipedia.org/wiki/Servo_(layout_engine)]&lt;br /&gt;
&lt;br /&gt;
===Web-platform-tests===&lt;br /&gt;
The [https://github.com/w3c/web-platform-tests web-platform-tests Project] is a W3C-coordinated attempt to build a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This, in turn, gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.&lt;br /&gt;
&lt;br /&gt;
===Mutation Testing===&lt;br /&gt;
Mutation Testing is a type of software testing where we mutate (change) certain statements in the source code and check if the test cases are able to find the errors.The goal of Mutation Testing is to assess the quality of the test cases which should be robust enough to fail mutant code. This method is also called as a Fault-based testing strategy as it involves creating faults in the program.Faults are introduced into the source code of the program by creating many versions called mutants. Each mutant should contain a single fault, and the goal is to cause the mutant version to fail which demonstrates the effectiveness of the test cases.[https://www.guru99.com/mutation-testing.html ]&lt;br /&gt;
&lt;br /&gt;
=='''Project description'''==&lt;br /&gt;
===Environment Setup===&lt;br /&gt;
* Clone the repository from [https://github.com/dsandeephegde/servo link]&lt;br /&gt;
* The steps to set up the environment for different OS are mentioned in readme file [https://github.com/servo/servo link].&lt;br /&gt;
&lt;br /&gt;
====Install packages==== &lt;br /&gt;
&lt;br /&gt;
Example, In OSX(homebrew):&lt;br /&gt;
&lt;br /&gt;
 brew install automake pkg-config python cmake yasm&lt;br /&gt;
 pip install virtualenv&lt;br /&gt;
&lt;br /&gt;
====Running test after setup====&lt;br /&gt;
&lt;br /&gt;
After the setup, make sure that everything works in your machine by building and running tests.&lt;br /&gt;
&lt;br /&gt;
build in release mode:&lt;br /&gt;
&lt;br /&gt;
 ./mach build --release&lt;br /&gt;
&lt;br /&gt;
run WPT tests:&lt;br /&gt;
&lt;br /&gt;
 ./mach test -wpt --release&lt;br /&gt;
&lt;br /&gt;
===Initial steps===&lt;br /&gt;
&lt;br /&gt;
*Implemented a simple mutator as a Python script that finds random uses of &amp;amp;&amp;amp; in Servo's code base and replaces them by ||.&lt;br /&gt;
*Built the mutated implementation of Servo with ./mach build -r and run it on the WPT test suite with ./mach test-wpt:  This produced test failures.&lt;br /&gt;
*Introduced test mapping framework to map source files to WPT test.&lt;br /&gt;
*Optimized the number of test runs by using test mapping to run only relevant tests for a mutant.&lt;br /&gt;
*Automated this process by writing scripts in a new python/servo/mutation directory, and called them from scripts in /etc/ci.&lt;br /&gt;
* Mutation test can be ran using either of the following command from the servo directory:&lt;br /&gt;
&lt;br /&gt;
 python python/servo/mutation/init.py components/script/dom&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 python etc/ci/mutation_test.py&lt;br /&gt;
&lt;br /&gt;
===Subsequent steps===&lt;br /&gt;
&lt;br /&gt;
* implement mutations like replacing if statements by if true/if false, duplicating statements, reordering statements, changing arithmetic &amp;amp; atomic string constant.&lt;br /&gt;
* improving the performance of the testing, for example randomizing the test order, fast-failing, running tests with faster builds (e.g. ./mach build -d).&lt;br /&gt;
* find heuristics for identifying false positives, that is mutations which are expected to have no effect, for example removing logging.&lt;br /&gt;
* find search heuristics for identifying mutations that cause no test failures.&lt;br /&gt;
&lt;br /&gt;
===Existing Mutation Strategy===&lt;br /&gt;
&lt;br /&gt;
* Replace random occurrence of &amp;amp;&amp;amp; with ||&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
Before Mutation:&lt;br /&gt;
    if a &amp;amp;&amp;amp; b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
After Mutation:&lt;br /&gt;
    if a || b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
This will produce a bug. When a is true and b is false also when a is false and b is true the value of c will be wrong. If our WPT test catches this bug then we can say mutant is killed. Otherwise mutant has lived.&lt;br /&gt;
&lt;br /&gt;
===Mutation Strategies===&lt;br /&gt;
There will be many strategies to mutate a file, like the existing one. And the strategies will be picked randomly during the execution of the program.&lt;br /&gt;
Some of the strategies are:&lt;br /&gt;
* Replace &amp;amp;&amp;amp; to ||&lt;br /&gt;
* Make 'if condition' to 'if true'&lt;br /&gt;
* Make 'if condition' to 'if false'&lt;br /&gt;
* Change String literals&lt;br /&gt;
* Change Comparision operators&lt;br /&gt;
* Duplicate statements&lt;br /&gt;
* Change arithmetic operations.&lt;br /&gt;
&lt;br /&gt;
As the build and WPT test run take a lot of time to run. Mutation Test Strategies are implemented with these key features&lt;br /&gt;
* The mutants produces only run-time bugs.&lt;br /&gt;
* The mutants do not cause any compilation failure.&lt;br /&gt;
* The mutants do not produce False Positives.&lt;br /&gt;
&lt;br /&gt;
===Mutation Strategy Examples===&lt;br /&gt;
* The example for this strategy has already been mentioned in the [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/M1754_Mutation_Testing#Existing_Mutation_Strategy Existing Mutation Strategy] section.&lt;br /&gt;
* Make 'if condition' to 'if true'&lt;br /&gt;
Example:&lt;br /&gt;
Before Mutation:&lt;br /&gt;
&lt;br /&gt;
    if a == 0 &lt;br /&gt;
    {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
After Mutation:&lt;br /&gt;
&lt;br /&gt;
    if true &lt;br /&gt;
    {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    }&lt;br /&gt;
* Make 'if condition' to 'if false' &lt;br /&gt;
Example:&lt;br /&gt;
Before Mutation:&lt;br /&gt;
&lt;br /&gt;
    if a == 0 &lt;br /&gt;
    {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After Mutation:&lt;br /&gt;
&lt;br /&gt;
    if false&lt;br /&gt;
    {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    }&lt;br /&gt;
* Change Comparision operators&lt;br /&gt;
Example:&lt;br /&gt;
Before Mutation:&lt;br /&gt;
&lt;br /&gt;
    if a &amp;gt;= 1 &lt;br /&gt;
    {&lt;br /&gt;
        c = a * 10;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After Mutation:&lt;br /&gt;
&lt;br /&gt;
    if a &amp;gt; 1&lt;br /&gt;
    {&lt;br /&gt;
        c = a * 10;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
*Change String literals&lt;br /&gt;
Example:&lt;br /&gt;
Before Mutation:&lt;br /&gt;
&lt;br /&gt;
    if a &amp;gt; 0 &lt;br /&gt;
    {&lt;br /&gt;
        c = &amp;quot;a is possitive&amp;quot;;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After Mutation:&lt;br /&gt;
&lt;br /&gt;
    if a &amp;gt; 0 &lt;br /&gt;
    {&lt;br /&gt;
        c = &amp;quot; &amp;quot;;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
* Duplicate statements&lt;br /&gt;
Before Mutation:&lt;br /&gt;
    for (i=0;i&amp;lt;5;i++)&lt;br /&gt;
    {&lt;br /&gt;
     counter++;&lt;br /&gt;
    }&lt;br /&gt;
    if (counter%2==0)&lt;br /&gt;
    {&lt;br /&gt;
     x=x+y;&lt;br /&gt;
    }&lt;br /&gt;
After Mutation:&lt;br /&gt;
&lt;br /&gt;
    for (i=0;i&amp;lt;5;i++)&lt;br /&gt;
    {&lt;br /&gt;
     counter++;&lt;br /&gt;
     counter++;&lt;br /&gt;
    }&lt;br /&gt;
    if (counter%2==0)&lt;br /&gt;
    {&lt;br /&gt;
     x=x+y;&lt;br /&gt;
    }&lt;br /&gt;
* Change arithmetic operations. &lt;br /&gt;
Before Mutation:&lt;br /&gt;
    &lt;br /&gt;
    if (counter%2==0)&lt;br /&gt;
    {&lt;br /&gt;
     x=x+y;&lt;br /&gt;
    }&lt;br /&gt;
After Mutation:&lt;br /&gt;
    &lt;br /&gt;
    if (counter%2==0)&lt;br /&gt;
    {&lt;br /&gt;
     x=x-y;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
===Other Enhancements===&lt;br /&gt;
* Randomized the test order to increase the performance of testing.&lt;br /&gt;
* Introduced logging instead of print statements.&lt;br /&gt;
* Added Retry Mechanism when mutation cannot be performed on a file by a strategy.&lt;br /&gt;
&lt;br /&gt;
===Excecution Flow===&lt;br /&gt;
&lt;br /&gt;
[[File:Mutation_testing.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Design Plan==&lt;br /&gt;
&lt;br /&gt;
===Strategy Design Pattern===&lt;br /&gt;
There are multiple strategies for mutating a file. Each strategy has the implementation of its strategy in the mutate_line method. The Mutator picks up random strategy during the execution of the program and mutates the file.&lt;br /&gt;
&lt;br /&gt;
[[File:UML_Mutation_Testing_(1).jpg]]&lt;br /&gt;
&lt;br /&gt;
===Code snippet===&lt;br /&gt;
&lt;br /&gt;
    class Mutator:&lt;br /&gt;
        def __init__(self, strategy):&lt;br /&gt;
            self._strategy = strategy&lt;br /&gt;
        def mutate(self, file_name):&lt;br /&gt;
            return self._strategy.mutate_random_line(file_name)&lt;br /&gt;
&lt;br /&gt;
    class Strategy:&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            self._replace_strategy = {}&lt;br /&gt;
    &lt;br /&gt;
        def mutate_random_line(self, file_name):&lt;br /&gt;
            line_numbers = []&lt;br /&gt;
            for line in fileinput.input(file_name):&lt;br /&gt;
                if re.search(self._replace_strategy['regex'], line):&lt;br /&gt;
                    line_numbers.append(fileinput.lineno())&lt;br /&gt;
            if len(line_numbers) == 0:&lt;br /&gt;
                return -1&lt;br /&gt;
            else:&lt;br /&gt;
                mutation_line_number = line_numbers[random.randint(0, len(line_numbers) - 1)]&lt;br /&gt;
                for line in fileinput.input(file_name, inplace=True):&lt;br /&gt;
                    if fileinput.lineno() == mutation_line_number:&lt;br /&gt;
                        line = re.sub(self._replace_strategy['regex'], self._replace_strategy['replaceString'], line)&lt;br /&gt;
                    print line.rstrip()&lt;br /&gt;
                return mutation_line_number&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    class AndOr(Strategy):&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            Strategy.__init__(self)&lt;br /&gt;
            self._replace_strategy = {&lt;br /&gt;
                'regex': r'\s&amp;amp;&amp;amp;\s',&lt;br /&gt;
                'replaceString': ' || '&lt;br /&gt;
            }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    class IfTrue(Strategy):&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            Strategy.__init__(self)&lt;br /&gt;
            self._replace_strategy = {&lt;br /&gt;
                'regex': r'(?&amp;lt;=if\s)(.*)(?=\s\{)',&lt;br /&gt;
                'replaceString': 'true'&lt;br /&gt;
            }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    class IfFalse(Strategy):&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            Strategy.__init__(self)&lt;br /&gt;
            self._replace_strategy = {&lt;br /&gt;
                'regex': r'(?&amp;lt;=if\s)(.*)(?=\s\{)',&lt;br /&gt;
                'replaceString': 'false'&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
The project is about writing a python script to change the source code and run tests. It does not add any functionality to Servo. So there is no scope for testing in this project.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://www.guru99.com/mutation-testing.html&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://github.com/servo/servo&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo/wiki/Mutation-testing-project&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sdhegde</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=114590</id>
		<title>CSC/ECE 517 Fall 2017/M1754 Mutation Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=114590"/>
		<updated>2017-12-07T02:04:34Z</updated>

		<summary type="html">&lt;p&gt;Sdhegde: /* Mutation Strategy Examples */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Servo uses the Web Platform Test (WPT) suite for testing, but does not perform an evaluation of the breadth of the tests. The goal of this project is to use techniques from mutation testing to evaluate the performance of the WPT suite when bugs are deliberately introduced into the code base. &lt;br /&gt;
&lt;br /&gt;
The implementation of this project was done by writing python scripts that would modify the source code to generate mutants and run tests on them expecting failures. The scripts would temporarily modify the source codes, call the corresponding tests and revert back to the original code by reversing the changes that were made earlier. This process was repeated for multiple iterations by modifying various parts of the source code in random order.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use. [https://servo.org Servo] is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks. [https://en.wikipedia.org/wiki/Servo_(layout_engine)]&lt;br /&gt;
&lt;br /&gt;
===Web-platform-tests===&lt;br /&gt;
The [https://github.com/w3c/web-platform-tests web-platform-tests Project] is a W3C-coordinated attempt to build a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This, in turn, gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.&lt;br /&gt;
&lt;br /&gt;
===Mutation Testing===&lt;br /&gt;
Mutation Testing is a type of software testing where we mutate (change) certain statements in the source code and check if the test cases are able to find the errors.The goal of Mutation Testing is to assess the quality of the test cases which should be robust enough to fail mutant code. This method is also called as a Fault-based testing strategy as it involves creating faults in the program.Faults are introduced into the source code of the program by creating many versions called mutants. Each mutant should contain a single fault, and the goal is to cause the mutant version to fail which demonstrates the effectiveness of the test cases.[https://www.guru99.com/mutation-testing.html ]&lt;br /&gt;
&lt;br /&gt;
=='''Project description'''==&lt;br /&gt;
===Environment Setup===&lt;br /&gt;
* Clone the repository from [https://github.com/dsandeephegde/servo link]&lt;br /&gt;
* The steps to set up the environment for different OS are mentioned in readme file [https://github.com/servo/servo link].&lt;br /&gt;
&lt;br /&gt;
====Install packages==== &lt;br /&gt;
&lt;br /&gt;
Example, In OSX(homebrew):&lt;br /&gt;
&lt;br /&gt;
 brew install automake pkg-config python cmake yasm&lt;br /&gt;
 pip install virtualenv&lt;br /&gt;
&lt;br /&gt;
====Running test after setup====&lt;br /&gt;
&lt;br /&gt;
After the setup, make sure that everything works in your machine by building and running tests.&lt;br /&gt;
&lt;br /&gt;
build in release mode:&lt;br /&gt;
&lt;br /&gt;
 ./mach build --release&lt;br /&gt;
&lt;br /&gt;
run WPT tests:&lt;br /&gt;
&lt;br /&gt;
 ./mach test -wpt --release&lt;br /&gt;
&lt;br /&gt;
===Initial steps===&lt;br /&gt;
&lt;br /&gt;
*Implemented a simple mutator as a Python script that finds random uses of &amp;amp;&amp;amp; in Servo's code base and replaces them by ||.&lt;br /&gt;
*Built the mutated implementation of Servo with ./mach build -r and run it on the WPT test suite with ./mach test-wpt:  This produced test failures.&lt;br /&gt;
*Introduced test mapping framework to map source files to WPT test.&lt;br /&gt;
*Optimized the number of test runs by using test mapping to run only relevant tests for a mutant.&lt;br /&gt;
*Automated this process by writing scripts in a new python/servo/mutation directory, and called them from scripts in /etc/ci.&lt;br /&gt;
* Mutation test can be ran using either of the following command from the servo directory:&lt;br /&gt;
&lt;br /&gt;
 python python/servo/mutation/init.py components/script/dom&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 python etc/ci/mutation_test.py&lt;br /&gt;
&lt;br /&gt;
===Subsequent steps===&lt;br /&gt;
&lt;br /&gt;
* implement mutations like replacing if statements by if true/if false, duplicating statements, reordering statements, changing arithmetic &amp;amp; atomic string constant.&lt;br /&gt;
* improving the performance of the testing, for example randomizing the test order, fast-failing, running tests with faster builds (e.g. ./mach build -d).&lt;br /&gt;
* find heuristics for identifying false positives, that is mutations which are expected to have no effect, for example removing logging.&lt;br /&gt;
* find search heuristics for identifying mutations that cause no test failures.&lt;br /&gt;
&lt;br /&gt;
===Existing Mutation Strategy===&lt;br /&gt;
&lt;br /&gt;
* Replace random occurrence of &amp;amp;&amp;amp; with ||&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
Before Mutation:&lt;br /&gt;
    if a &amp;amp;&amp;amp; b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
After Mutation:&lt;br /&gt;
    if a || b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
This will produce a bug. When a is true and b is false also when a is false and b is true the value of c will be wrong. If our WPT test catches this bug then we can say mutant is killed. Otherwise mutant has lived.&lt;br /&gt;
&lt;br /&gt;
===Mutation Strategies===&lt;br /&gt;
There will be many strategies to mutate a file, like the existing one. And the strategies will be picked randomly during the execution of the program.&lt;br /&gt;
Some of the strategies are:&lt;br /&gt;
* Replace &amp;amp;&amp;amp; to ||&lt;br /&gt;
* Make 'if condition' to 'if true'&lt;br /&gt;
* Make 'if condition' to 'if false'&lt;br /&gt;
* Change String literals&lt;br /&gt;
* Change Comparision operators&lt;br /&gt;
* Duplicate statements&lt;br /&gt;
* Change arithmetic operations.&lt;br /&gt;
&lt;br /&gt;
As the build and WPT test run take a lot of time to run. Mutation Test Strategies are implemented with these key features&lt;br /&gt;
* The mutants produces only run-time bugs.&lt;br /&gt;
* The mutants do not cause any compilation failure.&lt;br /&gt;
* The mutants do not produce False Positives.&lt;br /&gt;
&lt;br /&gt;
===Mutation Strategy Examples===&lt;br /&gt;
* The example for this strategy has already been mentioned in the [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/M1754_Mutation_Testing#Existing_Mutation_Strategy Existing Mutation Strategy] section.&lt;br /&gt;
* Make 'if condition' to 'if true'&lt;br /&gt;
Example:&lt;br /&gt;
Before Mutation:&lt;br /&gt;
&lt;br /&gt;
    if a == 0 &lt;br /&gt;
    {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
After Mutation:&lt;br /&gt;
&lt;br /&gt;
    if true &lt;br /&gt;
    {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    }&lt;br /&gt;
* Make 'if condition' to 'if false' &lt;br /&gt;
Example:&lt;br /&gt;
Before Mutation:&lt;br /&gt;
&lt;br /&gt;
    if a == 0 &lt;br /&gt;
    {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After Mutation:&lt;br /&gt;
&lt;br /&gt;
    if false&lt;br /&gt;
    {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    }&lt;br /&gt;
* Change Comparision operators&lt;br /&gt;
Example:&lt;br /&gt;
Before Mutation:&lt;br /&gt;
&lt;br /&gt;
    if a &amp;gt;= 1 &lt;br /&gt;
    {&lt;br /&gt;
        c = a * 10;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After Mutation:&lt;br /&gt;
&lt;br /&gt;
    if a &amp;gt; 1&lt;br /&gt;
    {&lt;br /&gt;
        c = a * 10;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
* Duplicate statements&lt;br /&gt;
Before Mutation:&lt;br /&gt;
    for (i=0;i&amp;lt;5;i++)&lt;br /&gt;
    {&lt;br /&gt;
     counter++;&lt;br /&gt;
    }&lt;br /&gt;
    if (counter%2==0)&lt;br /&gt;
    {&lt;br /&gt;
     x=x+y;&lt;br /&gt;
    }&lt;br /&gt;
After Mutation:&lt;br /&gt;
&lt;br /&gt;
    for (i=0;i&amp;lt;5;i++)&lt;br /&gt;
    {&lt;br /&gt;
     counter++;&lt;br /&gt;
     counter++;&lt;br /&gt;
    }&lt;br /&gt;
    if (counter%2==0)&lt;br /&gt;
    {&lt;br /&gt;
     x=x+y;&lt;br /&gt;
    }&lt;br /&gt;
* Change arithmetic operations. &lt;br /&gt;
Before Mutation:&lt;br /&gt;
    &lt;br /&gt;
    if (counter%2==0)&lt;br /&gt;
    {&lt;br /&gt;
     x=x+y;&lt;br /&gt;
    }&lt;br /&gt;
After Mutation:&lt;br /&gt;
    &lt;br /&gt;
    if (counter%2==0)&lt;br /&gt;
    {&lt;br /&gt;
     x=x-y;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
===Other Enhancements===&lt;br /&gt;
* Randomized the test order to increase the performance of testing.&lt;br /&gt;
* Introduced logging instead of print statements.&lt;br /&gt;
* Added Retry Mechanism when mutation cannot be performed on a file by a strategy.&lt;br /&gt;
&lt;br /&gt;
===Excecution Flow===&lt;br /&gt;
&lt;br /&gt;
[[File:Mutation_testing.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Design Plan==&lt;br /&gt;
&lt;br /&gt;
===Strategy Design Pattern===&lt;br /&gt;
There are multiple strategies for mutating a file. Each strategy has the implementation of its strategy in the mutate_line method. The Mutator picks up random strategy during the execution of the program and mutates the file.&lt;br /&gt;
&lt;br /&gt;
[[File:UML_Mutation_Testing_(1).jpg]]&lt;br /&gt;
&lt;br /&gt;
===Code snippet===&lt;br /&gt;
&lt;br /&gt;
    class Mutator:&lt;br /&gt;
        def __init__(self, strategy):&lt;br /&gt;
            self._strategy = strategy&lt;br /&gt;
        def mutate(self, file_name):&lt;br /&gt;
            return self._strategy.mutate_random_line(file_name)&lt;br /&gt;
&lt;br /&gt;
    class Strategy:&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            self._replace_strategy = {}&lt;br /&gt;
    &lt;br /&gt;
        def mutate_random_line(self, file_name):&lt;br /&gt;
            line_numbers = []&lt;br /&gt;
            for line in fileinput.input(file_name):&lt;br /&gt;
                if re.search(self._replace_strategy['regex'], line):&lt;br /&gt;
                    line_numbers.append(fileinput.lineno())&lt;br /&gt;
            if len(line_numbers) == 0:&lt;br /&gt;
                return -1&lt;br /&gt;
            else:&lt;br /&gt;
                mutation_line_number = line_numbers[random.randint(0, len(line_numbers) - 1)]&lt;br /&gt;
                for line in fileinput.input(file_name, inplace=True):&lt;br /&gt;
                    if fileinput.lineno() == mutation_line_number:&lt;br /&gt;
                        line = re.sub(self._replace_strategy['regex'], self._replace_strategy['replaceString'], line)&lt;br /&gt;
                    print line.rstrip()&lt;br /&gt;
                return mutation_line_number&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    class AndOr(Strategy):&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            Strategy.__init__(self)&lt;br /&gt;
            self._replace_strategy = {&lt;br /&gt;
                'regex': r'\s&amp;amp;&amp;amp;\s',&lt;br /&gt;
                'replaceString': ' || '&lt;br /&gt;
            }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    class IfTrue(Strategy):&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            Strategy.__init__(self)&lt;br /&gt;
            self._replace_strategy = {&lt;br /&gt;
                'regex': r'(?&amp;lt;=if\s)(.*)(?=\s\{)',&lt;br /&gt;
                'replaceString': 'true'&lt;br /&gt;
            }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    class IfFalse(Strategy):&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            Strategy.__init__(self)&lt;br /&gt;
            self._replace_strategy = {&lt;br /&gt;
                'regex': r'(?&amp;lt;=if\s)(.*)(?=\s\{)',&lt;br /&gt;
                'replaceString': 'false'&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
The project is about writing a python script to change the source code and run tests. It does not add any functionality to Servo. So there is no scope for testing in this project.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://www.guru99.com/mutation-testing.html&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://github.com/servo/servo&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo/wiki/Mutation-testing-project&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sdhegde</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=114589</id>
		<title>CSC/ECE 517 Fall 2017/M1754 Mutation Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=114589"/>
		<updated>2017-12-07T02:02:43Z</updated>

		<summary type="html">&lt;p&gt;Sdhegde: /* Mutation Strategies */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Servo uses the Web Platform Test (WPT) suite for testing, but does not perform an evaluation of the breadth of the tests. The goal of this project is to use techniques from mutation testing to evaluate the performance of the WPT suite when bugs are deliberately introduced into the code base. &lt;br /&gt;
&lt;br /&gt;
The implementation of this project was done by writing python scripts that would modify the source code to generate mutants and run tests on them expecting failures. The scripts would temporarily modify the source codes, call the corresponding tests and revert back to the original code by reversing the changes that were made earlier. This process was repeated for multiple iterations by modifying various parts of the source code in random order.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use. [https://servo.org Servo] is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks. [https://en.wikipedia.org/wiki/Servo_(layout_engine)]&lt;br /&gt;
&lt;br /&gt;
===Web-platform-tests===&lt;br /&gt;
The [https://github.com/w3c/web-platform-tests web-platform-tests Project] is a W3C-coordinated attempt to build a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This, in turn, gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.&lt;br /&gt;
&lt;br /&gt;
===Mutation Testing===&lt;br /&gt;
Mutation Testing is a type of software testing where we mutate (change) certain statements in the source code and check if the test cases are able to find the errors.The goal of Mutation Testing is to assess the quality of the test cases which should be robust enough to fail mutant code. This method is also called as a Fault-based testing strategy as it involves creating faults in the program.Faults are introduced into the source code of the program by creating many versions called mutants. Each mutant should contain a single fault, and the goal is to cause the mutant version to fail which demonstrates the effectiveness of the test cases.[https://www.guru99.com/mutation-testing.html ]&lt;br /&gt;
&lt;br /&gt;
=='''Project description'''==&lt;br /&gt;
===Environment Setup===&lt;br /&gt;
* Clone the repository from [https://github.com/dsandeephegde/servo link]&lt;br /&gt;
* The steps to set up the environment for different OS are mentioned in readme file [https://github.com/servo/servo link].&lt;br /&gt;
&lt;br /&gt;
====Install packages==== &lt;br /&gt;
&lt;br /&gt;
Example, In OSX(homebrew):&lt;br /&gt;
&lt;br /&gt;
 brew install automake pkg-config python cmake yasm&lt;br /&gt;
 pip install virtualenv&lt;br /&gt;
&lt;br /&gt;
====Running test after setup====&lt;br /&gt;
&lt;br /&gt;
After the setup, make sure that everything works in your machine by building and running tests.&lt;br /&gt;
&lt;br /&gt;
build in release mode:&lt;br /&gt;
&lt;br /&gt;
 ./mach build --release&lt;br /&gt;
&lt;br /&gt;
run WPT tests:&lt;br /&gt;
&lt;br /&gt;
 ./mach test -wpt --release&lt;br /&gt;
&lt;br /&gt;
===Initial steps===&lt;br /&gt;
&lt;br /&gt;
*Implemented a simple mutator as a Python script that finds random uses of &amp;amp;&amp;amp; in Servo's code base and replaces them by ||.&lt;br /&gt;
*Built the mutated implementation of Servo with ./mach build -r and run it on the WPT test suite with ./mach test-wpt:  This produced test failures.&lt;br /&gt;
*Introduced test mapping framework to map source files to WPT test.&lt;br /&gt;
*Optimized the number of test runs by using test mapping to run only relevant tests for a mutant.&lt;br /&gt;
*Automated this process by writing scripts in a new python/servo/mutation directory, and called them from scripts in /etc/ci.&lt;br /&gt;
* Mutation test can be ran using either of the following command from the servo directory:&lt;br /&gt;
&lt;br /&gt;
 python python/servo/mutation/init.py components/script/dom&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 python etc/ci/mutation_test.py&lt;br /&gt;
&lt;br /&gt;
===Subsequent steps===&lt;br /&gt;
&lt;br /&gt;
* implement mutations like replacing if statements by if true/if false, duplicating statements, reordering statements, changing arithmetic &amp;amp; atomic string constant.&lt;br /&gt;
* improving the performance of the testing, for example randomizing the test order, fast-failing, running tests with faster builds (e.g. ./mach build -d).&lt;br /&gt;
* find heuristics for identifying false positives, that is mutations which are expected to have no effect, for example removing logging.&lt;br /&gt;
* find search heuristics for identifying mutations that cause no test failures.&lt;br /&gt;
&lt;br /&gt;
===Existing Mutation Strategy===&lt;br /&gt;
&lt;br /&gt;
* Replace random occurrence of &amp;amp;&amp;amp; with ||&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
Before Mutation:&lt;br /&gt;
    if a &amp;amp;&amp;amp; b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
After Mutation:&lt;br /&gt;
    if a || b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
This will produce a bug. When a is true and b is false also when a is false and b is true the value of c will be wrong. If our WPT test catches this bug then we can say mutant is killed. Otherwise mutant has lived.&lt;br /&gt;
&lt;br /&gt;
===Mutation Strategies===&lt;br /&gt;
There will be many strategies to mutate a file, like the existing one. And the strategies will be picked randomly during the execution of the program.&lt;br /&gt;
Some of the strategies are:&lt;br /&gt;
* Replace &amp;amp;&amp;amp; to ||&lt;br /&gt;
* Make 'if condition' to 'if true'&lt;br /&gt;
* Make 'if condition' to 'if false'&lt;br /&gt;
* Change String literals&lt;br /&gt;
* Change Comparision operators&lt;br /&gt;
* Duplicate statements&lt;br /&gt;
* Change arithmetic operations.&lt;br /&gt;
&lt;br /&gt;
As the build and WPT test run take a lot of time to run. Mutation Test Strategies are implemented with these key features&lt;br /&gt;
* The mutants produces only run-time bugs.&lt;br /&gt;
* The mutants do not cause any compilation failure.&lt;br /&gt;
* The mutants do not produce False Positives.&lt;br /&gt;
&lt;br /&gt;
===Mutation Strategy Examples===&lt;br /&gt;
* The example for this strategy has already been mentioned in the [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/M1754_Mutation_Testing#Existing_Mutation_Strategy Existing Mutation Strategy] section.&lt;br /&gt;
* Make 'if condition' to 'if true'&lt;br /&gt;
Example:&lt;br /&gt;
Before Mutation:&lt;br /&gt;
&lt;br /&gt;
    if a == 0 &lt;br /&gt;
    {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
After Mutation:&lt;br /&gt;
&lt;br /&gt;
    if true &lt;br /&gt;
    {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    }&lt;br /&gt;
* Make 'if condition' to 'if false' &lt;br /&gt;
Example:&lt;br /&gt;
Before Mutation:&lt;br /&gt;
&lt;br /&gt;
    if a == 0 &lt;br /&gt;
    {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After Mutation:&lt;br /&gt;
&lt;br /&gt;
    if false&lt;br /&gt;
    {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
* Duplicate statements&lt;br /&gt;
Before Mutation:&lt;br /&gt;
    for (i=0;i&amp;lt;5;i++)&lt;br /&gt;
    {&lt;br /&gt;
     counter++;&lt;br /&gt;
    }&lt;br /&gt;
    if (counter%2==0)&lt;br /&gt;
    {&lt;br /&gt;
     x=x+y;&lt;br /&gt;
    }&lt;br /&gt;
After Mutation:&lt;br /&gt;
&lt;br /&gt;
    for (i=0;i&amp;lt;5;i++)&lt;br /&gt;
    {&lt;br /&gt;
     counter++;&lt;br /&gt;
     counter++;&lt;br /&gt;
    }&lt;br /&gt;
    if (counter%2==0)&lt;br /&gt;
    {&lt;br /&gt;
     x=x+y;&lt;br /&gt;
    }&lt;br /&gt;
* Change arithmetic operations. &lt;br /&gt;
Before Mutation:&lt;br /&gt;
    &lt;br /&gt;
    if (counter%2==0)&lt;br /&gt;
    {&lt;br /&gt;
     x=x+y;&lt;br /&gt;
    }&lt;br /&gt;
After Mutation:&lt;br /&gt;
    &lt;br /&gt;
    if (counter%2==0)&lt;br /&gt;
    {&lt;br /&gt;
     x=x-y;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
===Other Enhancements===&lt;br /&gt;
* Randomized the test order to increase the performance of testing.&lt;br /&gt;
* Introduced logging instead of print statements.&lt;br /&gt;
* Added Retry Mechanism when mutation cannot be performed on a file by a strategy.&lt;br /&gt;
&lt;br /&gt;
===Excecution Flow===&lt;br /&gt;
&lt;br /&gt;
[[File:Mutation_testing.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Design Plan==&lt;br /&gt;
&lt;br /&gt;
===Strategy Design Pattern===&lt;br /&gt;
There are multiple strategies for mutating a file. Each strategy has the implementation of its strategy in the mutate_line method. The Mutator picks up random strategy during the execution of the program and mutates the file.&lt;br /&gt;
&lt;br /&gt;
[[File:UML_Mutation_Testing_(1).jpg]]&lt;br /&gt;
&lt;br /&gt;
===Code snippet===&lt;br /&gt;
&lt;br /&gt;
    class Mutator:&lt;br /&gt;
        def __init__(self, strategy):&lt;br /&gt;
            self._strategy = strategy&lt;br /&gt;
        def mutate(self, file_name):&lt;br /&gt;
            return self._strategy.mutate_random_line(file_name)&lt;br /&gt;
&lt;br /&gt;
    class Strategy:&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            self._replace_strategy = {}&lt;br /&gt;
    &lt;br /&gt;
        def mutate_random_line(self, file_name):&lt;br /&gt;
            line_numbers = []&lt;br /&gt;
            for line in fileinput.input(file_name):&lt;br /&gt;
                if re.search(self._replace_strategy['regex'], line):&lt;br /&gt;
                    line_numbers.append(fileinput.lineno())&lt;br /&gt;
            if len(line_numbers) == 0:&lt;br /&gt;
                return -1&lt;br /&gt;
            else:&lt;br /&gt;
                mutation_line_number = line_numbers[random.randint(0, len(line_numbers) - 1)]&lt;br /&gt;
                for line in fileinput.input(file_name, inplace=True):&lt;br /&gt;
                    if fileinput.lineno() == mutation_line_number:&lt;br /&gt;
                        line = re.sub(self._replace_strategy['regex'], self._replace_strategy['replaceString'], line)&lt;br /&gt;
                    print line.rstrip()&lt;br /&gt;
                return mutation_line_number&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    class AndOr(Strategy):&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            Strategy.__init__(self)&lt;br /&gt;
            self._replace_strategy = {&lt;br /&gt;
                'regex': r'\s&amp;amp;&amp;amp;\s',&lt;br /&gt;
                'replaceString': ' || '&lt;br /&gt;
            }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    class IfTrue(Strategy):&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            Strategy.__init__(self)&lt;br /&gt;
            self._replace_strategy = {&lt;br /&gt;
                'regex': r'(?&amp;lt;=if\s)(.*)(?=\s\{)',&lt;br /&gt;
                'replaceString': 'true'&lt;br /&gt;
            }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    class IfFalse(Strategy):&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            Strategy.__init__(self)&lt;br /&gt;
            self._replace_strategy = {&lt;br /&gt;
                'regex': r'(?&amp;lt;=if\s)(.*)(?=\s\{)',&lt;br /&gt;
                'replaceString': 'false'&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
The project is about writing a python script to change the source code and run tests. It does not add any functionality to Servo. So there is no scope for testing in this project.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://www.guru99.com/mutation-testing.html&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://github.com/servo/servo&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo/wiki/Mutation-testing-project&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sdhegde</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=114588</id>
		<title>CSC/ECE 517 Fall 2017/M1754 Mutation Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=114588"/>
		<updated>2017-12-07T02:02:28Z</updated>

		<summary type="html">&lt;p&gt;Sdhegde: /* Mutation Strategies */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Servo uses the Web Platform Test (WPT) suite for testing, but does not perform an evaluation of the breadth of the tests. The goal of this project is to use techniques from mutation testing to evaluate the performance of the WPT suite when bugs are deliberately introduced into the code base. &lt;br /&gt;
&lt;br /&gt;
The implementation of this project was done by writing python scripts that would modify the source code to generate mutants and run tests on them expecting failures. The scripts would temporarily modify the source codes, call the corresponding tests and revert back to the original code by reversing the changes that were made earlier. This process was repeated for multiple iterations by modifying various parts of the source code in random order.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use. [https://servo.org Servo] is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks. [https://en.wikipedia.org/wiki/Servo_(layout_engine)]&lt;br /&gt;
&lt;br /&gt;
===Web-platform-tests===&lt;br /&gt;
The [https://github.com/w3c/web-platform-tests web-platform-tests Project] is a W3C-coordinated attempt to build a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This, in turn, gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.&lt;br /&gt;
&lt;br /&gt;
===Mutation Testing===&lt;br /&gt;
Mutation Testing is a type of software testing where we mutate (change) certain statements in the source code and check if the test cases are able to find the errors.The goal of Mutation Testing is to assess the quality of the test cases which should be robust enough to fail mutant code. This method is also called as a Fault-based testing strategy as it involves creating faults in the program.Faults are introduced into the source code of the program by creating many versions called mutants. Each mutant should contain a single fault, and the goal is to cause the mutant version to fail which demonstrates the effectiveness of the test cases.[https://www.guru99.com/mutation-testing.html ]&lt;br /&gt;
&lt;br /&gt;
=='''Project description'''==&lt;br /&gt;
===Environment Setup===&lt;br /&gt;
* Clone the repository from [https://github.com/dsandeephegde/servo link]&lt;br /&gt;
* The steps to set up the environment for different OS are mentioned in readme file [https://github.com/servo/servo link].&lt;br /&gt;
&lt;br /&gt;
====Install packages==== &lt;br /&gt;
&lt;br /&gt;
Example, In OSX(homebrew):&lt;br /&gt;
&lt;br /&gt;
 brew install automake pkg-config python cmake yasm&lt;br /&gt;
 pip install virtualenv&lt;br /&gt;
&lt;br /&gt;
====Running test after setup====&lt;br /&gt;
&lt;br /&gt;
After the setup, make sure that everything works in your machine by building and running tests.&lt;br /&gt;
&lt;br /&gt;
build in release mode:&lt;br /&gt;
&lt;br /&gt;
 ./mach build --release&lt;br /&gt;
&lt;br /&gt;
run WPT tests:&lt;br /&gt;
&lt;br /&gt;
 ./mach test -wpt --release&lt;br /&gt;
&lt;br /&gt;
===Initial steps===&lt;br /&gt;
&lt;br /&gt;
*Implemented a simple mutator as a Python script that finds random uses of &amp;amp;&amp;amp; in Servo's code base and replaces them by ||.&lt;br /&gt;
*Built the mutated implementation of Servo with ./mach build -r and run it on the WPT test suite with ./mach test-wpt:  This produced test failures.&lt;br /&gt;
*Introduced test mapping framework to map source files to WPT test.&lt;br /&gt;
*Optimized the number of test runs by using test mapping to run only relevant tests for a mutant.&lt;br /&gt;
*Automated this process by writing scripts in a new python/servo/mutation directory, and called them from scripts in /etc/ci.&lt;br /&gt;
* Mutation test can be ran using either of the following command from the servo directory:&lt;br /&gt;
&lt;br /&gt;
 python python/servo/mutation/init.py components/script/dom&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 python etc/ci/mutation_test.py&lt;br /&gt;
&lt;br /&gt;
===Subsequent steps===&lt;br /&gt;
&lt;br /&gt;
* implement mutations like replacing if statements by if true/if false, duplicating statements, reordering statements, changing arithmetic &amp;amp; atomic string constant.&lt;br /&gt;
* improving the performance of the testing, for example randomizing the test order, fast-failing, running tests with faster builds (e.g. ./mach build -d).&lt;br /&gt;
* find heuristics for identifying false positives, that is mutations which are expected to have no effect, for example removing logging.&lt;br /&gt;
* find search heuristics for identifying mutations that cause no test failures.&lt;br /&gt;
&lt;br /&gt;
===Existing Mutation Strategy===&lt;br /&gt;
&lt;br /&gt;
* Replace random occurrence of &amp;amp;&amp;amp; with ||&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
Before Mutation:&lt;br /&gt;
    if a &amp;amp;&amp;amp; b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
After Mutation:&lt;br /&gt;
    if a || b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
This will produce a bug. When a is true and b is false also when a is false and b is true the value of c will be wrong. If our WPT test catches this bug then we can say mutant is killed. Otherwise mutant has lived.&lt;br /&gt;
&lt;br /&gt;
===Mutation Strategies===&lt;br /&gt;
There will be many strategies to mutate a file, like the existing one. And the strategies will be picked randomly during the execution of the program.&lt;br /&gt;
Some of the strategies are:&lt;br /&gt;
* Replace &amp;amp;&amp;amp; to ||&lt;br /&gt;
* Make 'if condition' to 'if true'&lt;br /&gt;
* Make 'if condition' to 'if false'&lt;br /&gt;
* Change String literals&lt;br /&gt;
* Change Comparision operators&lt;br /&gt;
* Duplicate statements&lt;br /&gt;
* Change arithmetic operations.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As the build and WPT test run take a lot of time to run. Mutation Test Strategies are implemented with these key features&lt;br /&gt;
* The mutants produces only run-time bugs.&lt;br /&gt;
* The mutants do not cause any compilation failure.&lt;br /&gt;
* The mutants do not produce False Positives.&lt;br /&gt;
&lt;br /&gt;
===Mutation Strategy Examples===&lt;br /&gt;
* The example for this strategy has already been mentioned in the [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/M1754_Mutation_Testing#Existing_Mutation_Strategy Existing Mutation Strategy] section.&lt;br /&gt;
* Make 'if condition' to 'if true'&lt;br /&gt;
Example:&lt;br /&gt;
Before Mutation:&lt;br /&gt;
&lt;br /&gt;
    if a == 0 &lt;br /&gt;
    {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
After Mutation:&lt;br /&gt;
&lt;br /&gt;
    if true &lt;br /&gt;
    {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    }&lt;br /&gt;
* Make 'if condition' to 'if false' &lt;br /&gt;
Example:&lt;br /&gt;
Before Mutation:&lt;br /&gt;
&lt;br /&gt;
    if a == 0 &lt;br /&gt;
    {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After Mutation:&lt;br /&gt;
&lt;br /&gt;
    if false&lt;br /&gt;
    {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
* Duplicate statements&lt;br /&gt;
Before Mutation:&lt;br /&gt;
    for (i=0;i&amp;lt;5;i++)&lt;br /&gt;
    {&lt;br /&gt;
     counter++;&lt;br /&gt;
    }&lt;br /&gt;
    if (counter%2==0)&lt;br /&gt;
    {&lt;br /&gt;
     x=x+y;&lt;br /&gt;
    }&lt;br /&gt;
After Mutation:&lt;br /&gt;
&lt;br /&gt;
    for (i=0;i&amp;lt;5;i++)&lt;br /&gt;
    {&lt;br /&gt;
     counter++;&lt;br /&gt;
     counter++;&lt;br /&gt;
    }&lt;br /&gt;
    if (counter%2==0)&lt;br /&gt;
    {&lt;br /&gt;
     x=x+y;&lt;br /&gt;
    }&lt;br /&gt;
* Change arithmetic operations. &lt;br /&gt;
Before Mutation:&lt;br /&gt;
    &lt;br /&gt;
    if (counter%2==0)&lt;br /&gt;
    {&lt;br /&gt;
     x=x+y;&lt;br /&gt;
    }&lt;br /&gt;
After Mutation:&lt;br /&gt;
    &lt;br /&gt;
    if (counter%2==0)&lt;br /&gt;
    {&lt;br /&gt;
     x=x-y;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
===Other Enhancements===&lt;br /&gt;
* Randomized the test order to increase the performance of testing.&lt;br /&gt;
* Introduced logging instead of print statements.&lt;br /&gt;
* Added Retry Mechanism when mutation cannot be performed on a file by a strategy.&lt;br /&gt;
&lt;br /&gt;
===Excecution Flow===&lt;br /&gt;
&lt;br /&gt;
[[File:Mutation_testing.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Design Plan==&lt;br /&gt;
&lt;br /&gt;
===Strategy Design Pattern===&lt;br /&gt;
There are multiple strategies for mutating a file. Each strategy has the implementation of its strategy in the mutate_line method. The Mutator picks up random strategy during the execution of the program and mutates the file.&lt;br /&gt;
&lt;br /&gt;
[[File:UML_Mutation_Testing_(1).jpg]]&lt;br /&gt;
&lt;br /&gt;
===Code snippet===&lt;br /&gt;
&lt;br /&gt;
    class Mutator:&lt;br /&gt;
        def __init__(self, strategy):&lt;br /&gt;
            self._strategy = strategy&lt;br /&gt;
        def mutate(self, file_name):&lt;br /&gt;
            return self._strategy.mutate_random_line(file_name)&lt;br /&gt;
&lt;br /&gt;
    class Strategy:&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            self._replace_strategy = {}&lt;br /&gt;
    &lt;br /&gt;
        def mutate_random_line(self, file_name):&lt;br /&gt;
            line_numbers = []&lt;br /&gt;
            for line in fileinput.input(file_name):&lt;br /&gt;
                if re.search(self._replace_strategy['regex'], line):&lt;br /&gt;
                    line_numbers.append(fileinput.lineno())&lt;br /&gt;
            if len(line_numbers) == 0:&lt;br /&gt;
                return -1&lt;br /&gt;
            else:&lt;br /&gt;
                mutation_line_number = line_numbers[random.randint(0, len(line_numbers) - 1)]&lt;br /&gt;
                for line in fileinput.input(file_name, inplace=True):&lt;br /&gt;
                    if fileinput.lineno() == mutation_line_number:&lt;br /&gt;
                        line = re.sub(self._replace_strategy['regex'], self._replace_strategy['replaceString'], line)&lt;br /&gt;
                    print line.rstrip()&lt;br /&gt;
                return mutation_line_number&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    class AndOr(Strategy):&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            Strategy.__init__(self)&lt;br /&gt;
            self._replace_strategy = {&lt;br /&gt;
                'regex': r'\s&amp;amp;&amp;amp;\s',&lt;br /&gt;
                'replaceString': ' || '&lt;br /&gt;
            }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    class IfTrue(Strategy):&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            Strategy.__init__(self)&lt;br /&gt;
            self._replace_strategy = {&lt;br /&gt;
                'regex': r'(?&amp;lt;=if\s)(.*)(?=\s\{)',&lt;br /&gt;
                'replaceString': 'true'&lt;br /&gt;
            }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    class IfFalse(Strategy):&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            Strategy.__init__(self)&lt;br /&gt;
            self._replace_strategy = {&lt;br /&gt;
                'regex': r'(?&amp;lt;=if\s)(.*)(?=\s\{)',&lt;br /&gt;
                'replaceString': 'false'&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
The project is about writing a python script to change the source code and run tests. It does not add any functionality to Servo. So there is no scope for testing in this project.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://www.guru99.com/mutation-testing.html&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://github.com/servo/servo&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo/wiki/Mutation-testing-project&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sdhegde</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=114587</id>
		<title>CSC/ECE 517 Fall 2017/M1754 Mutation Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=114587"/>
		<updated>2017-12-07T02:01:54Z</updated>

		<summary type="html">&lt;p&gt;Sdhegde: /* Mutation Strategies */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Servo uses the Web Platform Test (WPT) suite for testing, but does not perform an evaluation of the breadth of the tests. The goal of this project is to use techniques from mutation testing to evaluate the performance of the WPT suite when bugs are deliberately introduced into the code base. &lt;br /&gt;
&lt;br /&gt;
The implementation of this project was done by writing python scripts that would modify the source code to generate mutants and run tests on them expecting failures. The scripts would temporarily modify the source codes, call the corresponding tests and revert back to the original code by reversing the changes that were made earlier. This process was repeated for multiple iterations by modifying various parts of the source code in random order.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use. [https://servo.org Servo] is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks. [https://en.wikipedia.org/wiki/Servo_(layout_engine)]&lt;br /&gt;
&lt;br /&gt;
===Web-platform-tests===&lt;br /&gt;
The [https://github.com/w3c/web-platform-tests web-platform-tests Project] is a W3C-coordinated attempt to build a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This, in turn, gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.&lt;br /&gt;
&lt;br /&gt;
===Mutation Testing===&lt;br /&gt;
Mutation Testing is a type of software testing where we mutate (change) certain statements in the source code and check if the test cases are able to find the errors.The goal of Mutation Testing is to assess the quality of the test cases which should be robust enough to fail mutant code. This method is also called as a Fault-based testing strategy as it involves creating faults in the program.Faults are introduced into the source code of the program by creating many versions called mutants. Each mutant should contain a single fault, and the goal is to cause the mutant version to fail which demonstrates the effectiveness of the test cases.[https://www.guru99.com/mutation-testing.html ]&lt;br /&gt;
&lt;br /&gt;
=='''Project description'''==&lt;br /&gt;
===Environment Setup===&lt;br /&gt;
* Clone the repository from [https://github.com/dsandeephegde/servo link]&lt;br /&gt;
* The steps to set up the environment for different OS are mentioned in readme file [https://github.com/servo/servo link].&lt;br /&gt;
&lt;br /&gt;
====Install packages==== &lt;br /&gt;
&lt;br /&gt;
Example, In OSX(homebrew):&lt;br /&gt;
&lt;br /&gt;
 brew install automake pkg-config python cmake yasm&lt;br /&gt;
 pip install virtualenv&lt;br /&gt;
&lt;br /&gt;
====Running test after setup====&lt;br /&gt;
&lt;br /&gt;
After the setup, make sure that everything works in your machine by building and running tests.&lt;br /&gt;
&lt;br /&gt;
build in release mode:&lt;br /&gt;
&lt;br /&gt;
 ./mach build --release&lt;br /&gt;
&lt;br /&gt;
run WPT tests:&lt;br /&gt;
&lt;br /&gt;
 ./mach test -wpt --release&lt;br /&gt;
&lt;br /&gt;
===Initial steps===&lt;br /&gt;
&lt;br /&gt;
*Implemented a simple mutator as a Python script that finds random uses of &amp;amp;&amp;amp; in Servo's code base and replaces them by ||.&lt;br /&gt;
*Built the mutated implementation of Servo with ./mach build -r and run it on the WPT test suite with ./mach test-wpt:  This produced test failures.&lt;br /&gt;
*Introduced test mapping framework to map source files to WPT test.&lt;br /&gt;
*Optimized the number of test runs by using test mapping to run only relevant tests for a mutant.&lt;br /&gt;
*Automated this process by writing scripts in a new python/servo/mutation directory, and called them from scripts in /etc/ci.&lt;br /&gt;
* Mutation test can be ran using either of the following command from the servo directory:&lt;br /&gt;
&lt;br /&gt;
 python python/servo/mutation/init.py components/script/dom&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 python etc/ci/mutation_test.py&lt;br /&gt;
&lt;br /&gt;
===Subsequent steps===&lt;br /&gt;
&lt;br /&gt;
* implement mutations like replacing if statements by if true/if false, duplicating statements, reordering statements, changing arithmetic &amp;amp; atomic string constant.&lt;br /&gt;
* improving the performance of the testing, for example randomizing the test order, fast-failing, running tests with faster builds (e.g. ./mach build -d).&lt;br /&gt;
* find heuristics for identifying false positives, that is mutations which are expected to have no effect, for example removing logging.&lt;br /&gt;
* find search heuristics for identifying mutations that cause no test failures.&lt;br /&gt;
&lt;br /&gt;
===Existing Mutation Strategy===&lt;br /&gt;
&lt;br /&gt;
* Replace random occurrence of &amp;amp;&amp;amp; with ||&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
Before Mutation:&lt;br /&gt;
    if a &amp;amp;&amp;amp; b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
After Mutation:&lt;br /&gt;
    if a || b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
This will produce a bug. When a is true and b is false also when a is false and b is true the value of c will be wrong. If our WPT test catches this bug then we can say mutant is killed. Otherwise mutant has lived.&lt;br /&gt;
&lt;br /&gt;
===Mutation Strategies===&lt;br /&gt;
There will be many strategies to mutate a file, like the existing one. And the strategies will be picked randomly during the execution of the program.&lt;br /&gt;
Some of the strategies are:&lt;br /&gt;
* Replace &amp;amp;&amp;amp; to ||&lt;br /&gt;
* Make 'if condition' to 'if true'&lt;br /&gt;
* Make 'if condition' to 'if false'&lt;br /&gt;
* Change String literals&lt;br /&gt;
* Change Comparision operators&lt;br /&gt;
* Duplicate statements&lt;br /&gt;
* Change arithmetic operations.&lt;br /&gt;
&lt;br /&gt;
As the build and WPT test run take a lot of time to run. Mutation Test Strategies are implemented with these key features&lt;br /&gt;
* The mutants produces only run-time bugs.&lt;br /&gt;
* The mutants do not cause any compilation failure.&lt;br /&gt;
* The mutants do not produce False Positives.&lt;br /&gt;
&lt;br /&gt;
===Mutation Strategy Examples===&lt;br /&gt;
* The example for this strategy has already been mentioned in the [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/M1754_Mutation_Testing#Existing_Mutation_Strategy Existing Mutation Strategy] section.&lt;br /&gt;
* Make 'if condition' to 'if true'&lt;br /&gt;
Example:&lt;br /&gt;
Before Mutation:&lt;br /&gt;
&lt;br /&gt;
    if a == 0 &lt;br /&gt;
    {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
After Mutation:&lt;br /&gt;
&lt;br /&gt;
    if true &lt;br /&gt;
    {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    }&lt;br /&gt;
* Make 'if condition' to 'if false' &lt;br /&gt;
Example:&lt;br /&gt;
Before Mutation:&lt;br /&gt;
&lt;br /&gt;
    if a == 0 &lt;br /&gt;
    {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After Mutation:&lt;br /&gt;
&lt;br /&gt;
    if false&lt;br /&gt;
    {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
* Duplicate statements&lt;br /&gt;
Before Mutation:&lt;br /&gt;
    for (i=0;i&amp;lt;5;i++)&lt;br /&gt;
    {&lt;br /&gt;
     counter++;&lt;br /&gt;
    }&lt;br /&gt;
    if (counter%2==0)&lt;br /&gt;
    {&lt;br /&gt;
     x=x+y;&lt;br /&gt;
    }&lt;br /&gt;
After Mutation:&lt;br /&gt;
&lt;br /&gt;
    for (i=0;i&amp;lt;5;i++)&lt;br /&gt;
    {&lt;br /&gt;
     counter++;&lt;br /&gt;
     counter++;&lt;br /&gt;
    }&lt;br /&gt;
    if (counter%2==0)&lt;br /&gt;
    {&lt;br /&gt;
     x=x+y;&lt;br /&gt;
    }&lt;br /&gt;
* Change arithmetic operations. &lt;br /&gt;
Before Mutation:&lt;br /&gt;
    &lt;br /&gt;
    if (counter%2==0)&lt;br /&gt;
    {&lt;br /&gt;
     x=x+y;&lt;br /&gt;
    }&lt;br /&gt;
After Mutation:&lt;br /&gt;
    &lt;br /&gt;
    if (counter%2==0)&lt;br /&gt;
    {&lt;br /&gt;
     x=x-y;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
===Other Enhancements===&lt;br /&gt;
* Randomized the test order to increase the performance of testing.&lt;br /&gt;
* Introduced logging instead of print statements.&lt;br /&gt;
* Added Retry Mechanism when mutation cannot be performed on a file by a strategy.&lt;br /&gt;
&lt;br /&gt;
===Excecution Flow===&lt;br /&gt;
&lt;br /&gt;
[[File:Mutation_testing.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Design Plan==&lt;br /&gt;
&lt;br /&gt;
===Strategy Design Pattern===&lt;br /&gt;
There are multiple strategies for mutating a file. Each strategy has the implementation of its strategy in the mutate_line method. The Mutator picks up random strategy during the execution of the program and mutates the file.&lt;br /&gt;
&lt;br /&gt;
[[File:UML_Mutation_Testing_(1).jpg]]&lt;br /&gt;
&lt;br /&gt;
===Code snippet===&lt;br /&gt;
&lt;br /&gt;
    class Mutator:&lt;br /&gt;
        def __init__(self, strategy):&lt;br /&gt;
            self._strategy = strategy&lt;br /&gt;
        def mutate(self, file_name):&lt;br /&gt;
            return self._strategy.mutate_random_line(file_name)&lt;br /&gt;
&lt;br /&gt;
    class Strategy:&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            self._replace_strategy = {}&lt;br /&gt;
    &lt;br /&gt;
        def mutate_random_line(self, file_name):&lt;br /&gt;
            line_numbers = []&lt;br /&gt;
            for line in fileinput.input(file_name):&lt;br /&gt;
                if re.search(self._replace_strategy['regex'], line):&lt;br /&gt;
                    line_numbers.append(fileinput.lineno())&lt;br /&gt;
            if len(line_numbers) == 0:&lt;br /&gt;
                return -1&lt;br /&gt;
            else:&lt;br /&gt;
                mutation_line_number = line_numbers[random.randint(0, len(line_numbers) - 1)]&lt;br /&gt;
                for line in fileinput.input(file_name, inplace=True):&lt;br /&gt;
                    if fileinput.lineno() == mutation_line_number:&lt;br /&gt;
                        line = re.sub(self._replace_strategy['regex'], self._replace_strategy['replaceString'], line)&lt;br /&gt;
                    print line.rstrip()&lt;br /&gt;
                return mutation_line_number&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    class AndOr(Strategy):&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            Strategy.__init__(self)&lt;br /&gt;
            self._replace_strategy = {&lt;br /&gt;
                'regex': r'\s&amp;amp;&amp;amp;\s',&lt;br /&gt;
                'replaceString': ' || '&lt;br /&gt;
            }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    class IfTrue(Strategy):&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            Strategy.__init__(self)&lt;br /&gt;
            self._replace_strategy = {&lt;br /&gt;
                'regex': r'(?&amp;lt;=if\s)(.*)(?=\s\{)',&lt;br /&gt;
                'replaceString': 'true'&lt;br /&gt;
            }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    class IfFalse(Strategy):&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            Strategy.__init__(self)&lt;br /&gt;
            self._replace_strategy = {&lt;br /&gt;
                'regex': r'(?&amp;lt;=if\s)(.*)(?=\s\{)',&lt;br /&gt;
                'replaceString': 'false'&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
The project is about writing a python script to change the source code and run tests. It does not add any functionality to Servo. So there is no scope for testing in this project.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://www.guru99.com/mutation-testing.html&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://github.com/servo/servo&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo/wiki/Mutation-testing-project&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sdhegde</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=114586</id>
		<title>CSC/ECE 517 Fall 2017/M1754 Mutation Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=114586"/>
		<updated>2017-12-07T01:55:22Z</updated>

		<summary type="html">&lt;p&gt;Sdhegde: /* Project description */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Servo uses the Web Platform Test (WPT) suite for testing, but does not perform an evaluation of the breadth of the tests. The goal of this project is to use techniques from mutation testing to evaluate the performance of the WPT suite when bugs are deliberately introduced into the code base. &lt;br /&gt;
&lt;br /&gt;
The implementation of this project was done by writing python scripts that would modify the source code to generate mutants and run tests on them expecting failures. The scripts would temporarily modify the source codes, call the corresponding tests and revert back to the original code by reversing the changes that were made earlier. This process was repeated for multiple iterations by modifying various parts of the source code in random order.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use. [https://servo.org Servo] is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks. [https://en.wikipedia.org/wiki/Servo_(layout_engine)]&lt;br /&gt;
&lt;br /&gt;
===Web-platform-tests===&lt;br /&gt;
The [https://github.com/w3c/web-platform-tests web-platform-tests Project] is a W3C-coordinated attempt to build a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This, in turn, gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.&lt;br /&gt;
&lt;br /&gt;
===Mutation Testing===&lt;br /&gt;
Mutation Testing is a type of software testing where we mutate (change) certain statements in the source code and check if the test cases are able to find the errors.The goal of Mutation Testing is to assess the quality of the test cases which should be robust enough to fail mutant code. This method is also called as a Fault-based testing strategy as it involves creating faults in the program.Faults are introduced into the source code of the program by creating many versions called mutants. Each mutant should contain a single fault, and the goal is to cause the mutant version to fail which demonstrates the effectiveness of the test cases.[https://www.guru99.com/mutation-testing.html ]&lt;br /&gt;
&lt;br /&gt;
=='''Project description'''==&lt;br /&gt;
===Environment Setup===&lt;br /&gt;
* Clone the repository from [https://github.com/dsandeephegde/servo link]&lt;br /&gt;
* The steps to set up the environment for different OS are mentioned in readme file [https://github.com/servo/servo link].&lt;br /&gt;
&lt;br /&gt;
====Install packages==== &lt;br /&gt;
&lt;br /&gt;
Example, In OSX(homebrew):&lt;br /&gt;
&lt;br /&gt;
 brew install automake pkg-config python cmake yasm&lt;br /&gt;
 pip install virtualenv&lt;br /&gt;
&lt;br /&gt;
====Running test after setup====&lt;br /&gt;
&lt;br /&gt;
After the setup, make sure that everything works in your machine by building and running tests.&lt;br /&gt;
&lt;br /&gt;
build in release mode:&lt;br /&gt;
&lt;br /&gt;
 ./mach build --release&lt;br /&gt;
&lt;br /&gt;
run WPT tests:&lt;br /&gt;
&lt;br /&gt;
 ./mach test -wpt --release&lt;br /&gt;
&lt;br /&gt;
===Initial steps===&lt;br /&gt;
&lt;br /&gt;
*Implemented a simple mutator as a Python script that finds random uses of &amp;amp;&amp;amp; in Servo's code base and replaces them by ||.&lt;br /&gt;
*Built the mutated implementation of Servo with ./mach build -r and run it on the WPT test suite with ./mach test-wpt:  This produced test failures.&lt;br /&gt;
*Introduced test mapping framework to map source files to WPT test.&lt;br /&gt;
*Optimized the number of test runs by using test mapping to run only relevant tests for a mutant.&lt;br /&gt;
*Automated this process by writing scripts in a new python/servo/mutation directory, and called them from scripts in /etc/ci.&lt;br /&gt;
* Mutation test can be ran using either of the following command from the servo directory:&lt;br /&gt;
&lt;br /&gt;
 python python/servo/mutation/init.py components/script/dom&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 python etc/ci/mutation_test.py&lt;br /&gt;
&lt;br /&gt;
===Subsequent steps===&lt;br /&gt;
&lt;br /&gt;
* implement mutations like replacing if statements by if true/if false, duplicating statements, reordering statements, changing arithmetic &amp;amp; atomic string constant.&lt;br /&gt;
* improving the performance of the testing, for example randomizing the test order, fast-failing, running tests with faster builds (e.g. ./mach build -d).&lt;br /&gt;
* find heuristics for identifying false positives, that is mutations which are expected to have no effect, for example removing logging.&lt;br /&gt;
* find search heuristics for identifying mutations that cause no test failures.&lt;br /&gt;
&lt;br /&gt;
===Existing Mutation Strategy===&lt;br /&gt;
&lt;br /&gt;
* Replace random occurrence of &amp;amp;&amp;amp; with ||&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
Before Mutation:&lt;br /&gt;
    if a &amp;amp;&amp;amp; b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
After Mutation:&lt;br /&gt;
    if a || b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
This will produce a bug. When a is true and b is false also when a is false and b is true the value of c will be wrong. If our WPT test catches this bug then we can say mutant is killed. Otherwise mutant has lived.&lt;br /&gt;
&lt;br /&gt;
===Mutation Strategies===&lt;br /&gt;
There will be many strategies to mutate a file, like the existing one. And the strategies will be picked randomly during the execution of the program.&lt;br /&gt;
Some of the strategies are:&lt;br /&gt;
* Replace &amp;amp;&amp;amp; to ||&lt;br /&gt;
* Make 'if condition' to 'if true'&lt;br /&gt;
* Make 'if condition' to 'if false'&lt;br /&gt;
* Change String literals&lt;br /&gt;
* Change Comparision operators&lt;br /&gt;
* Duplicate statements&lt;br /&gt;
* Change arithmetic operations.&lt;br /&gt;
&lt;br /&gt;
===Mutation Strategy Examples===&lt;br /&gt;
* The example for this strategy has already been mentioned in the [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/M1754_Mutation_Testing#Existing_Mutation_Strategy Existing Mutation Strategy] section.&lt;br /&gt;
* Make 'if condition' to 'if true'&lt;br /&gt;
Example:&lt;br /&gt;
Before Mutation:&lt;br /&gt;
&lt;br /&gt;
    if a == 0 &lt;br /&gt;
    {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
After Mutation:&lt;br /&gt;
&lt;br /&gt;
    if true &lt;br /&gt;
    {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    }&lt;br /&gt;
* Make 'if condition' to 'if false' &lt;br /&gt;
Example:&lt;br /&gt;
Before Mutation:&lt;br /&gt;
&lt;br /&gt;
    if a == 0 &lt;br /&gt;
    {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After Mutation:&lt;br /&gt;
&lt;br /&gt;
    if false&lt;br /&gt;
    {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
* Duplicate statements&lt;br /&gt;
Before Mutation:&lt;br /&gt;
    for (i=0;i&amp;lt;5;i++)&lt;br /&gt;
    {&lt;br /&gt;
     counter++;&lt;br /&gt;
    }&lt;br /&gt;
    if (counter%2==0)&lt;br /&gt;
    {&lt;br /&gt;
     x=x+y;&lt;br /&gt;
    }&lt;br /&gt;
After Mutation:&lt;br /&gt;
&lt;br /&gt;
    for (i=0;i&amp;lt;5;i++)&lt;br /&gt;
    {&lt;br /&gt;
     counter++;&lt;br /&gt;
     counter++;&lt;br /&gt;
    }&lt;br /&gt;
    if (counter%2==0)&lt;br /&gt;
    {&lt;br /&gt;
     x=x+y;&lt;br /&gt;
    }&lt;br /&gt;
* Change arithmetic operations. &lt;br /&gt;
Before Mutation:&lt;br /&gt;
    &lt;br /&gt;
    if (counter%2==0)&lt;br /&gt;
    {&lt;br /&gt;
     x=x+y;&lt;br /&gt;
    }&lt;br /&gt;
After Mutation:&lt;br /&gt;
    &lt;br /&gt;
    if (counter%2==0)&lt;br /&gt;
    {&lt;br /&gt;
     x=x-y;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
===Other Enhancements===&lt;br /&gt;
* Randomized the test order to increase the performance of testing.&lt;br /&gt;
* Introduced logging instead of print statements.&lt;br /&gt;
* Added Retry Mechanism when mutation cannot be performed on a file by a strategy.&lt;br /&gt;
&lt;br /&gt;
===Excecution Flow===&lt;br /&gt;
&lt;br /&gt;
[[File:Mutation_testing.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Design Plan==&lt;br /&gt;
&lt;br /&gt;
===Strategy Design Pattern===&lt;br /&gt;
There are multiple strategies for mutating a file. Each strategy has the implementation of its strategy in the mutate_line method. The Mutator picks up random strategy during the execution of the program and mutates the file.&lt;br /&gt;
&lt;br /&gt;
[[File:UML_Mutation_Testing_(1).jpg]]&lt;br /&gt;
&lt;br /&gt;
===Code snippet===&lt;br /&gt;
&lt;br /&gt;
    class Mutator:&lt;br /&gt;
        def __init__(self, strategy):&lt;br /&gt;
            self._strategy = strategy&lt;br /&gt;
        def mutate(self, file_name):&lt;br /&gt;
            return self._strategy.mutate_random_line(file_name)&lt;br /&gt;
&lt;br /&gt;
    class Strategy:&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            self._replace_strategy = {}&lt;br /&gt;
    &lt;br /&gt;
        def mutate_random_line(self, file_name):&lt;br /&gt;
            line_numbers = []&lt;br /&gt;
            for line in fileinput.input(file_name):&lt;br /&gt;
                if re.search(self._replace_strategy['regex'], line):&lt;br /&gt;
                    line_numbers.append(fileinput.lineno())&lt;br /&gt;
            if len(line_numbers) == 0:&lt;br /&gt;
                return -1&lt;br /&gt;
            else:&lt;br /&gt;
                mutation_line_number = line_numbers[random.randint(0, len(line_numbers) - 1)]&lt;br /&gt;
                for line in fileinput.input(file_name, inplace=True):&lt;br /&gt;
                    if fileinput.lineno() == mutation_line_number:&lt;br /&gt;
                        line = re.sub(self._replace_strategy['regex'], self._replace_strategy['replaceString'], line)&lt;br /&gt;
                    print line.rstrip()&lt;br /&gt;
                return mutation_line_number&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    class AndOr(Strategy):&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            Strategy.__init__(self)&lt;br /&gt;
            self._replace_strategy = {&lt;br /&gt;
                'regex': r'\s&amp;amp;&amp;amp;\s',&lt;br /&gt;
                'replaceString': ' || '&lt;br /&gt;
            }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    class IfTrue(Strategy):&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            Strategy.__init__(self)&lt;br /&gt;
            self._replace_strategy = {&lt;br /&gt;
                'regex': r'(?&amp;lt;=if\s)(.*)(?=\s\{)',&lt;br /&gt;
                'replaceString': 'true'&lt;br /&gt;
            }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    class IfFalse(Strategy):&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            Strategy.__init__(self)&lt;br /&gt;
            self._replace_strategy = {&lt;br /&gt;
                'regex': r'(?&amp;lt;=if\s)(.*)(?=\s\{)',&lt;br /&gt;
                'replaceString': 'false'&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
The project is about writing a python script to change the source code and run tests. It does not add any functionality to Servo. So there is no scope for testing in this project.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://www.guru99.com/mutation-testing.html&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://github.com/servo/servo&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo/wiki/Mutation-testing-project&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sdhegde</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=114585</id>
		<title>CSC/ECE 517 Fall 2017/M1754 Mutation Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=114585"/>
		<updated>2017-12-07T01:40:46Z</updated>

		<summary type="html">&lt;p&gt;Sdhegde: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Servo uses the Web Platform Test (WPT) suite for testing, but does not perform an evaluation of the breadth of the tests. The goal of this project is to use techniques from mutation testing to evaluate the performance of the WPT suite when bugs are deliberately introduced into the code base. &lt;br /&gt;
&lt;br /&gt;
The implementation of this project was done by writing python scripts that would modify the source code to generate mutants and run tests on them expecting failures. The scripts would temporarily modify the source codes, call the corresponding tests and revert back to the original code by reversing the changes that were made earlier. This process was repeated for multiple iterations by modifying various parts of the source code in random order.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use. [https://servo.org Servo] is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks. [https://en.wikipedia.org/wiki/Servo_(layout_engine)]&lt;br /&gt;
&lt;br /&gt;
===Web-platform-tests===&lt;br /&gt;
The [https://github.com/w3c/web-platform-tests web-platform-tests Project] is a W3C-coordinated attempt to build a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This, in turn, gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.&lt;br /&gt;
&lt;br /&gt;
===Mutation Testing===&lt;br /&gt;
Mutation Testing is a type of software testing where we mutate (change) certain statements in the source code and check if the test cases are able to find the errors.The goal of Mutation Testing is to assess the quality of the test cases which should be robust enough to fail mutant code. This method is also called as a Fault-based testing strategy as it involves creating faults in the program.Faults are introduced into the source code of the program by creating many versions called mutants. Each mutant should contain a single fault, and the goal is to cause the mutant version to fail which demonstrates the effectiveness of the test cases.[https://www.guru99.com/mutation-testing.html ]&lt;br /&gt;
&lt;br /&gt;
=='''Project description'''==&lt;br /&gt;
===Environment Setup===&lt;br /&gt;
* Clone the repository from [https://github.com/dsandeephegde/servo link]&lt;br /&gt;
* The steps to set up the environment for different OS are mentioned in readme file [https://github.com/servo/servo link].&lt;br /&gt;
&lt;br /&gt;
====Install packages==== &lt;br /&gt;
&lt;br /&gt;
Example, In OSX(homebrew):&lt;br /&gt;
&lt;br /&gt;
 brew install automake pkg-config python cmake yasm&lt;br /&gt;
 pip install virtualenv&lt;br /&gt;
&lt;br /&gt;
====Running test after setup====&lt;br /&gt;
&lt;br /&gt;
After the setup, make sure that everything works in your machine by building and running tests.&lt;br /&gt;
&lt;br /&gt;
build in release mode:&lt;br /&gt;
&lt;br /&gt;
 ./mach build --release&lt;br /&gt;
&lt;br /&gt;
run WPT tests:&lt;br /&gt;
&lt;br /&gt;
 ./mach test -wpt --release&lt;br /&gt;
&lt;br /&gt;
===Initial steps===&lt;br /&gt;
&lt;br /&gt;
*Implemented a simple mutator as a Python script that finds random uses of &amp;amp;&amp;amp; in Servo's code base and replaces them by ||.&lt;br /&gt;
*Built the mutated implementation of Servo with ./mach build -r and run it on the WPT test suite with ./mach test-wpt:  This produced test failures.&lt;br /&gt;
*Introduced test mapping framework to map source files to WPT test.&lt;br /&gt;
*Optimized the number of test runs by using test mapping to run only relevant tests for a mutant.&lt;br /&gt;
*Automated this process by writing scripts in a new python/servo/mutation directory, and called them from scripts in /etc/ci.&lt;br /&gt;
* Mutation test can be ran using either of the following command from the servo directory:&lt;br /&gt;
&lt;br /&gt;
 python python/servo/mutation/init.py components/script/dom&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 python etc/ci/mutation_test.py&lt;br /&gt;
&lt;br /&gt;
===Subsequent steps===&lt;br /&gt;
&lt;br /&gt;
* implement mutations like replacing if statements by if true/if false, duplicating statements, reordering statements, changing arithmetic &amp;amp; atomic string constant.&lt;br /&gt;
* improving the performance of the testing, for example randomizing the test order, fast-failing, running tests with faster builds (e.g. ./mach build -d).&lt;br /&gt;
* find heuristics for identifying false positives, that is mutations which are expected to have no effect, for example removing logging.&lt;br /&gt;
* find search heuristics for identifying mutations that cause no test failures.&lt;br /&gt;
&lt;br /&gt;
===Existing Mutation Strategy===&lt;br /&gt;
&lt;br /&gt;
* Replace random occurrence of &amp;amp;&amp;amp; with ||&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
Before Mutation:&lt;br /&gt;
    if a &amp;amp;&amp;amp; b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
After Mutation:&lt;br /&gt;
    if a || b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
This will produce a bug. When a is true and b is false also when a is false and b is true the value of c will be wrong. If our WPT test catches this bug then we can say mutant is killed. Otherwise mutant has lived.&lt;br /&gt;
&lt;br /&gt;
===Mutation Strategies===&lt;br /&gt;
There will be many strategies to mutate a file, like the existing one. And the strategies will be picked randomly during the execution of the program.&lt;br /&gt;
Some of the strategies are:&lt;br /&gt;
* Replace &amp;amp;&amp;amp; to ||&lt;br /&gt;
* Make 'if condition' to 'if true'&lt;br /&gt;
* Make 'if condition' to 'if false'&lt;br /&gt;
* Change String literals&lt;br /&gt;
* Change Comparision operators&lt;br /&gt;
* Duplicate statements&lt;br /&gt;
* Change arithmetic operations.&lt;br /&gt;
&lt;br /&gt;
===Mutation Strategy Examples===&lt;br /&gt;
* The example for this strategy has already been mentioned in the [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/M1754_Mutation_Testing#Existing_Mutation_Strategy Existing Mutation Strategy] section.&lt;br /&gt;
* Make 'if condition' to 'if true'&lt;br /&gt;
Example:&lt;br /&gt;
Before Mutation:&lt;br /&gt;
&lt;br /&gt;
    if a == 0 &lt;br /&gt;
    {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
After Mutation:&lt;br /&gt;
&lt;br /&gt;
    if true &lt;br /&gt;
    {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    }&lt;br /&gt;
* Make 'if condition' to 'if false' &lt;br /&gt;
Example:&lt;br /&gt;
Before Mutation:&lt;br /&gt;
&lt;br /&gt;
    if a == 0 &lt;br /&gt;
    {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After Mutation:&lt;br /&gt;
&lt;br /&gt;
    if false&lt;br /&gt;
    {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
* Duplicate statements&lt;br /&gt;
Before Mutation:&lt;br /&gt;
    for (i=0;i&amp;lt;5;i++)&lt;br /&gt;
    {&lt;br /&gt;
     counter++;&lt;br /&gt;
    }&lt;br /&gt;
    if (counter%2==0)&lt;br /&gt;
    {&lt;br /&gt;
     x=x+y;&lt;br /&gt;
    }&lt;br /&gt;
After Mutation:&lt;br /&gt;
&lt;br /&gt;
    for (i=0;i&amp;lt;5;i++)&lt;br /&gt;
    {&lt;br /&gt;
     counter++;&lt;br /&gt;
     counter++;&lt;br /&gt;
    }&lt;br /&gt;
    if (counter%2==0)&lt;br /&gt;
    {&lt;br /&gt;
     x=x+y;&lt;br /&gt;
    }&lt;br /&gt;
* Change arithmetic operations. &lt;br /&gt;
Before Mutation:&lt;br /&gt;
    &lt;br /&gt;
    if (counter%2==0)&lt;br /&gt;
    {&lt;br /&gt;
     x=x+y;&lt;br /&gt;
    }&lt;br /&gt;
After Mutation:&lt;br /&gt;
    &lt;br /&gt;
    if (counter%2==0)&lt;br /&gt;
    {&lt;br /&gt;
     x=x-y;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
===Excecution Flow===&lt;br /&gt;
&lt;br /&gt;
[[File:Mutation_testing.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Design Plan==&lt;br /&gt;
&lt;br /&gt;
===Strategy Design Pattern===&lt;br /&gt;
There are multiple strategies for mutating a file. Each strategy has the implementation of its strategy in the mutate_line method. The Mutator picks up random strategy during the execution of the program and mutates the file.&lt;br /&gt;
&lt;br /&gt;
[[File:UML_Mutation_Testing_(1).jpg]]&lt;br /&gt;
&lt;br /&gt;
===Code snippet===&lt;br /&gt;
&lt;br /&gt;
    class Mutator:&lt;br /&gt;
        def __init__(self, strategy):&lt;br /&gt;
            self._strategy = strategy&lt;br /&gt;
        def mutate(self, file_name):&lt;br /&gt;
            return self._strategy.mutate_random_line(file_name)&lt;br /&gt;
&lt;br /&gt;
    class Strategy:&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            self._replace_strategy = {}&lt;br /&gt;
    &lt;br /&gt;
        def mutate_random_line(self, file_name):&lt;br /&gt;
            line_numbers = []&lt;br /&gt;
            for line in fileinput.input(file_name):&lt;br /&gt;
                if re.search(self._replace_strategy['regex'], line):&lt;br /&gt;
                    line_numbers.append(fileinput.lineno())&lt;br /&gt;
            if len(line_numbers) == 0:&lt;br /&gt;
                return -1&lt;br /&gt;
            else:&lt;br /&gt;
                mutation_line_number = line_numbers[random.randint(0, len(line_numbers) - 1)]&lt;br /&gt;
                for line in fileinput.input(file_name, inplace=True):&lt;br /&gt;
                    if fileinput.lineno() == mutation_line_number:&lt;br /&gt;
                        line = re.sub(self._replace_strategy['regex'], self._replace_strategy['replaceString'], line)&lt;br /&gt;
                    print line.rstrip()&lt;br /&gt;
                return mutation_line_number&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    class AndOr(Strategy):&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            Strategy.__init__(self)&lt;br /&gt;
            self._replace_strategy = {&lt;br /&gt;
                'regex': r'\s&amp;amp;&amp;amp;\s',&lt;br /&gt;
                'replaceString': ' || '&lt;br /&gt;
            }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    class IfTrue(Strategy):&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            Strategy.__init__(self)&lt;br /&gt;
            self._replace_strategy = {&lt;br /&gt;
                'regex': r'(?&amp;lt;=if\s)(.*)(?=\s\{)',&lt;br /&gt;
                'replaceString': 'true'&lt;br /&gt;
            }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    class IfFalse(Strategy):&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            Strategy.__init__(self)&lt;br /&gt;
            self._replace_strategy = {&lt;br /&gt;
                'regex': r'(?&amp;lt;=if\s)(.*)(?=\s\{)',&lt;br /&gt;
                'replaceString': 'false'&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
The project is about writing a python script to change the source code and run tests. It does not add any functionality to Servo. So there is no scope for testing in this project.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://www.guru99.com/mutation-testing.html&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://github.com/servo/servo&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo/wiki/Mutation-testing-project&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sdhegde</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=114584</id>
		<title>CSC/ECE 517 Fall 2017/M1754 Mutation Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=114584"/>
		<updated>2017-12-07T01:38:53Z</updated>

		<summary type="html">&lt;p&gt;Sdhegde: /* Mutation Strategy Examples */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Servo uses the Web Platform Test (WPT) suite for testing, but does not perform an evaluation of the breadth of the tests. The goal of this project is to use techniques from mutation testing to evaluate the performance of the WPT suite when bugs are deliberately introduced into the code base. &lt;br /&gt;
&lt;br /&gt;
The implementation of this project was done by writing python scripts that would modify the source code to generate mutants and run tests on them expecting failures. The scripts would temporarily modify the source codes, call the corresponding tests and revert back to the original code by reversing the changes that were made earlier. This process was repeated for multiple iterations by modifying various parts of the source code in random order.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use. [https://servo.org Servo] is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks. [https://en.wikipedia.org/wiki/Servo_(layout_engine)]&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://doc.rust-lang.org/book/second-edition/ Rust] is an open source,  systems programming language sponsored by Mozilla Research. Rust performs the majority of its safety checks and memory management decisions at compile time, so that program’s runtime performance is not impacted. Making it useful in programs with predictable space and time requirements, embedding in other languages, and writing low-level code, like device drivers and operating systems.&lt;br /&gt;
&lt;br /&gt;
===Web-platform-tests===&lt;br /&gt;
The [https://github.com/w3c/web-platform-tests web-platform-tests Project] is a W3C-coordinated attempt to build a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This, in turn, gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.&lt;br /&gt;
&lt;br /&gt;
===Mutation Testing===&lt;br /&gt;
Mutation Testing is a type of software testing where we mutate (change) certain statements in the source code and check if the test cases are able to find the errors.The goal of Mutation Testing is to assess the quality of the test cases which should be robust enough to fail mutant code. This method is also called as a Fault-based testing strategy as it involves creating faults in the program.Faults are introduced into the source code of the program by creating many versions called mutants. Each mutant should contain a single fault, and the goal is to cause the mutant version to fail which demonstrates the effectiveness of the test cases.[https://www.guru99.com/mutation-testing.html ]&lt;br /&gt;
&lt;br /&gt;
=='''Project description'''==&lt;br /&gt;
===Environment Setup===&lt;br /&gt;
* Clone the repository from [https://github.com/dsandeephegde/servo link]&lt;br /&gt;
* The steps to set up the environment for different OS are mentioned in readme file [https://github.com/servo/servo link].&lt;br /&gt;
&lt;br /&gt;
====Install packages==== &lt;br /&gt;
&lt;br /&gt;
Example, In OSX(homebrew):&lt;br /&gt;
&lt;br /&gt;
 brew install automake pkg-config python cmake yasm&lt;br /&gt;
 pip install virtualenv&lt;br /&gt;
&lt;br /&gt;
====Running test after setup====&lt;br /&gt;
&lt;br /&gt;
After the setup, make sure that everything works in your machine by building and running tests.&lt;br /&gt;
&lt;br /&gt;
build in release mode:&lt;br /&gt;
&lt;br /&gt;
 ./mach build --release&lt;br /&gt;
&lt;br /&gt;
run WPT tests:&lt;br /&gt;
&lt;br /&gt;
 ./mach test -wpt --release&lt;br /&gt;
&lt;br /&gt;
===Initial steps===&lt;br /&gt;
&lt;br /&gt;
*Implemented a simple mutator as a Python script that finds random uses of &amp;amp;&amp;amp; in Servo's code base and replaces them by ||.&lt;br /&gt;
*Built the mutated implementation of Servo with ./mach build -r and run it on the WPT test suite with ./mach test-wpt:  This produced test failures.&lt;br /&gt;
*Introduced test mapping framework to map source files to WPT test.&lt;br /&gt;
*Optimized the number of test runs by using test mapping to run only relevant tests for a mutant.&lt;br /&gt;
*Automated this process by writing scripts in a new python/servo/mutation directory, and called them from scripts in /etc/ci.&lt;br /&gt;
* Mutation test can be ran using either of the following command from the servo directory:&lt;br /&gt;
&lt;br /&gt;
 python python/servo/mutation/init.py components/script/dom&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 python etc/ci/mutation_test.py&lt;br /&gt;
&lt;br /&gt;
===Subsequent steps===&lt;br /&gt;
&lt;br /&gt;
* implement mutations like replacing if statements by if true/if false, duplicating statements, reordering statements, changing arithmetic &amp;amp; atomic string constant.&lt;br /&gt;
* improving the performance of the testing, for example randomizing the test order, fast-failing, running tests with faster builds (e.g. ./mach build -d).&lt;br /&gt;
* find heuristics for identifying false positives, that is mutations which are expected to have no effect, for example removing logging.&lt;br /&gt;
* find search heuristics for identifying mutations that cause no test failures.&lt;br /&gt;
&lt;br /&gt;
===Existing Mutation Strategy===&lt;br /&gt;
&lt;br /&gt;
* Replace random occurrence of &amp;amp;&amp;amp; with ||&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
Before Mutation:&lt;br /&gt;
    if a &amp;amp;&amp;amp; b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
After Mutation:&lt;br /&gt;
    if a || b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
This will produce a bug. When a is true and b is false also when a is false and b is true the value of c will be wrong. If our WPT test catches this bug then we can say mutant is killed. Otherwise mutant has lived.&lt;br /&gt;
&lt;br /&gt;
===Mutation Strategies===&lt;br /&gt;
There will be many strategies to mutate a file, like the existing one. And the strategies will be picked randomly during the execution of the program.&lt;br /&gt;
Some of the strategies are:&lt;br /&gt;
* Replace &amp;amp;&amp;amp; to ||&lt;br /&gt;
* Make 'if condition' to 'if true'&lt;br /&gt;
* Make 'if condition' to 'if false'&lt;br /&gt;
* Change String literals&lt;br /&gt;
* Change Comparision operators&lt;br /&gt;
* Duplicate statements&lt;br /&gt;
* Change arithmetic operations.&lt;br /&gt;
&lt;br /&gt;
===Mutation Strategy Examples===&lt;br /&gt;
* The example for this strategy has already been mentioned in the [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/M1754_Mutation_Testing#Existing_Mutation_Strategy Existing Mutation Strategy] section.&lt;br /&gt;
* Make 'if condition' to 'if true'&lt;br /&gt;
Example:&lt;br /&gt;
Before Mutation:&lt;br /&gt;
&lt;br /&gt;
    if a == 0 &lt;br /&gt;
    {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
After Mutation:&lt;br /&gt;
&lt;br /&gt;
    if true &lt;br /&gt;
    {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    }&lt;br /&gt;
* Make 'if condition' to 'if false' &lt;br /&gt;
Example:&lt;br /&gt;
Before Mutation:&lt;br /&gt;
&lt;br /&gt;
    if a == 0 &lt;br /&gt;
    {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After Mutation:&lt;br /&gt;
&lt;br /&gt;
    if false&lt;br /&gt;
    {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
* Duplicate statements&lt;br /&gt;
Before Mutation:&lt;br /&gt;
    for (i=0;i&amp;lt;5;i++)&lt;br /&gt;
    {&lt;br /&gt;
     counter++;&lt;br /&gt;
    }&lt;br /&gt;
    if (counter%2==0)&lt;br /&gt;
    {&lt;br /&gt;
     x=x+y;&lt;br /&gt;
    }&lt;br /&gt;
After Mutation:&lt;br /&gt;
&lt;br /&gt;
    for (i=0;i&amp;lt;5;i++)&lt;br /&gt;
    {&lt;br /&gt;
     counter++;&lt;br /&gt;
     counter++;&lt;br /&gt;
    }&lt;br /&gt;
    if (counter%2==0)&lt;br /&gt;
    {&lt;br /&gt;
     x=x+y;&lt;br /&gt;
    }&lt;br /&gt;
* Change arithmetic operations. &lt;br /&gt;
Before Mutation:&lt;br /&gt;
    &lt;br /&gt;
    if (counter%2==0)&lt;br /&gt;
    {&lt;br /&gt;
     x=x+y;&lt;br /&gt;
    }&lt;br /&gt;
After Mutation:&lt;br /&gt;
    &lt;br /&gt;
    if (counter%2==0)&lt;br /&gt;
    {&lt;br /&gt;
     x=x-y;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
===Excecution Flow===&lt;br /&gt;
&lt;br /&gt;
[[File:Mutation_testing.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Design Plan==&lt;br /&gt;
&lt;br /&gt;
===Strategy Design Pattern===&lt;br /&gt;
There are multiple strategies for mutating a file. Each strategy has the implementation of its strategy in the mutate_line method. The Mutator picks up random strategy during the execution of the program and mutates the file.&lt;br /&gt;
&lt;br /&gt;
[[File:UML_Mutation_Testing_(1).jpg]]&lt;br /&gt;
&lt;br /&gt;
===Code snippet===&lt;br /&gt;
&lt;br /&gt;
    class Mutator:&lt;br /&gt;
        def __init__(self, strategy):&lt;br /&gt;
            self._strategy = strategy&lt;br /&gt;
        def mutate(self, file_name):&lt;br /&gt;
            return self._strategy.mutate_random_line(file_name)&lt;br /&gt;
&lt;br /&gt;
    class Strategy:&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            self._replace_strategy = {}&lt;br /&gt;
    &lt;br /&gt;
        def mutate_random_line(self, file_name):&lt;br /&gt;
            line_numbers = []&lt;br /&gt;
            for line in fileinput.input(file_name):&lt;br /&gt;
                if re.search(self._replace_strategy['regex'], line):&lt;br /&gt;
                    line_numbers.append(fileinput.lineno())&lt;br /&gt;
            if len(line_numbers) == 0:&lt;br /&gt;
                return -1&lt;br /&gt;
            else:&lt;br /&gt;
                mutation_line_number = line_numbers[random.randint(0, len(line_numbers) - 1)]&lt;br /&gt;
                for line in fileinput.input(file_name, inplace=True):&lt;br /&gt;
                    if fileinput.lineno() == mutation_line_number:&lt;br /&gt;
                        line = re.sub(self._replace_strategy['regex'], self._replace_strategy['replaceString'], line)&lt;br /&gt;
                    print line.rstrip()&lt;br /&gt;
                return mutation_line_number&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    class AndOr(Strategy):&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            Strategy.__init__(self)&lt;br /&gt;
            self._replace_strategy = {&lt;br /&gt;
                'regex': r'\s&amp;amp;&amp;amp;\s',&lt;br /&gt;
                'replaceString': ' || '&lt;br /&gt;
            }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    class IfTrue(Strategy):&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            Strategy.__init__(self)&lt;br /&gt;
            self._replace_strategy = {&lt;br /&gt;
                'regex': r'(?&amp;lt;=if\s)(.*)(?=\s\{)',&lt;br /&gt;
                'replaceString': 'true'&lt;br /&gt;
            }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    class IfFalse(Strategy):&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            Strategy.__init__(self)&lt;br /&gt;
            self._replace_strategy = {&lt;br /&gt;
                'regex': r'(?&amp;lt;=if\s)(.*)(?=\s\{)',&lt;br /&gt;
                'replaceString': 'false'&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
The project is about writing a python script to change the source code and run tests. It does not add any functionality to Servo. So there is no scope for testing in this project.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://www.guru99.com/mutation-testing.html&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://github.com/servo/servo&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo/wiki/Mutation-testing-project&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sdhegde</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=114583</id>
		<title>CSC/ECE 517 Fall 2017/M1754 Mutation Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=114583"/>
		<updated>2017-12-07T01:38:28Z</updated>

		<summary type="html">&lt;p&gt;Sdhegde: /* Mutation Strategies */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Servo uses the Web Platform Test (WPT) suite for testing, but does not perform an evaluation of the breadth of the tests. The goal of this project is to use techniques from mutation testing to evaluate the performance of the WPT suite when bugs are deliberately introduced into the code base. &lt;br /&gt;
&lt;br /&gt;
The implementation of this project was done by writing python scripts that would modify the source code to generate mutants and run tests on them expecting failures. The scripts would temporarily modify the source codes, call the corresponding tests and revert back to the original code by reversing the changes that were made earlier. This process was repeated for multiple iterations by modifying various parts of the source code in random order.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use. [https://servo.org Servo] is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks. [https://en.wikipedia.org/wiki/Servo_(layout_engine)]&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://doc.rust-lang.org/book/second-edition/ Rust] is an open source,  systems programming language sponsored by Mozilla Research. Rust performs the majority of its safety checks and memory management decisions at compile time, so that program’s runtime performance is not impacted. Making it useful in programs with predictable space and time requirements, embedding in other languages, and writing low-level code, like device drivers and operating systems.&lt;br /&gt;
&lt;br /&gt;
===Web-platform-tests===&lt;br /&gt;
The [https://github.com/w3c/web-platform-tests web-platform-tests Project] is a W3C-coordinated attempt to build a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This, in turn, gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.&lt;br /&gt;
&lt;br /&gt;
===Mutation Testing===&lt;br /&gt;
Mutation Testing is a type of software testing where we mutate (change) certain statements in the source code and check if the test cases are able to find the errors.The goal of Mutation Testing is to assess the quality of the test cases which should be robust enough to fail mutant code. This method is also called as a Fault-based testing strategy as it involves creating faults in the program.Faults are introduced into the source code of the program by creating many versions called mutants. Each mutant should contain a single fault, and the goal is to cause the mutant version to fail which demonstrates the effectiveness of the test cases.[https://www.guru99.com/mutation-testing.html ]&lt;br /&gt;
&lt;br /&gt;
=='''Project description'''==&lt;br /&gt;
===Environment Setup===&lt;br /&gt;
* Clone the repository from [https://github.com/dsandeephegde/servo link]&lt;br /&gt;
* The steps to set up the environment for different OS are mentioned in readme file [https://github.com/servo/servo link].&lt;br /&gt;
&lt;br /&gt;
====Install packages==== &lt;br /&gt;
&lt;br /&gt;
Example, In OSX(homebrew):&lt;br /&gt;
&lt;br /&gt;
 brew install automake pkg-config python cmake yasm&lt;br /&gt;
 pip install virtualenv&lt;br /&gt;
&lt;br /&gt;
====Running test after setup====&lt;br /&gt;
&lt;br /&gt;
After the setup, make sure that everything works in your machine by building and running tests.&lt;br /&gt;
&lt;br /&gt;
build in release mode:&lt;br /&gt;
&lt;br /&gt;
 ./mach build --release&lt;br /&gt;
&lt;br /&gt;
run WPT tests:&lt;br /&gt;
&lt;br /&gt;
 ./mach test -wpt --release&lt;br /&gt;
&lt;br /&gt;
===Initial steps===&lt;br /&gt;
&lt;br /&gt;
*Implemented a simple mutator as a Python script that finds random uses of &amp;amp;&amp;amp; in Servo's code base and replaces them by ||.&lt;br /&gt;
*Built the mutated implementation of Servo with ./mach build -r and run it on the WPT test suite with ./mach test-wpt:  This produced test failures.&lt;br /&gt;
*Introduced test mapping framework to map source files to WPT test.&lt;br /&gt;
*Optimized the number of test runs by using test mapping to run only relevant tests for a mutant.&lt;br /&gt;
*Automated this process by writing scripts in a new python/servo/mutation directory, and called them from scripts in /etc/ci.&lt;br /&gt;
* Mutation test can be ran using either of the following command from the servo directory:&lt;br /&gt;
&lt;br /&gt;
 python python/servo/mutation/init.py components/script/dom&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 python etc/ci/mutation_test.py&lt;br /&gt;
&lt;br /&gt;
===Subsequent steps===&lt;br /&gt;
&lt;br /&gt;
* implement mutations like replacing if statements by if true/if false, duplicating statements, reordering statements, changing arithmetic &amp;amp; atomic string constant.&lt;br /&gt;
* improving the performance of the testing, for example randomizing the test order, fast-failing, running tests with faster builds (e.g. ./mach build -d).&lt;br /&gt;
* find heuristics for identifying false positives, that is mutations which are expected to have no effect, for example removing logging.&lt;br /&gt;
* find search heuristics for identifying mutations that cause no test failures.&lt;br /&gt;
&lt;br /&gt;
===Existing Mutation Strategy===&lt;br /&gt;
&lt;br /&gt;
* Replace random occurrence of &amp;amp;&amp;amp; with ||&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
Before Mutation:&lt;br /&gt;
    if a &amp;amp;&amp;amp; b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
After Mutation:&lt;br /&gt;
    if a || b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
This will produce a bug. When a is true and b is false also when a is false and b is true the value of c will be wrong. If our WPT test catches this bug then we can say mutant is killed. Otherwise mutant has lived.&lt;br /&gt;
&lt;br /&gt;
===Mutation Strategies===&lt;br /&gt;
There will be many strategies to mutate a file, like the existing one. And the strategies will be picked randomly during the execution of the program.&lt;br /&gt;
Some of the strategies are:&lt;br /&gt;
* Replace &amp;amp;&amp;amp; to ||&lt;br /&gt;
* Make 'if condition' to 'if true'&lt;br /&gt;
* Make 'if condition' to 'if false'&lt;br /&gt;
* Change String literals&lt;br /&gt;
* Change Comparision operators&lt;br /&gt;
* Duplicate statements&lt;br /&gt;
* Change arithmetic operations.&lt;br /&gt;
&lt;br /&gt;
===Mutation Strategy Examples===&lt;br /&gt;
* The example for this strategy has already been mentioned in the [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/M1754_Mutation_Testing#Existing_Mutation_Strategy Existing Mutation Strategy] section.&lt;br /&gt;
* Make 'if condition' to 'if true'&lt;br /&gt;
Example:&lt;br /&gt;
Before Mutation:&lt;br /&gt;
&lt;br /&gt;
    if a == 0 &lt;br /&gt;
    {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
After Mutation:&lt;br /&gt;
&lt;br /&gt;
    if true &lt;br /&gt;
    {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    }&lt;br /&gt;
* Make 'if condition' to 'if false' &lt;br /&gt;
Example:&lt;br /&gt;
Before Mutation:&lt;br /&gt;
&lt;br /&gt;
    if a == 0 &lt;br /&gt;
    {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After Mutation:&lt;br /&gt;
&lt;br /&gt;
    if false&lt;br /&gt;
    {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    }&lt;br /&gt;
* Re-order statements&lt;br /&gt;
Example:&lt;br /&gt;
Before Mutation:&lt;br /&gt;
&lt;br /&gt;
    int a=6, b=11;&lt;br /&gt;
    float c,d;&lt;br /&gt;
    c= a/b;&lt;br /&gt;
    d= c/a;&lt;br /&gt;
&lt;br /&gt;
After Mutation:&lt;br /&gt;
    int a=6, b=11;&lt;br /&gt;
    float c,d;&lt;br /&gt;
    d= c/a;&lt;br /&gt;
    c= a/b;&lt;br /&gt;
&lt;br /&gt;
* Duplicate statements&lt;br /&gt;
Before Mutation:&lt;br /&gt;
    for (i=0;i&amp;lt;5;i++)&lt;br /&gt;
    {&lt;br /&gt;
     counter++;&lt;br /&gt;
    }&lt;br /&gt;
    if (counter%2==0)&lt;br /&gt;
    {&lt;br /&gt;
     x=x+y;&lt;br /&gt;
    }&lt;br /&gt;
After Mutation:&lt;br /&gt;
&lt;br /&gt;
    for (i=0;i&amp;lt;5;i++)&lt;br /&gt;
    {&lt;br /&gt;
     counter++;&lt;br /&gt;
     counter++;&lt;br /&gt;
    }&lt;br /&gt;
    if (counter%2==0)&lt;br /&gt;
    {&lt;br /&gt;
     x=x+y;&lt;br /&gt;
    }&lt;br /&gt;
* Change arithmetic operations. &lt;br /&gt;
Before Mutation:&lt;br /&gt;
    &lt;br /&gt;
    if (counter%2==0)&lt;br /&gt;
    {&lt;br /&gt;
     x=x+y;&lt;br /&gt;
    }&lt;br /&gt;
After Mutation:&lt;br /&gt;
    &lt;br /&gt;
    if (counter%2==0)&lt;br /&gt;
    {&lt;br /&gt;
     x=x-y;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
===Excecution Flow===&lt;br /&gt;
&lt;br /&gt;
[[File:Mutation_testing.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Design Plan==&lt;br /&gt;
&lt;br /&gt;
===Strategy Design Pattern===&lt;br /&gt;
There are multiple strategies for mutating a file. Each strategy has the implementation of its strategy in the mutate_line method. The Mutator picks up random strategy during the execution of the program and mutates the file.&lt;br /&gt;
&lt;br /&gt;
[[File:UML_Mutation_Testing_(1).jpg]]&lt;br /&gt;
&lt;br /&gt;
===Code snippet===&lt;br /&gt;
&lt;br /&gt;
    class Mutator:&lt;br /&gt;
        def __init__(self, strategy):&lt;br /&gt;
            self._strategy = strategy&lt;br /&gt;
        def mutate(self, file_name):&lt;br /&gt;
            return self._strategy.mutate_random_line(file_name)&lt;br /&gt;
&lt;br /&gt;
    class Strategy:&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            self._replace_strategy = {}&lt;br /&gt;
    &lt;br /&gt;
        def mutate_random_line(self, file_name):&lt;br /&gt;
            line_numbers = []&lt;br /&gt;
            for line in fileinput.input(file_name):&lt;br /&gt;
                if re.search(self._replace_strategy['regex'], line):&lt;br /&gt;
                    line_numbers.append(fileinput.lineno())&lt;br /&gt;
            if len(line_numbers) == 0:&lt;br /&gt;
                return -1&lt;br /&gt;
            else:&lt;br /&gt;
                mutation_line_number = line_numbers[random.randint(0, len(line_numbers) - 1)]&lt;br /&gt;
                for line in fileinput.input(file_name, inplace=True):&lt;br /&gt;
                    if fileinput.lineno() == mutation_line_number:&lt;br /&gt;
                        line = re.sub(self._replace_strategy['regex'], self._replace_strategy['replaceString'], line)&lt;br /&gt;
                    print line.rstrip()&lt;br /&gt;
                return mutation_line_number&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    class AndOr(Strategy):&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            Strategy.__init__(self)&lt;br /&gt;
            self._replace_strategy = {&lt;br /&gt;
                'regex': r'\s&amp;amp;&amp;amp;\s',&lt;br /&gt;
                'replaceString': ' || '&lt;br /&gt;
            }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    class IfTrue(Strategy):&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            Strategy.__init__(self)&lt;br /&gt;
            self._replace_strategy = {&lt;br /&gt;
                'regex': r'(?&amp;lt;=if\s)(.*)(?=\s\{)',&lt;br /&gt;
                'replaceString': 'true'&lt;br /&gt;
            }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    class IfFalse(Strategy):&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            Strategy.__init__(self)&lt;br /&gt;
            self._replace_strategy = {&lt;br /&gt;
                'regex': r'(?&amp;lt;=if\s)(.*)(?=\s\{)',&lt;br /&gt;
                'replaceString': 'false'&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
The project is about writing a python script to change the source code and run tests. It does not add any functionality to Servo. So there is no scope for testing in this project.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://www.guru99.com/mutation-testing.html&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://github.com/servo/servo&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo/wiki/Mutation-testing-project&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sdhegde</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=114582</id>
		<title>CSC/ECE 517 Fall 2017/M1754 Mutation Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=114582"/>
		<updated>2017-12-07T01:29:10Z</updated>

		<summary type="html">&lt;p&gt;Sdhegde: /* Excecution Flow */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Servo uses the Web Platform Test (WPT) suite for testing, but does not perform an evaluation of the breadth of the tests. The goal of this project is to use techniques from mutation testing to evaluate the performance of the WPT suite when bugs are deliberately introduced into the code base. &lt;br /&gt;
&lt;br /&gt;
The implementation of this project was done by writing python scripts that would modify the source code to generate mutants and run tests on them expecting failures. The scripts would temporarily modify the source codes, call the corresponding tests and revert back to the original code by reversing the changes that were made earlier. This process was repeated for multiple iterations by modifying various parts of the source code in random order.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use. [https://servo.org Servo] is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks. [https://en.wikipedia.org/wiki/Servo_(layout_engine)]&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://doc.rust-lang.org/book/second-edition/ Rust] is an open source,  systems programming language sponsored by Mozilla Research. Rust performs the majority of its safety checks and memory management decisions at compile time, so that program’s runtime performance is not impacted. Making it useful in programs with predictable space and time requirements, embedding in other languages, and writing low-level code, like device drivers and operating systems.&lt;br /&gt;
&lt;br /&gt;
===Web-platform-tests===&lt;br /&gt;
The [https://github.com/w3c/web-platform-tests web-platform-tests Project] is a W3C-coordinated attempt to build a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This, in turn, gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.&lt;br /&gt;
&lt;br /&gt;
===Mutation Testing===&lt;br /&gt;
Mutation Testing is a type of software testing where we mutate (change) certain statements in the source code and check if the test cases are able to find the errors.The goal of Mutation Testing is to assess the quality of the test cases which should be robust enough to fail mutant code. This method is also called as a Fault-based testing strategy as it involves creating faults in the program.Faults are introduced into the source code of the program by creating many versions called mutants. Each mutant should contain a single fault, and the goal is to cause the mutant version to fail which demonstrates the effectiveness of the test cases.[https://www.guru99.com/mutation-testing.html ]&lt;br /&gt;
&lt;br /&gt;
=='''Project description'''==&lt;br /&gt;
===Environment Setup===&lt;br /&gt;
* Clone the repository from [https://github.com/dsandeephegde/servo link]&lt;br /&gt;
* The steps to set up the environment for different OS are mentioned in readme file [https://github.com/servo/servo link].&lt;br /&gt;
&lt;br /&gt;
====Install packages==== &lt;br /&gt;
&lt;br /&gt;
Example, In OSX(homebrew):&lt;br /&gt;
&lt;br /&gt;
 brew install automake pkg-config python cmake yasm&lt;br /&gt;
 pip install virtualenv&lt;br /&gt;
&lt;br /&gt;
====Running test after setup====&lt;br /&gt;
&lt;br /&gt;
After the setup, make sure that everything works in your machine by building and running tests.&lt;br /&gt;
&lt;br /&gt;
build in release mode:&lt;br /&gt;
&lt;br /&gt;
 ./mach build --release&lt;br /&gt;
&lt;br /&gt;
run WPT tests:&lt;br /&gt;
&lt;br /&gt;
 ./mach test -wpt --release&lt;br /&gt;
&lt;br /&gt;
===Initial steps===&lt;br /&gt;
&lt;br /&gt;
*Implemented a simple mutator as a Python script that finds random uses of &amp;amp;&amp;amp; in Servo's code base and replaces them by ||.&lt;br /&gt;
*Built the mutated implementation of Servo with ./mach build -r and run it on the WPT test suite with ./mach test-wpt:  This produced test failures.&lt;br /&gt;
*Introduced test mapping framework to map source files to WPT test.&lt;br /&gt;
*Optimized the number of test runs by using test mapping to run only relevant tests for a mutant.&lt;br /&gt;
*Automated this process by writing scripts in a new python/servo/mutation directory, and called them from scripts in /etc/ci.&lt;br /&gt;
* Mutation test can be ran using either of the following command from the servo directory:&lt;br /&gt;
&lt;br /&gt;
 python python/servo/mutation/init.py components/script/dom&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 python etc/ci/mutation_test.py&lt;br /&gt;
&lt;br /&gt;
===Subsequent steps===&lt;br /&gt;
&lt;br /&gt;
* implement mutations like replacing if statements by if true/if false, duplicating statements, reordering statements, changing arithmetic &amp;amp; atomic string constant.&lt;br /&gt;
* improving the performance of the testing, for example randomizing the test order, fast-failing, running tests with faster builds (e.g. ./mach build -d).&lt;br /&gt;
* find heuristics for identifying false positives, that is mutations which are expected to have no effect, for example removing logging.&lt;br /&gt;
* find search heuristics for identifying mutations that cause no test failures.&lt;br /&gt;
&lt;br /&gt;
===Existing Mutation Strategy===&lt;br /&gt;
&lt;br /&gt;
* Replace random occurrence of &amp;amp;&amp;amp; with ||&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
Before Mutation:&lt;br /&gt;
    if a &amp;amp;&amp;amp; b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
After Mutation:&lt;br /&gt;
    if a || b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
This will produce a bug. When a is true and b is false also when a is false and b is true the value of c will be wrong. If our WPT test catches this bug then we can say mutant is killed. Otherwise mutant has lived.&lt;br /&gt;
&lt;br /&gt;
===Mutation Strategies===&lt;br /&gt;
There will be many strategies to mutate a file, like the existing one. And the strategies will be picked randomly during the execution of the program.&lt;br /&gt;
Some of the strategies are:&lt;br /&gt;
* Replace &amp;amp;&amp;amp; to ||&lt;br /&gt;
* Make 'if condition' to 'if true'&lt;br /&gt;
* Make 'if condition' to 'if false'&lt;br /&gt;
* Re-order statements&lt;br /&gt;
* Duplicate statements&lt;br /&gt;
* Change arithmetic operations.&lt;br /&gt;
&lt;br /&gt;
===Mutation Strategy Examples===&lt;br /&gt;
* The example for this strategy has already been mentioned in the [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/M1754_Mutation_Testing#Existing_Mutation_Strategy Existing Mutation Strategy] section.&lt;br /&gt;
* Make 'if condition' to 'if true'&lt;br /&gt;
Example:&lt;br /&gt;
Before Mutation:&lt;br /&gt;
&lt;br /&gt;
    if a == 0 &lt;br /&gt;
    {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
After Mutation:&lt;br /&gt;
&lt;br /&gt;
    if true &lt;br /&gt;
    {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    }&lt;br /&gt;
* Make 'if condition' to 'if false' &lt;br /&gt;
Example:&lt;br /&gt;
Before Mutation:&lt;br /&gt;
&lt;br /&gt;
    if a == 0 &lt;br /&gt;
    {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After Mutation:&lt;br /&gt;
&lt;br /&gt;
    if false&lt;br /&gt;
    {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    }&lt;br /&gt;
* Re-order statements&lt;br /&gt;
Example:&lt;br /&gt;
Before Mutation:&lt;br /&gt;
&lt;br /&gt;
    int a=6, b=11;&lt;br /&gt;
    float c,d;&lt;br /&gt;
    c= a/b;&lt;br /&gt;
    d= c/a;&lt;br /&gt;
&lt;br /&gt;
After Mutation:&lt;br /&gt;
    int a=6, b=11;&lt;br /&gt;
    float c,d;&lt;br /&gt;
    d= c/a;&lt;br /&gt;
    c= a/b;&lt;br /&gt;
&lt;br /&gt;
* Duplicate statements&lt;br /&gt;
Before Mutation:&lt;br /&gt;
    for (i=0;i&amp;lt;5;i++)&lt;br /&gt;
    {&lt;br /&gt;
     counter++;&lt;br /&gt;
    }&lt;br /&gt;
    if (counter%2==0)&lt;br /&gt;
    {&lt;br /&gt;
     x=x+y;&lt;br /&gt;
    }&lt;br /&gt;
After Mutation:&lt;br /&gt;
&lt;br /&gt;
    for (i=0;i&amp;lt;5;i++)&lt;br /&gt;
    {&lt;br /&gt;
     counter++;&lt;br /&gt;
     counter++;&lt;br /&gt;
    }&lt;br /&gt;
    if (counter%2==0)&lt;br /&gt;
    {&lt;br /&gt;
     x=x+y;&lt;br /&gt;
    }&lt;br /&gt;
* Change arithmetic operations. &lt;br /&gt;
Before Mutation:&lt;br /&gt;
    &lt;br /&gt;
    if (counter%2==0)&lt;br /&gt;
    {&lt;br /&gt;
     x=x+y;&lt;br /&gt;
    }&lt;br /&gt;
After Mutation:&lt;br /&gt;
    &lt;br /&gt;
    if (counter%2==0)&lt;br /&gt;
    {&lt;br /&gt;
     x=x-y;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
===Excecution Flow===&lt;br /&gt;
&lt;br /&gt;
[[File:Mutation_testing.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Design Plan==&lt;br /&gt;
&lt;br /&gt;
===Strategy Design Pattern===&lt;br /&gt;
There are multiple strategies for mutating a file. Each strategy has the implementation of its strategy in the mutate_line method. The Mutator picks up random strategy during the execution of the program and mutates the file.&lt;br /&gt;
&lt;br /&gt;
[[File:UML_Mutation_Testing_(1).jpg]]&lt;br /&gt;
&lt;br /&gt;
===Code snippet===&lt;br /&gt;
&lt;br /&gt;
    class Mutator:&lt;br /&gt;
        def __init__(self, strategy):&lt;br /&gt;
            self._strategy = strategy&lt;br /&gt;
        def mutate(self, file_name):&lt;br /&gt;
            return self._strategy.mutate_random_line(file_name)&lt;br /&gt;
&lt;br /&gt;
    class Strategy:&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            self._replace_strategy = {}&lt;br /&gt;
    &lt;br /&gt;
        def mutate_random_line(self, file_name):&lt;br /&gt;
            line_numbers = []&lt;br /&gt;
            for line in fileinput.input(file_name):&lt;br /&gt;
                if re.search(self._replace_strategy['regex'], line):&lt;br /&gt;
                    line_numbers.append(fileinput.lineno())&lt;br /&gt;
            if len(line_numbers) == 0:&lt;br /&gt;
                return -1&lt;br /&gt;
            else:&lt;br /&gt;
                mutation_line_number = line_numbers[random.randint(0, len(line_numbers) - 1)]&lt;br /&gt;
                for line in fileinput.input(file_name, inplace=True):&lt;br /&gt;
                    if fileinput.lineno() == mutation_line_number:&lt;br /&gt;
                        line = re.sub(self._replace_strategy['regex'], self._replace_strategy['replaceString'], line)&lt;br /&gt;
                    print line.rstrip()&lt;br /&gt;
                return mutation_line_number&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    class AndOr(Strategy):&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            Strategy.__init__(self)&lt;br /&gt;
            self._replace_strategy = {&lt;br /&gt;
                'regex': r'\s&amp;amp;&amp;amp;\s',&lt;br /&gt;
                'replaceString': ' || '&lt;br /&gt;
            }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    class IfTrue(Strategy):&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            Strategy.__init__(self)&lt;br /&gt;
            self._replace_strategy = {&lt;br /&gt;
                'regex': r'(?&amp;lt;=if\s)(.*)(?=\s\{)',&lt;br /&gt;
                'replaceString': 'true'&lt;br /&gt;
            }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    class IfFalse(Strategy):&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            Strategy.__init__(self)&lt;br /&gt;
            self._replace_strategy = {&lt;br /&gt;
                'regex': r'(?&amp;lt;=if\s)(.*)(?=\s\{)',&lt;br /&gt;
                'replaceString': 'false'&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
The project is about writing a python script to change the source code and run tests. It does not add any functionality to Servo. So there is no scope for testing in this project.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://www.guru99.com/mutation-testing.html&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://github.com/servo/servo&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo/wiki/Mutation-testing-project&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sdhegde</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Mutation_testing.jpg&amp;diff=114581</id>
		<title>File:Mutation testing.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Mutation_testing.jpg&amp;diff=114581"/>
		<updated>2017-12-07T01:28:58Z</updated>

		<summary type="html">&lt;p&gt;Sdhegde: Control flow diagram - mutation testing&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Control flow diagram - mutation testing&lt;/div&gt;</summary>
		<author><name>Sdhegde</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=114580</id>
		<title>CSC/ECE 517 Fall 2017/M1754 Mutation Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=114580"/>
		<updated>2017-12-07T01:27:07Z</updated>

		<summary type="html">&lt;p&gt;Sdhegde: /* Strategy Design Pattern */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Servo uses the Web Platform Test (WPT) suite for testing, but does not perform an evaluation of the breadth of the tests. The goal of this project is to use techniques from mutation testing to evaluate the performance of the WPT suite when bugs are deliberately introduced into the code base. &lt;br /&gt;
&lt;br /&gt;
The implementation of this project was done by writing python scripts that would modify the source code to generate mutants and run tests on them expecting failures. The scripts would temporarily modify the source codes, call the corresponding tests and revert back to the original code by reversing the changes that were made earlier. This process was repeated for multiple iterations by modifying various parts of the source code in random order.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use. [https://servo.org Servo] is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks. [https://en.wikipedia.org/wiki/Servo_(layout_engine)]&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://doc.rust-lang.org/book/second-edition/ Rust] is an open source,  systems programming language sponsored by Mozilla Research. Rust performs the majority of its safety checks and memory management decisions at compile time, so that program’s runtime performance is not impacted. Making it useful in programs with predictable space and time requirements, embedding in other languages, and writing low-level code, like device drivers and operating systems.&lt;br /&gt;
&lt;br /&gt;
===Web-platform-tests===&lt;br /&gt;
The [https://github.com/w3c/web-platform-tests web-platform-tests Project] is a W3C-coordinated attempt to build a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This, in turn, gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.&lt;br /&gt;
&lt;br /&gt;
===Mutation Testing===&lt;br /&gt;
Mutation Testing is a type of software testing where we mutate (change) certain statements in the source code and check if the test cases are able to find the errors.The goal of Mutation Testing is to assess the quality of the test cases which should be robust enough to fail mutant code. This method is also called as a Fault-based testing strategy as it involves creating faults in the program.Faults are introduced into the source code of the program by creating many versions called mutants. Each mutant should contain a single fault, and the goal is to cause the mutant version to fail which demonstrates the effectiveness of the test cases.[https://www.guru99.com/mutation-testing.html ]&lt;br /&gt;
&lt;br /&gt;
=='''Project description'''==&lt;br /&gt;
===Environment Setup===&lt;br /&gt;
* Clone the repository from [https://github.com/dsandeephegde/servo link]&lt;br /&gt;
* The steps to set up the environment for different OS are mentioned in readme file [https://github.com/servo/servo link].&lt;br /&gt;
&lt;br /&gt;
====Install packages==== &lt;br /&gt;
&lt;br /&gt;
Example, In OSX(homebrew):&lt;br /&gt;
&lt;br /&gt;
 brew install automake pkg-config python cmake yasm&lt;br /&gt;
 pip install virtualenv&lt;br /&gt;
&lt;br /&gt;
====Running test after setup====&lt;br /&gt;
&lt;br /&gt;
After the setup, make sure that everything works in your machine by building and running tests.&lt;br /&gt;
&lt;br /&gt;
build in release mode:&lt;br /&gt;
&lt;br /&gt;
 ./mach build --release&lt;br /&gt;
&lt;br /&gt;
run WPT tests:&lt;br /&gt;
&lt;br /&gt;
 ./mach test -wpt --release&lt;br /&gt;
&lt;br /&gt;
===Initial steps===&lt;br /&gt;
&lt;br /&gt;
*Implemented a simple mutator as a Python script that finds random uses of &amp;amp;&amp;amp; in Servo's code base and replaces them by ||.&lt;br /&gt;
*Built the mutated implementation of Servo with ./mach build -r and run it on the WPT test suite with ./mach test-wpt:  This produced test failures.&lt;br /&gt;
*Introduced test mapping framework to map source files to WPT test.&lt;br /&gt;
*Optimized the number of test runs by using test mapping to run only relevant tests for a mutant.&lt;br /&gt;
*Automated this process by writing scripts in a new python/servo/mutation directory, and called them from scripts in /etc/ci.&lt;br /&gt;
* Mutation test can be ran using either of the following command from the servo directory:&lt;br /&gt;
&lt;br /&gt;
 python python/servo/mutation/init.py components/script/dom&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 python etc/ci/mutation_test.py&lt;br /&gt;
&lt;br /&gt;
===Subsequent steps===&lt;br /&gt;
&lt;br /&gt;
* implement mutations like replacing if statements by if true/if false, duplicating statements, reordering statements, changing arithmetic &amp;amp; atomic string constant.&lt;br /&gt;
* improving the performance of the testing, for example randomizing the test order, fast-failing, running tests with faster builds (e.g. ./mach build -d).&lt;br /&gt;
* find heuristics for identifying false positives, that is mutations which are expected to have no effect, for example removing logging.&lt;br /&gt;
* find search heuristics for identifying mutations that cause no test failures.&lt;br /&gt;
&lt;br /&gt;
===Existing Mutation Strategy===&lt;br /&gt;
&lt;br /&gt;
* Replace random occurrence of &amp;amp;&amp;amp; with ||&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
Before Mutation:&lt;br /&gt;
    if a &amp;amp;&amp;amp; b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
After Mutation:&lt;br /&gt;
    if a || b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
This will produce a bug. When a is true and b is false also when a is false and b is true the value of c will be wrong. If our WPT test catches this bug then we can say mutant is killed. Otherwise mutant has lived.&lt;br /&gt;
&lt;br /&gt;
===Mutation Strategies===&lt;br /&gt;
There will be many strategies to mutate a file, like the existing one. And the strategies will be picked randomly during the execution of the program.&lt;br /&gt;
Some of the strategies are:&lt;br /&gt;
* Replace &amp;amp;&amp;amp; to ||&lt;br /&gt;
* Make 'if condition' to 'if true'&lt;br /&gt;
* Make 'if condition' to 'if false'&lt;br /&gt;
* Re-order statements&lt;br /&gt;
* Duplicate statements&lt;br /&gt;
* Change arithmetic operations.&lt;br /&gt;
&lt;br /&gt;
===Mutation Strategy Examples===&lt;br /&gt;
* The example for this strategy has already been mentioned in the [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/M1754_Mutation_Testing#Existing_Mutation_Strategy Existing Mutation Strategy] section.&lt;br /&gt;
* Make 'if condition' to 'if true'&lt;br /&gt;
Example:&lt;br /&gt;
Before Mutation:&lt;br /&gt;
&lt;br /&gt;
    if a == 0 &lt;br /&gt;
    {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
After Mutation:&lt;br /&gt;
&lt;br /&gt;
    if true &lt;br /&gt;
    {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    }&lt;br /&gt;
* Make 'if condition' to 'if false' &lt;br /&gt;
Example:&lt;br /&gt;
Before Mutation:&lt;br /&gt;
&lt;br /&gt;
    if a == 0 &lt;br /&gt;
    {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After Mutation:&lt;br /&gt;
&lt;br /&gt;
    if false&lt;br /&gt;
    {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    }&lt;br /&gt;
* Re-order statements&lt;br /&gt;
Example:&lt;br /&gt;
Before Mutation:&lt;br /&gt;
&lt;br /&gt;
    int a=6, b=11;&lt;br /&gt;
    float c,d;&lt;br /&gt;
    c= a/b;&lt;br /&gt;
    d= c/a;&lt;br /&gt;
&lt;br /&gt;
After Mutation:&lt;br /&gt;
    int a=6, b=11;&lt;br /&gt;
    float c,d;&lt;br /&gt;
    d= c/a;&lt;br /&gt;
    c= a/b;&lt;br /&gt;
&lt;br /&gt;
* Duplicate statements&lt;br /&gt;
Before Mutation:&lt;br /&gt;
    for (i=0;i&amp;lt;5;i++)&lt;br /&gt;
    {&lt;br /&gt;
     counter++;&lt;br /&gt;
    }&lt;br /&gt;
    if (counter%2==0)&lt;br /&gt;
    {&lt;br /&gt;
     x=x+y;&lt;br /&gt;
    }&lt;br /&gt;
After Mutation:&lt;br /&gt;
&lt;br /&gt;
    for (i=0;i&amp;lt;5;i++)&lt;br /&gt;
    {&lt;br /&gt;
     counter++;&lt;br /&gt;
     counter++;&lt;br /&gt;
    }&lt;br /&gt;
    if (counter%2==0)&lt;br /&gt;
    {&lt;br /&gt;
     x=x+y;&lt;br /&gt;
    }&lt;br /&gt;
* Change arithmetic operations. &lt;br /&gt;
Before Mutation:&lt;br /&gt;
    &lt;br /&gt;
    if (counter%2==0)&lt;br /&gt;
    {&lt;br /&gt;
     x=x+y;&lt;br /&gt;
    }&lt;br /&gt;
After Mutation:&lt;br /&gt;
    &lt;br /&gt;
    if (counter%2==0)&lt;br /&gt;
    {&lt;br /&gt;
     x=x-y;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
===Excecution Flow===&lt;br /&gt;
&lt;br /&gt;
[[File:Oodd servo.png]]&lt;br /&gt;
&lt;br /&gt;
==Design Plan==&lt;br /&gt;
&lt;br /&gt;
===Strategy Design Pattern===&lt;br /&gt;
There are multiple strategies for mutating a file. Each strategy has the implementation of its strategy in the mutate_line method. The Mutator picks up random strategy during the execution of the program and mutates the file.&lt;br /&gt;
&lt;br /&gt;
[[File:UML_Mutation_Testing_(1).jpg]]&lt;br /&gt;
&lt;br /&gt;
===Code snippet===&lt;br /&gt;
&lt;br /&gt;
    class Mutator:&lt;br /&gt;
        def __init__(self, strategy):&lt;br /&gt;
            self._strategy = strategy&lt;br /&gt;
        def mutate(self, file_name):&lt;br /&gt;
            return self._strategy.mutate_random_line(file_name)&lt;br /&gt;
&lt;br /&gt;
    class Strategy:&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            self._replace_strategy = {}&lt;br /&gt;
    &lt;br /&gt;
        def mutate_random_line(self, file_name):&lt;br /&gt;
            line_numbers = []&lt;br /&gt;
            for line in fileinput.input(file_name):&lt;br /&gt;
                if re.search(self._replace_strategy['regex'], line):&lt;br /&gt;
                    line_numbers.append(fileinput.lineno())&lt;br /&gt;
            if len(line_numbers) == 0:&lt;br /&gt;
                return -1&lt;br /&gt;
            else:&lt;br /&gt;
                mutation_line_number = line_numbers[random.randint(0, len(line_numbers) - 1)]&lt;br /&gt;
                for line in fileinput.input(file_name, inplace=True):&lt;br /&gt;
                    if fileinput.lineno() == mutation_line_number:&lt;br /&gt;
                        line = re.sub(self._replace_strategy['regex'], self._replace_strategy['replaceString'], line)&lt;br /&gt;
                    print line.rstrip()&lt;br /&gt;
                return mutation_line_number&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    class AndOr(Strategy):&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            Strategy.__init__(self)&lt;br /&gt;
            self._replace_strategy = {&lt;br /&gt;
                'regex': r'\s&amp;amp;&amp;amp;\s',&lt;br /&gt;
                'replaceString': ' || '&lt;br /&gt;
            }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    class IfTrue(Strategy):&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            Strategy.__init__(self)&lt;br /&gt;
            self._replace_strategy = {&lt;br /&gt;
                'regex': r'(?&amp;lt;=if\s)(.*)(?=\s\{)',&lt;br /&gt;
                'replaceString': 'true'&lt;br /&gt;
            }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    class IfFalse(Strategy):&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            Strategy.__init__(self)&lt;br /&gt;
            self._replace_strategy = {&lt;br /&gt;
                'regex': r'(?&amp;lt;=if\s)(.*)(?=\s\{)',&lt;br /&gt;
                'replaceString': 'false'&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
The project is about writing a python script to change the source code and run tests. It does not add any functionality to Servo. So there is no scope for testing in this project.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://www.guru99.com/mutation-testing.html&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://github.com/servo/servo&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo/wiki/Mutation-testing-project&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sdhegde</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:UML_Mutation_Testing_(1).jpg&amp;diff=114579</id>
		<title>File:UML Mutation Testing (1).jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:UML_Mutation_Testing_(1).jpg&amp;diff=114579"/>
		<updated>2017-12-07T01:26:12Z</updated>

		<summary type="html">&lt;p&gt;Sdhegde: UML diagram of strategy pattern&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;UML diagram of strategy pattern&lt;/div&gt;</summary>
		<author><name>Sdhegde</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=113166</id>
		<title>CSC/ECE 517 Fall 2017/M1754 Mutation Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=113166"/>
		<updated>2017-11-14T03:03:13Z</updated>

		<summary type="html">&lt;p&gt;Sdhegde: /* Design Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Servo uses the Web Platform Test (WPT) suite for testing, but does not perform an evaluation of the breadth of the tests. The goal of this project is to use techniques from mutation testing to evaluate the performance of the WPT suite when bugs are deliberately introduced into the code base. &lt;br /&gt;
&lt;br /&gt;
The implementation of this project was done by writing python scripts that would modify the source code to generate mutants and run tests on them expecting failures. The scripts would temporarily modify the source codes, call the corresponding tests and revert back to the original code by reversing the changes that were made earlier. This process was repeated for multiple iterations by modifying various parts of the source code in random order.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use. [https://servo.org Servo] is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks. [https://en.wikipedia.org/wiki/Servo_(layout_engine)]&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://doc.rust-lang.org/book/second-edition/ Rust] is an open source,  systems programming language sponsored by Mozilla Research. Rust performs the majority of its safety checks and memory management decisions at compile time, so that program’s runtime performance is not impacted. Making it useful in programs with predictable space and time requirements, embedding in other languages, and writing low-level code, like device drivers and operating systems.&lt;br /&gt;
&lt;br /&gt;
===Web-platform-tests===&lt;br /&gt;
The [https://github.com/w3c/web-platform-tests web-platform-tests Project] is a W3C-coordinated attempt to build a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This, in turn, gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.&lt;br /&gt;
&lt;br /&gt;
===Mutation Testing===&lt;br /&gt;
Mutation Testing is a type of software testing where we mutate (change) certain statements in the source code and check if the test cases are able to find the errors.The goal of Mutation Testing is to assess the quality of the test cases which should be robust enough to fail mutant code. This method is also called as a Fault-based testing strategy as it involves creating faults in the program.Faults are introduced into the source code of the program by creating many versions called mutants. Each mutant should contain a single fault, and the goal is to cause the mutant version to fail which demonstrates the effectiveness of the test cases.[https://www.guru99.com/mutation-testing.html ]&lt;br /&gt;
&lt;br /&gt;
=='''Project description'''==&lt;br /&gt;
===Environment Setup===&lt;br /&gt;
* Clone the repository from [https://github.com/dsandeephegde/servo link]&lt;br /&gt;
* The steps to setup the environment for different OS are mentioned in readme file [https://github.com/servo/servo link].&lt;br /&gt;
&lt;br /&gt;
====Install packages==== &lt;br /&gt;
&lt;br /&gt;
Example, In OSX(homebrew):&lt;br /&gt;
&lt;br /&gt;
 brew install automake pkg-config python cmake yasm&lt;br /&gt;
 pip install virtualenv&lt;br /&gt;
&lt;br /&gt;
====Running test after setup====&lt;br /&gt;
&lt;br /&gt;
After the setup, make sure that everything works in your machine by building and running tests.&lt;br /&gt;
&lt;br /&gt;
build in release mode:&lt;br /&gt;
&lt;br /&gt;
 ./mach build --release&lt;br /&gt;
&lt;br /&gt;
run WPT tests:&lt;br /&gt;
&lt;br /&gt;
 ./mach test -wpt --release&lt;br /&gt;
&lt;br /&gt;
===Initial steps===&lt;br /&gt;
&lt;br /&gt;
*Implemented a simple mutator as a Python script that finds random uses of &amp;amp;&amp;amp; in Servo's code base and replaces them by ||.&lt;br /&gt;
*Built the mutated implementation of Servo with ./mach build -r and run it on the WPT test suite with ./mach test-wpt:  This produced test failures.&lt;br /&gt;
*Introduced test mapping framework to map source files to WPT test.&lt;br /&gt;
*Optimized the number of test runs by using test mapping to run only relevant tests for a mutant.&lt;br /&gt;
*Automated this process by writing scripts in a new python/servo/mutation directory, and called them from scripts in /etc/ci.&lt;br /&gt;
* Mutation test can be ran using either of the following command from the servo directory:&lt;br /&gt;
&lt;br /&gt;
 python python/servo/mutation/init.py components/script/dom&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 python etc/ci/mutation_test.py&lt;br /&gt;
&lt;br /&gt;
===Subsequent steps===&lt;br /&gt;
&lt;br /&gt;
* implement mutations like replacing if statements by if true/if false, duplicating statements, reordering statements, changing arithmetic &amp;amp; atomic string constant.&lt;br /&gt;
* improving the performance of the testing, for example randomizing the test order, fast-failing, running tests with faster builds (e.g. ./mach build -d).&lt;br /&gt;
* find heuristics for identifying false positives, that is mutations which are expected to have no effect, for example removing logging.&lt;br /&gt;
* find search heuristics for identifying mutations that cause no test failures.&lt;br /&gt;
&lt;br /&gt;
===Existing Mutation Strategy===&lt;br /&gt;
&lt;br /&gt;
* Replace random occurrence of &amp;amp;&amp;amp; with ||&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
    if a &amp;amp;&amp;amp; b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    if a || b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
This will produce a bug. When a is true and b is false also when a is false and b is true the value of c will be wrong. If our WPT test catches this bug then we can say mutant is killed. Otherwise mutant has lived.&lt;br /&gt;
&lt;br /&gt;
===Mutation Strategies===&lt;br /&gt;
There will be many strategies to mutate a file, like the existing one. And the strategies will be picked randomly during the execution of the program.&lt;br /&gt;
Some of the strategies are:&lt;br /&gt;
* Replace &amp;amp;&amp;amp; to ||&lt;br /&gt;
* Make 'if condition' to 'if true'&lt;br /&gt;
* Make 'if condition' to 'if false'&lt;br /&gt;
* Re-order statements&lt;br /&gt;
* Duplicate statements&lt;br /&gt;
* Change arithmetic operations.&lt;br /&gt;
&lt;br /&gt;
===Excecution Flow===&lt;br /&gt;
&lt;br /&gt;
[[File:Oodd servo.png]]&lt;br /&gt;
&lt;br /&gt;
==Design Plan==&lt;br /&gt;
&lt;br /&gt;
===Strategy Design Pattern===&lt;br /&gt;
There are multiple strategies for mutating a file. Each strategy has the implementation of its strategy in the mutate_line method. The Mutator picks up random strategy during the execution of the program and mutates the file.&lt;br /&gt;
&lt;br /&gt;
[[File:UML_Mutation_Testing.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Code snippet===&lt;br /&gt;
&lt;br /&gt;
    class Mutator:&lt;br /&gt;
        def __init__(self, strategy):&lt;br /&gt;
            self._strategy = strategy&lt;br /&gt;
        def mutate(self, file_name):&lt;br /&gt;
            return self._strategy.mutate_random_line(file_name)&lt;br /&gt;
&lt;br /&gt;
    class Strategy:&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            self._replace_strategy = {}&lt;br /&gt;
    &lt;br /&gt;
        def mutate_random_line(self, file_name):&lt;br /&gt;
            line_numbers = []&lt;br /&gt;
            for line in fileinput.input(file_name):&lt;br /&gt;
                if re.search(self._replace_strategy['regex'], line):&lt;br /&gt;
                    line_numbers.append(fileinput.lineno())&lt;br /&gt;
            if len(line_numbers) == 0:&lt;br /&gt;
                return -1&lt;br /&gt;
            else:&lt;br /&gt;
                mutation_line_number = line_numbers[random.randint(0, len(line_numbers) - 1)]&lt;br /&gt;
                for line in fileinput.input(file_name, inplace=True):&lt;br /&gt;
                    if fileinput.lineno() == mutation_line_number:&lt;br /&gt;
                        line = re.sub(self._replace_strategy['regex'], self._replace_strategy['replaceString'], line)&lt;br /&gt;
                    print line.rstrip()&lt;br /&gt;
                return mutation_line_number&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    class AndOr(Strategy):&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            Strategy.__init__(self)&lt;br /&gt;
            self._replace_strategy = {&lt;br /&gt;
                'regex': r'\s&amp;amp;&amp;amp;\s',&lt;br /&gt;
                'replaceString': ' || '&lt;br /&gt;
            }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    class IfTrue(Strategy):&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            Strategy.__init__(self)&lt;br /&gt;
            self._replace_strategy = {&lt;br /&gt;
                'regex': r'(?&amp;lt;=if\s)(.*)(?=\s\{)',&lt;br /&gt;
                'replaceString': 'true'&lt;br /&gt;
            }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    class IfFalse(Strategy):&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            Strategy.__init__(self)&lt;br /&gt;
            self._replace_strategy = {&lt;br /&gt;
                'regex': r'(?&amp;lt;=if\s)(.*)(?=\s\{)',&lt;br /&gt;
                'replaceString': 'false'&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
The project is about writing a python script to change the source code and run tests. It does not add any functionality to Servo. So there is no scope for testing in this project.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://www.guru99.com/mutation-testing.html&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://github.com/servo/servo&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo/wiki/Mutation-testing-project&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sdhegde</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=113165</id>
		<title>CSC/ECE 517 Fall 2017/M1754 Mutation Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=113165"/>
		<updated>2017-11-14T03:02:51Z</updated>

		<summary type="html">&lt;p&gt;Sdhegde: /* Design Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Servo uses the Web Platform Test (WPT) suite for testing, but does not perform an evaluation of the breadth of the tests. The goal of this project is to use techniques from mutation testing to evaluate the performance of the WPT suite when bugs are deliberately introduced into the code base. &lt;br /&gt;
&lt;br /&gt;
The implementation of this project was done by writing python scripts that would modify the source code to generate mutants and run tests on them expecting failures. The scripts would temporarily modify the source codes, call the corresponding tests and revert back to the original code by reversing the changes that were made earlier. This process was repeated for multiple iterations by modifying various parts of the source code in random order.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use. [https://servo.org Servo] is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks. [https://en.wikipedia.org/wiki/Servo_(layout_engine)]&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://doc.rust-lang.org/book/second-edition/ Rust] is an open source,  systems programming language sponsored by Mozilla Research. Rust performs the majority of its safety checks and memory management decisions at compile time, so that program’s runtime performance is not impacted. Making it useful in programs with predictable space and time requirements, embedding in other languages, and writing low-level code, like device drivers and operating systems.&lt;br /&gt;
&lt;br /&gt;
===Web-platform-tests===&lt;br /&gt;
The [https://github.com/w3c/web-platform-tests web-platform-tests Project] is a W3C-coordinated attempt to build a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This, in turn, gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.&lt;br /&gt;
&lt;br /&gt;
===Mutation Testing===&lt;br /&gt;
Mutation Testing is a type of software testing where we mutate (change) certain statements in the source code and check if the test cases are able to find the errors.The goal of Mutation Testing is to assess the quality of the test cases which should be robust enough to fail mutant code. This method is also called as a Fault-based testing strategy as it involves creating faults in the program.Faults are introduced into the source code of the program by creating many versions called mutants. Each mutant should contain a single fault, and the goal is to cause the mutant version to fail which demonstrates the effectiveness of the test cases.[https://www.guru99.com/mutation-testing.html ]&lt;br /&gt;
&lt;br /&gt;
=='''Project description'''==&lt;br /&gt;
===Environment Setup===&lt;br /&gt;
* Clone the repository from [https://github.com/dsandeephegde/servo link]&lt;br /&gt;
* The steps to setup the environment for different OS are mentioned in readme file [https://github.com/servo/servo link].&lt;br /&gt;
&lt;br /&gt;
====Install packages==== &lt;br /&gt;
&lt;br /&gt;
Example, In OSX(homebrew):&lt;br /&gt;
&lt;br /&gt;
 brew install automake pkg-config python cmake yasm&lt;br /&gt;
 pip install virtualenv&lt;br /&gt;
&lt;br /&gt;
====Running test after setup====&lt;br /&gt;
&lt;br /&gt;
After the setup, make sure that everything works in your machine by building and running tests.&lt;br /&gt;
&lt;br /&gt;
build in release mode:&lt;br /&gt;
&lt;br /&gt;
 ./mach build --release&lt;br /&gt;
&lt;br /&gt;
run WPT tests:&lt;br /&gt;
&lt;br /&gt;
 ./mach test -wpt --release&lt;br /&gt;
&lt;br /&gt;
===Initial steps===&lt;br /&gt;
&lt;br /&gt;
*Implemented a simple mutator as a Python script that finds random uses of &amp;amp;&amp;amp; in Servo's code base and replaces them by ||.&lt;br /&gt;
*Built the mutated implementation of Servo with ./mach build -r and run it on the WPT test suite with ./mach test-wpt:  This produced test failures.&lt;br /&gt;
*Introduced test mapping framework to map source files to WPT test.&lt;br /&gt;
*Optimized the number of test runs by using test mapping to run only relevant tests for a mutant.&lt;br /&gt;
*Automated this process by writing scripts in a new python/servo/mutation directory, and called them from scripts in /etc/ci.&lt;br /&gt;
* Mutation test can be ran using either of the following command from the servo directory:&lt;br /&gt;
&lt;br /&gt;
 python python/servo/mutation/init.py components/script/dom&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 python etc/ci/mutation_test.py&lt;br /&gt;
&lt;br /&gt;
===Subsequent steps===&lt;br /&gt;
&lt;br /&gt;
* implement mutations like replacing if statements by if true/if false, duplicating statements, reordering statements, changing arithmetic &amp;amp; atomic string constant.&lt;br /&gt;
* improving the performance of the testing, for example randomizing the test order, fast-failing, running tests with faster builds (e.g. ./mach build -d).&lt;br /&gt;
* find heuristics for identifying false positives, that is mutations which are expected to have no effect, for example removing logging.&lt;br /&gt;
* find search heuristics for identifying mutations that cause no test failures.&lt;br /&gt;
&lt;br /&gt;
===Existing Mutation Strategy===&lt;br /&gt;
&lt;br /&gt;
* Replace random occurrence of &amp;amp;&amp;amp; with ||&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
    if a &amp;amp;&amp;amp; b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    if a || b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
This will produce a bug. When a is true and b is false also when a is false and b is true the value of c will be wrong. If our WPT test catches this bug then we can say mutant is killed. Otherwise mutant has lived.&lt;br /&gt;
&lt;br /&gt;
===Mutation Strategies===&lt;br /&gt;
There will be many strategies to mutate a file, like the existing one. And the strategies will be picked randomly during the execution of the program.&lt;br /&gt;
Some of the strategies are:&lt;br /&gt;
* Replace &amp;amp;&amp;amp; to ||&lt;br /&gt;
* Make 'if condition' to 'if true'&lt;br /&gt;
* Make 'if condition' to 'if false'&lt;br /&gt;
* Re-order statements&lt;br /&gt;
* Duplicate statements&lt;br /&gt;
* Change arithmetic operations.&lt;br /&gt;
&lt;br /&gt;
===Excecution Flow===&lt;br /&gt;
&lt;br /&gt;
[[File:Oodd servo.png]]&lt;br /&gt;
&lt;br /&gt;
==Design Plan==&lt;br /&gt;
&lt;br /&gt;
===Strategy Design Pattern===&lt;br /&gt;
There are multiple strategies for mutating a file. Each strategy has the implementation of its strategy in the mutate_line method. The Mutator picks up random strategy during the execution of the program and mutates the file.&lt;br /&gt;
&lt;br /&gt;
[[File:UML_Mutation_Testing.jpg]]&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&lt;br /&gt;
    class Mutator:&lt;br /&gt;
        def __init__(self, strategy):&lt;br /&gt;
            self._strategy = strategy&lt;br /&gt;
        def mutate(self, file_name):&lt;br /&gt;
            return self._strategy.mutate_random_line(file_name)&lt;br /&gt;
&lt;br /&gt;
    class Strategy:&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            self._replace_strategy = {}&lt;br /&gt;
    &lt;br /&gt;
        def mutate_random_line(self, file_name):&lt;br /&gt;
            line_numbers = []&lt;br /&gt;
            for line in fileinput.input(file_name):&lt;br /&gt;
                if re.search(self._replace_strategy['regex'], line):&lt;br /&gt;
                    line_numbers.append(fileinput.lineno())&lt;br /&gt;
            if len(line_numbers) == 0:&lt;br /&gt;
                return -1&lt;br /&gt;
            else:&lt;br /&gt;
                mutation_line_number = line_numbers[random.randint(0, len(line_numbers) - 1)]&lt;br /&gt;
                for line in fileinput.input(file_name, inplace=True):&lt;br /&gt;
                    if fileinput.lineno() == mutation_line_number:&lt;br /&gt;
                        line = re.sub(self._replace_strategy['regex'], self._replace_strategy['replaceString'], line)&lt;br /&gt;
                    print line.rstrip()&lt;br /&gt;
                return mutation_line_number&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    class AndOr(Strategy):&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            Strategy.__init__(self)&lt;br /&gt;
            self._replace_strategy = {&lt;br /&gt;
                'regex': r'\s&amp;amp;&amp;amp;\s',&lt;br /&gt;
                'replaceString': ' || '&lt;br /&gt;
            }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    class IfTrue(Strategy):&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            Strategy.__init__(self)&lt;br /&gt;
            self._replace_strategy = {&lt;br /&gt;
                'regex': r'(?&amp;lt;=if\s)(.*)(?=\s\{)',&lt;br /&gt;
                'replaceString': 'true'&lt;br /&gt;
            }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    class IfFalse(Strategy):&lt;br /&gt;
        def __init__(self):&lt;br /&gt;
            Strategy.__init__(self)&lt;br /&gt;
            self._replace_strategy = {&lt;br /&gt;
                'regex': r'(?&amp;lt;=if\s)(.*)(?=\s\{)',&lt;br /&gt;
                'replaceString': 'false'&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
The project is about writing a python script to change the source code and run tests. It does not add any functionality to Servo. So there is no scope for testing in this project.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://www.guru99.com/mutation-testing.html&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://github.com/servo/servo&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo/wiki/Mutation-testing-project&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sdhegde</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112822</id>
		<title>CSC/ECE 517 Fall 2017/M1754 Mutation Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112822"/>
		<updated>2017-11-10T20:07:19Z</updated>

		<summary type="html">&lt;p&gt;Sdhegde: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Servo uses the Web Platform Test (WPT) suite for testing, but does not perform an evaluation of the breadth of the tests. The goal of this project is to use techniques from mutation testing to evaluate the performance of the WPT suite when bugs are deliberately introduced into the code base. &lt;br /&gt;
&lt;br /&gt;
The implementation of this project was done by writing python scripts that would modify the source code to generate mutants and run tests on them expecting failures. The scripts would temporarily modify the source codes, call the corresponding tests and revert back to the original code by reversing the changes that were made earlier. This process was repeated for multiple iterations by modifying various parts of the source code in random order.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use. [https://servo.org Servo] is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks. [https://en.wikipedia.org/wiki/Servo_(layout_engine)]&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://doc.rust-lang.org/book/second-edition/ Rust] is an open source,  systems programming language sponsored by Mozilla Research. Rust performs the majority of its safety checks and memory management decisions at compile time, so that program’s runtime performance is not impacted. Making it useful in programs with predictable space and time requirements, embedding in other languages, and writing low-level code, like device drivers and operating systems.&lt;br /&gt;
&lt;br /&gt;
===Web-platform-tests===&lt;br /&gt;
The [https://github.com/w3c/web-platform-tests web-platform-tests Project] is a W3C-coordinated attempt to build a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This, in turn, gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.&lt;br /&gt;
&lt;br /&gt;
===Mutation Testing===&lt;br /&gt;
Mutation Testing is a type of software testing where we mutate (change) certain statements in the source code and check if the test cases are able to find the errors.The goal of Mutation Testing is to assess the quality of the test cases which should be robust enough to fail mutant code. This method is also called as a Fault-based testing strategy as it involves creating faults in the program.Faults are introduced into the source code of the program by creating many versions called mutants. Each mutant should contain a single fault, and the goal is to cause the mutant version to fail which demonstrates the effectiveness of the test cases.[https://www.guru99.com/mutation-testing.html ]&lt;br /&gt;
&lt;br /&gt;
=='''Project description'''==&lt;br /&gt;
===Environment Setup===&lt;br /&gt;
* Clone the repository from [https://github.com/dsandeephegde/servo link]&lt;br /&gt;
* The steps to setup the environment for different OS are mentioned in readme file [https://github.com/servo/servo link].&lt;br /&gt;
&lt;br /&gt;
====Install packages==== &lt;br /&gt;
&lt;br /&gt;
Example, In OSX(homebrew):&lt;br /&gt;
&lt;br /&gt;
 brew install automake pkg-config python cmake yasm&lt;br /&gt;
 pip install virtualenv&lt;br /&gt;
&lt;br /&gt;
====Running test after setup====&lt;br /&gt;
&lt;br /&gt;
After the setup, make sure that everything works in your machine by building and running tests.&lt;br /&gt;
&lt;br /&gt;
build in release mode:&lt;br /&gt;
&lt;br /&gt;
 ./mach build --release&lt;br /&gt;
&lt;br /&gt;
run WPT tests:&lt;br /&gt;
&lt;br /&gt;
 ./mach test -wpt --release&lt;br /&gt;
&lt;br /&gt;
===Initial steps===&lt;br /&gt;
&lt;br /&gt;
*Implemented a simple mutator as a Python script that finds random uses of &amp;amp;&amp;amp; in Servo's code base and replaces them by ||.&lt;br /&gt;
*Built the mutated implementation of Servo with ./mach build -r and run it on the WPT test suite with ./mach test-wpt:  This produced test failures.&lt;br /&gt;
*Introduced test mapping framework to map source files to WPT test.&lt;br /&gt;
*Optimized the number of test runs by using test mapping to run only relevant tests for a mutant.&lt;br /&gt;
*Automated this process by writing scripts in a new python/servo/mutation directory, and called them from scripts in /etc/ci.&lt;br /&gt;
* Mutation test can be ran using either of the following command from the servo directory:&lt;br /&gt;
&lt;br /&gt;
 python python/servo/mutation/init.py components/script/dom&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 python etc/ci/mutation_test.py&lt;br /&gt;
&lt;br /&gt;
===Subsequent steps===&lt;br /&gt;
&lt;br /&gt;
* implement mutations like replacing if statements by if true/if false, duplicating statements, reordering statements, changing arithmetic &amp;amp; atomic string constant.&lt;br /&gt;
* improving the performance of the testing, for example randomizing the test order, fast-failing, running tests with faster builds (e.g. ./mach build -d).&lt;br /&gt;
* find heuristics for identifying false positives, that is mutations which are expected to have no effect, for example removing logging.&lt;br /&gt;
* find search heuristics for identifying mutations that cause no test failures.&lt;br /&gt;
&lt;br /&gt;
===Existing Mutation Strategy===&lt;br /&gt;
&lt;br /&gt;
* Replace random occurrence of &amp;amp;&amp;amp; with ||&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
    if a &amp;amp;&amp;amp; b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    if a || b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
This will produce a bug. When a is true and b is false also when a is false and b is true the value of c will be wrong. If our WPT test catches this bug then we can say mutant is killed. Otherwise mutant has lived.&lt;br /&gt;
&lt;br /&gt;
===Mutation Strategies===&lt;br /&gt;
There will be many strategies to mutate a file, like the existing one. And the strategies will be picked randomly during the execution of the program.&lt;br /&gt;
Some of the strategies are:&lt;br /&gt;
* Replace &amp;amp;&amp;amp; to ||&lt;br /&gt;
* Make 'if condition' to 'if true'&lt;br /&gt;
* Make 'if condition' to 'if false'&lt;br /&gt;
* Re-order statements&lt;br /&gt;
* Duplicate statements&lt;br /&gt;
* Change arithmetic operations.&lt;br /&gt;
&lt;br /&gt;
===Excecution Flow===&lt;br /&gt;
&lt;br /&gt;
[[File:Oodd servo.png]]&lt;br /&gt;
&lt;br /&gt;
==Design Plan==&lt;br /&gt;
&lt;br /&gt;
===Strategy Design Pattern===&lt;br /&gt;
There are multiple strategies for mutating a file. Each strategy has the implementation of its strategy in the mutate_line method. The Mutator picks up random strategy during the execution of the program and mutates the file.&lt;br /&gt;
&lt;br /&gt;
[[File:UML_Mutation_Testing.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
The project is about writing a python script to change the source code and run tests. It does not add any functionality to Servo. So there is no scope for testing in this project.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://www.guru99.com/mutation-testing.html&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://github.com/servo/servo&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo/wiki/Mutation-testing-project&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sdhegde</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112821</id>
		<title>CSC/ECE 517 Fall 2017/M1754 Mutation Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112821"/>
		<updated>2017-11-10T20:07:04Z</updated>

		<summary type="html">&lt;p&gt;Sdhegde: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Servo uses the Web Platform Test (WPT) suite for testing, but does not perform an evaluation of the breadth of the tests. The goal of this project is to use techniques from mutation testing to evaluate the performance of the WPT suite when bugs are deliberately introduced into the code base. &lt;br /&gt;
&lt;br /&gt;
The implementation of this project was done by writing python scripts that would modify the source code to generate mutants and run tests on them expecting failures. The scripts would temporarily modify the source codes, call the corresponding tests and revert back to the original code by reversing the changes that were made earlier. This process was repeated for multiple iterations by modifying various parts of the source code in random order.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use. [https://servo.org Servo] is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks. [https://en.wikipedia.org/wiki/Servo_(layout_engine)]&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://doc.rust-lang.org/book/second-edition/ Rust] is an open source,  systems programming language sponsored by Mozilla Research. Rust performs the majority of its safety checks and memory management decisions at compile time, so that program’s runtime performance is not impacted. Making it useful in programs with predictable space and time requirements, embedding in other languages, and writing low-level code, like device drivers and operating systems.&lt;br /&gt;
&lt;br /&gt;
===Web-platform-tests===&lt;br /&gt;
The [https://github.com/w3c/web-platform-tests web-platform-tests Project] is a W3C-coordinated attempt to build a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This, in turn, gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.&lt;br /&gt;
&lt;br /&gt;
===Mutation Testing===&lt;br /&gt;
Mutation Testing is a type of software testing where we mutate (change) certain statements in the source code and check if the test cases are able to find the errors.The goal of Mutation Testing is to assess the quality of the test cases which should be robust enough to fail mutant code. This method is also called as a Fault-based testing strategy as it involves creating faults in the program.Faults are introduced into the source code of the program by creating many versions called mutants. Each mutant should contain a single fault, and the goal is to cause the mutant version to fail which demonstrates the effectiveness of the test cases.[https://www.guru99.com/mutation-testing.html ]&lt;br /&gt;
&lt;br /&gt;
=='''Project description'''==&lt;br /&gt;
===Environment Setup===&lt;br /&gt;
* Clone the repository from [https://github.com/dsandeephegde/servo link]&lt;br /&gt;
* The steps to setup the environment for different OS are mentioned in readme file [https://github.com/servo/servo link].&lt;br /&gt;
&lt;br /&gt;
====Install packages==== &lt;br /&gt;
&lt;br /&gt;
Example, In OSX(homebrew):&lt;br /&gt;
&lt;br /&gt;
 brew install automake pkg-config python cmake yasm&lt;br /&gt;
 pip install virtualenv&lt;br /&gt;
&lt;br /&gt;
====Running test after setup====&lt;br /&gt;
&lt;br /&gt;
After the setup, make sure that everything works in your machine by building and running tests.&lt;br /&gt;
&lt;br /&gt;
build in release mode:&lt;br /&gt;
&lt;br /&gt;
 ./mach build --release&lt;br /&gt;
&lt;br /&gt;
run WPT tests:&lt;br /&gt;
&lt;br /&gt;
 ./mach test -wpt --release&lt;br /&gt;
&lt;br /&gt;
===Initial steps===&lt;br /&gt;
&lt;br /&gt;
*Implemented a simple mutator as a Python script that finds random uses of &amp;amp;&amp;amp; in Servo's code base and replaces them by ||.&lt;br /&gt;
*Built the mutated implementation of Servo with ./mach build -r and run it on the WPT test suite with ./mach test-wpt:  This produced test failures.&lt;br /&gt;
*Introduced test mapping framework to map source files to WPT test.&lt;br /&gt;
*Optimized the number of test runs by using test mapping to run only relevant tests for a mutant.&lt;br /&gt;
*Automated this process by writing scripts in a new python/servo/mutation directory, and called them from scripts in /etc/ci.&lt;br /&gt;
* Mutation test can be ran using either of the following command from the servo directory:&lt;br /&gt;
&lt;br /&gt;
 python python/servo/mutation/init.py components/script/dom&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 python etc/ci/mutation_test.py&lt;br /&gt;
&lt;br /&gt;
===Subsequent steps===&lt;br /&gt;
&lt;br /&gt;
* implement mutations like replacing if statements by if true/if false, duplicating statements, reordering statements, changing arithmetic &amp;amp; atomic string constant.&lt;br /&gt;
* improving the performance of the testing, for example randomizing the test order, fast-failing, running tests with faster builds (e.g. ./mach build -d).&lt;br /&gt;
* find heuristics for identifying false positives, that is mutations which are expected to have no effect, for example removing logging.&lt;br /&gt;
* find search heuristics for identifying mutations that cause no test failures.&lt;br /&gt;
&lt;br /&gt;
===Existing Mutation Strategy===&lt;br /&gt;
&lt;br /&gt;
* Replace random occurrence of &amp;amp;&amp;amp; with ||&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
    if a &amp;amp;&amp;amp; b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    if a || b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
This will produce a bug. When a is true and b is false also when a is false and b is true the value of c will be wrong. If our WPT test catches this bug then we can say mutant is killed. Otherwise mutant has lived.&lt;br /&gt;
&lt;br /&gt;
===Mutation Strategies===&lt;br /&gt;
There will be many strategies to mutate a file, like the existing one. And the strategies will be picked randomly during the execution of the program.&lt;br /&gt;
Some of the strategies are:&lt;br /&gt;
* Replace &amp;amp;&amp;amp; to ||&lt;br /&gt;
* Make 'if condition' to 'if true'&lt;br /&gt;
* Make 'if condition' to 'if false'&lt;br /&gt;
* Re-order statements&lt;br /&gt;
* Duplicate statements&lt;br /&gt;
* Change arithmetic operations.&lt;br /&gt;
&lt;br /&gt;
===Excecution Flow===&lt;br /&gt;
&lt;br /&gt;
[[File:Oodd servo.png]]&lt;br /&gt;
&lt;br /&gt;
==Design Plan==&lt;br /&gt;
&lt;br /&gt;
===Strategy Design Pattern===&lt;br /&gt;
There are multiple strategies for mutating a file. Each strategy has the implementation of its strategy in the mutate_line method. The Mutator picks up random strategy during the execution of the program and mutates the file.&lt;br /&gt;
&lt;br /&gt;
[[File:UML_Mutation_Testing.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
&lt;br /&gt;
The project is about writing a python script to change the source code and run tests. It does not add any functionality to Servo. So there is no scope for testing in this project.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://www.guru99.com/mutation-testing.html&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://github.com/servo/servo&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo/wiki/Mutation-testing-project&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sdhegde</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112758</id>
		<title>CSC/ECE 517 Fall 2017/M1754 Mutation Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112758"/>
		<updated>2017-11-09T17:48:11Z</updated>

		<summary type="html">&lt;p&gt;Sdhegde: /* Mutation Strategies */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Servo uses the Web Platform Test (WPT) suite for testing, but does not perform an evaluation of the breadth of the tests. The goal of this project is to use techniques from mutation testing to evaluate the performance of the WPT suite when bugs are deliberately introduced into the code base. &lt;br /&gt;
&lt;br /&gt;
The implementation of this project was done by writing python scripts that would modify the source code to generate mutants and run tests on them expecting failures. The scripts would temporarily modify the source codes, call the corresponding tests and revert back to the original code by reversing the changes that were made earlier. This process was repeated for multiple iterations by modifying various parts of the source code in random order.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use. [https://servo.org Servo] is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks. [https://en.wikipedia.org/wiki/Servo_(layout_engine)]&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://doc.rust-lang.org/book/second-edition/ Rust] is an open source,  systems programming language sponsored by Mozilla Research. Rust performs the majority of its safety checks and memory management decisions at compile time, so that program’s runtime performance is not impacted. Making it useful in programs with predictable space and time requirements, embedding in other languages, and writing low-level code, like device drivers and operating systems.&lt;br /&gt;
&lt;br /&gt;
===Web-platform-tests===&lt;br /&gt;
The [https://github.com/w3c/web-platform-tests web-platform-tests Project] is a W3C-coordinated attempt to build a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This, in turn, gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.&lt;br /&gt;
&lt;br /&gt;
===Mutation Testing===&lt;br /&gt;
Mutation Testing is a type of software testing where we mutate (change) certain statements in the source code and check if the test cases are able to find the errors.The goal of Mutation Testing is to assess the quality of the test cases which should be robust enough to fail mutant code. This method is also called as a Fault-based testing strategy as it involves creating faults in the program.Faults are introduced into the source code of the program by creating many versions called mutants. Each mutant should contain a single fault, and the goal is to cause the mutant version to fail which demonstrates the effectiveness of the test cases.[https://www.guru99.com/mutation-testing.html ]&lt;br /&gt;
&lt;br /&gt;
=='''Project description'''==&lt;br /&gt;
===Environment Setup===&lt;br /&gt;
* Clone the repository from [https://github.com/dsandeephegde/servo link]&lt;br /&gt;
* The steps to setup the environment for different OS are mentioned in readme file [https://github.com/servo/servo link].&lt;br /&gt;
&lt;br /&gt;
====Install packages==== &lt;br /&gt;
&lt;br /&gt;
Example, In OSX(homebrew):&lt;br /&gt;
&lt;br /&gt;
 brew install automake pkg-config python cmake yasm&lt;br /&gt;
 pip install virtualenv&lt;br /&gt;
&lt;br /&gt;
====Running test after setup====&lt;br /&gt;
&lt;br /&gt;
After the setup, make sure that everything works in your machine by building and running tests.&lt;br /&gt;
&lt;br /&gt;
build in release mode:&lt;br /&gt;
&lt;br /&gt;
 ./mach build --release&lt;br /&gt;
&lt;br /&gt;
run WPT tests:&lt;br /&gt;
&lt;br /&gt;
 ./mach test -wpt --release&lt;br /&gt;
&lt;br /&gt;
===Initial steps===&lt;br /&gt;
&lt;br /&gt;
*Implemented a simple mutator as a Python script that finds random uses of &amp;amp;&amp;amp; in Servo's code base and replaces them by ||.&lt;br /&gt;
*Built the mutated implementation of Servo with ./mach build -r and run it on the WPT test suite with ./mach test-wpt:  This produced test failures.&lt;br /&gt;
*Introduced test mapping framework to map source files to WPT test.&lt;br /&gt;
*Optimized the number of test runs by using test mapping to run only relevant tests for a mutant.&lt;br /&gt;
*Automated this process by writing scripts in a new python/servo/mutation directory, and called them from scripts in /etc/ci.&lt;br /&gt;
* Mutation test can be ran using either of the following command from the servo directory:&lt;br /&gt;
&lt;br /&gt;
 python python/servo/mutation/init.py components/script/dom&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 python etc/ci/mutation_test.py&lt;br /&gt;
&lt;br /&gt;
===Subsequent steps===&lt;br /&gt;
&lt;br /&gt;
* implement mutations like replacing if statements by if true/if false, duplicating statements, reordering statements, changing arithmetic &amp;amp; atomic string constant.&lt;br /&gt;
* improving the performance of the testing, for example randomizing the test order, fast-failing, running tests with faster builds (e.g. ./mach build -d).&lt;br /&gt;
* find heuristics for identifying false positives, that is mutations which are expected to have no effect, for example removing logging.&lt;br /&gt;
* find search heuristics for identifying mutations that cause no test failures.&lt;br /&gt;
&lt;br /&gt;
===Existing Mutation Strategy===&lt;br /&gt;
&lt;br /&gt;
* Replace random occurrence of &amp;amp;&amp;amp; with ||&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
    if a &amp;amp;&amp;amp; b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    if a || b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
This will produce a bug. When a is true and b is false also when a is false and b is true the value of c will be wrong. If our WPT test catches this bug then we can say mutant is killed. Otherwise mutant has lived.&lt;br /&gt;
&lt;br /&gt;
===Mutation Strategies===&lt;br /&gt;
There will be many strategies to mutate a file, like the existing one. And the strategies will be picked randomly during the execution of the program.&lt;br /&gt;
Some of the strategies are:&lt;br /&gt;
* Replace &amp;amp;&amp;amp; to ||&lt;br /&gt;
* Make 'if condition' to 'if true'&lt;br /&gt;
* Make 'if condition' to 'if false'&lt;br /&gt;
* Re-order statements&lt;br /&gt;
* Duplicate statements&lt;br /&gt;
* Change arithmetic operations.&lt;br /&gt;
&lt;br /&gt;
===Excecution Flow===&lt;br /&gt;
&lt;br /&gt;
[[File:Oodd servo.png]]&lt;br /&gt;
&lt;br /&gt;
===Design Pattern===&lt;br /&gt;
&lt;br /&gt;
====Strategy Design Pattern====&lt;br /&gt;
There are multiple strategies for mutating a file. Each strategy has the implementation of its strategy in the mutate_line method. The Mutator picks up random strategy during the execution of the program and mutates the file.&lt;br /&gt;
&lt;br /&gt;
[[File:UML_Mutation_Testing.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
&lt;br /&gt;
The project is about writing a python script to change the source code and run tests. It does not add any functionality to Servo. So there is no scope for testing in this project.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://www.guru99.com/mutation-testing.html&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://github.com/servo/servo&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo/wiki/Mutation-testing-project&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sdhegde</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112757</id>
		<title>CSC/ECE 517 Fall 2017/M1754 Mutation Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112757"/>
		<updated>2017-11-09T17:47:50Z</updated>

		<summary type="html">&lt;p&gt;Sdhegde: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Servo uses the Web Platform Test (WPT) suite for testing, but does not perform an evaluation of the breadth of the tests. The goal of this project is to use techniques from mutation testing to evaluate the performance of the WPT suite when bugs are deliberately introduced into the code base. &lt;br /&gt;
&lt;br /&gt;
The implementation of this project was done by writing python scripts that would modify the source code to generate mutants and run tests on them expecting failures. The scripts would temporarily modify the source codes, call the corresponding tests and revert back to the original code by reversing the changes that were made earlier. This process was repeated for multiple iterations by modifying various parts of the source code in random order.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use. [https://servo.org Servo] is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks. [https://en.wikipedia.org/wiki/Servo_(layout_engine)]&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://doc.rust-lang.org/book/second-edition/ Rust] is an open source,  systems programming language sponsored by Mozilla Research. Rust performs the majority of its safety checks and memory management decisions at compile time, so that program’s runtime performance is not impacted. Making it useful in programs with predictable space and time requirements, embedding in other languages, and writing low-level code, like device drivers and operating systems.&lt;br /&gt;
&lt;br /&gt;
===Web-platform-tests===&lt;br /&gt;
The [https://github.com/w3c/web-platform-tests web-platform-tests Project] is a W3C-coordinated attempt to build a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This, in turn, gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.&lt;br /&gt;
&lt;br /&gt;
===Mutation Testing===&lt;br /&gt;
Mutation Testing is a type of software testing where we mutate (change) certain statements in the source code and check if the test cases are able to find the errors.The goal of Mutation Testing is to assess the quality of the test cases which should be robust enough to fail mutant code. This method is also called as a Fault-based testing strategy as it involves creating faults in the program.Faults are introduced into the source code of the program by creating many versions called mutants. Each mutant should contain a single fault, and the goal is to cause the mutant version to fail which demonstrates the effectiveness of the test cases.[https://www.guru99.com/mutation-testing.html ]&lt;br /&gt;
&lt;br /&gt;
=='''Project description'''==&lt;br /&gt;
===Environment Setup===&lt;br /&gt;
* Clone the repository from [https://github.com/dsandeephegde/servo link]&lt;br /&gt;
* The steps to setup the environment for different OS are mentioned in readme file [https://github.com/servo/servo link].&lt;br /&gt;
&lt;br /&gt;
====Install packages==== &lt;br /&gt;
&lt;br /&gt;
Example, In OSX(homebrew):&lt;br /&gt;
&lt;br /&gt;
 brew install automake pkg-config python cmake yasm&lt;br /&gt;
 pip install virtualenv&lt;br /&gt;
&lt;br /&gt;
====Running test after setup====&lt;br /&gt;
&lt;br /&gt;
After the setup, make sure that everything works in your machine by building and running tests.&lt;br /&gt;
&lt;br /&gt;
build in release mode:&lt;br /&gt;
&lt;br /&gt;
 ./mach build --release&lt;br /&gt;
&lt;br /&gt;
run WPT tests:&lt;br /&gt;
&lt;br /&gt;
 ./mach test -wpt --release&lt;br /&gt;
&lt;br /&gt;
===Initial steps===&lt;br /&gt;
&lt;br /&gt;
*Implemented a simple mutator as a Python script that finds random uses of &amp;amp;&amp;amp; in Servo's code base and replaces them by ||.&lt;br /&gt;
*Built the mutated implementation of Servo with ./mach build -r and run it on the WPT test suite with ./mach test-wpt:  This produced test failures.&lt;br /&gt;
*Introduced test mapping framework to map source files to WPT test.&lt;br /&gt;
*Optimized the number of test runs by using test mapping to run only relevant tests for a mutant.&lt;br /&gt;
*Automated this process by writing scripts in a new python/servo/mutation directory, and called them from scripts in /etc/ci.&lt;br /&gt;
* Mutation test can be ran using either of the following command from the servo directory:&lt;br /&gt;
&lt;br /&gt;
 python python/servo/mutation/init.py components/script/dom&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 python etc/ci/mutation_test.py&lt;br /&gt;
&lt;br /&gt;
===Subsequent steps===&lt;br /&gt;
&lt;br /&gt;
* implement mutations like replacing if statements by if true/if false, duplicating statements, reordering statements, changing arithmetic &amp;amp; atomic string constant.&lt;br /&gt;
* improving the performance of the testing, for example randomizing the test order, fast-failing, running tests with faster builds (e.g. ./mach build -d).&lt;br /&gt;
* find heuristics for identifying false positives, that is mutations which are expected to have no effect, for example removing logging.&lt;br /&gt;
* find search heuristics for identifying mutations that cause no test failures.&lt;br /&gt;
&lt;br /&gt;
===Existing Mutation Strategy===&lt;br /&gt;
&lt;br /&gt;
* Replace random occurrence of &amp;amp;&amp;amp; with ||&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
    if a &amp;amp;&amp;amp; b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    if a || b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
This will produce a bug. When a is true and b is false also when a is false and b is true the value of c will be wrong. If our WPT test catches this bug then we can say mutant is killed. Otherwise mutant has lived.&lt;br /&gt;
&lt;br /&gt;
===Mutation Strategies===&lt;br /&gt;
There will be many strategies to mutate a file, like existing one. And the strategies will be picked randomly during the execution of the program.&lt;br /&gt;
Some of the strategies are:&lt;br /&gt;
* Replace &amp;amp;&amp;amp; to ||&lt;br /&gt;
* Make 'if condition' to 'if true'&lt;br /&gt;
* Make 'if condition' to 'if false'&lt;br /&gt;
* Re-order statements&lt;br /&gt;
* Duplicate statements&lt;br /&gt;
* Change arithmetic operations.&lt;br /&gt;
&lt;br /&gt;
===Excecution Flow===&lt;br /&gt;
&lt;br /&gt;
[[File:Oodd servo.png]]&lt;br /&gt;
&lt;br /&gt;
===Design Pattern===&lt;br /&gt;
&lt;br /&gt;
====Strategy Design Pattern====&lt;br /&gt;
There are multiple strategies for mutating a file. Each strategy has the implementation of its strategy in the mutate_line method. The Mutator picks up random strategy during the execution of the program and mutates the file.&lt;br /&gt;
&lt;br /&gt;
[[File:UML_Mutation_Testing.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
&lt;br /&gt;
The project is about writing a python script to change the source code and run tests. It does not add any functionality to Servo. So there is no scope for testing in this project.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://www.guru99.com/mutation-testing.html&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://github.com/servo/servo&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo/wiki/Mutation-testing-project&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sdhegde</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112756</id>
		<title>CSC/ECE 517 Fall 2017/M1754 Mutation Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112756"/>
		<updated>2017-11-09T17:41:52Z</updated>

		<summary type="html">&lt;p&gt;Sdhegde: /* Existing Excecution Flow */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Servo uses the Web Platform Test (WPT) suite for testing, but does not perform an evaluation of the breadth of the tests. The goal of this project is to use techniques from mutation testing to evaluate the performance of the WPT suite when bugs are deliberately introduced into the code base. &lt;br /&gt;
&lt;br /&gt;
The implementation of this project was done by writing python scripts that would modify the source code to generate mutants and run tests on them expecting failures. The scripts would temporarily modify the source codes, call the corresponding tests and revert back to the original code by reversing the changes that were made earlier. This process was repeated for multiple iterations by modifying various parts of the source code in random order.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use. [https://servo.org Servo] is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks. [https://en.wikipedia.org/wiki/Servo_(layout_engine)]&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://doc.rust-lang.org/book/second-edition/ Rust] is an open source,  systems programming language sponsored by Mozilla Research. Rust performs the majority of its safety checks and memory management decisions at compile time, so that program’s runtime performance is not impacted. Making it useful in programs with predictable space and time requirements, embedding in other languages, and writing low-level code, like device drivers and operating systems.&lt;br /&gt;
&lt;br /&gt;
===Web-platform-tests===&lt;br /&gt;
The [https://github.com/w3c/web-platform-tests web-platform-tests Project] is a W3C-coordinated attempt to build a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This, in turn, gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.&lt;br /&gt;
&lt;br /&gt;
===Mutation Testing===&lt;br /&gt;
Mutation Testing is a type of software testing where we mutate (change) certain statements in the source code and check if the test cases are able to find the errors.The goal of Mutation Testing is to assess the quality of the test cases which should be robust enough to fail mutant code. This method is also called as a Fault-based testing strategy as it involves creating faults in the program.Faults are introduced into the source code of the program by creating many versions called mutants. Each mutant should contain a single fault, and the goal is to cause the mutant version to fail which demonstrates the effectiveness of the test cases.[https://www.guru99.com/mutation-testing.html ]&lt;br /&gt;
&lt;br /&gt;
=='''Project description'''==&lt;br /&gt;
===Environment Setup===&lt;br /&gt;
* Clone the repository from [https://github.com/dsandeephegde/servo link]&lt;br /&gt;
* The steps to setup the environment for different OS are mentioned in readme file [https://github.com/servo/servo link].&lt;br /&gt;
&lt;br /&gt;
====Install packages==== &lt;br /&gt;
&lt;br /&gt;
Example, In OSX(homebrew):&lt;br /&gt;
&lt;br /&gt;
 brew install automake pkg-config python cmake yasm&lt;br /&gt;
 pip install virtualenv&lt;br /&gt;
&lt;br /&gt;
====Running test after setup====&lt;br /&gt;
&lt;br /&gt;
After the setup, make sure that everything works in your machine by building and running tests.&lt;br /&gt;
&lt;br /&gt;
build in release mode:&lt;br /&gt;
&lt;br /&gt;
 ./mach build --release&lt;br /&gt;
&lt;br /&gt;
run WPT tests:&lt;br /&gt;
&lt;br /&gt;
 ./mach test -wpt --release&lt;br /&gt;
&lt;br /&gt;
===Initial steps===&lt;br /&gt;
&lt;br /&gt;
*Implemented a simple mutator as a Python script that finds random uses of &amp;amp;&amp;amp; in Servo's code base and replaces them by ||.&lt;br /&gt;
*Built the mutated implementation of Servo with ./mach build -r and run it on the WPT test suite with ./mach test-wpt:  This produced test failures.&lt;br /&gt;
*Introduced test mapping framework to map source files to WPT test.&lt;br /&gt;
*Optimized the number of test runs by using test mapping to run only relevant tests for a mutant.&lt;br /&gt;
*Automated this process by writing scripts in a new python/servo/mutation directory, and called them from scripts in /etc/ci.&lt;br /&gt;
* Mutation test can be ran using either of the following command from the servo directory:&lt;br /&gt;
&lt;br /&gt;
 python python/servo/mutation/init.py components/script/dom&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 python etc/ci/mutation_test.py&lt;br /&gt;
&lt;br /&gt;
===Subsequent steps===&lt;br /&gt;
&lt;br /&gt;
* implement mutations like replacing if statements by if true/if false, duplicating statements, reordering statements, changing arithmetic &amp;amp; atomic string constant.&lt;br /&gt;
* improving the performance of the testing, for example randomizing the test order, fast-failing, running tests with faster builds (e.g. ./mach build -d).&lt;br /&gt;
* find heuristics for identifying false positives, that is mutations which are expected to have no effect, for example removing logging.&lt;br /&gt;
* find search heuristics for identifying mutations that cause no test failures.&lt;br /&gt;
&lt;br /&gt;
===Existing Mutation Strategy===&lt;br /&gt;
&lt;br /&gt;
* Replace random occurrence of &amp;amp;&amp;amp; with ||&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
    if a &amp;amp;&amp;amp; b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    if a || b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
This will produce a bug. When a is true and b is false also when a is false and b is true the value of c will be wrong. If our WPT test catches this bug then we can say mutant is killed. Otherwise mutant has lived.&lt;br /&gt;
&lt;br /&gt;
===Excecution Flow===&lt;br /&gt;
&lt;br /&gt;
[[File:Oodd servo.png]]&lt;br /&gt;
&lt;br /&gt;
===Design Pattern===&lt;br /&gt;
&lt;br /&gt;
====Strategy Design Pattern====&lt;br /&gt;
There are multiple strategies for mutating a file. Each strategy has the implementation of its strategy in the mutate_line method. The Mutator picks up random strategy during the execution of the program and mutates the file.&lt;br /&gt;
&lt;br /&gt;
[[File:UML_Mutation_Testing.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
&lt;br /&gt;
The project is about writing a python script to change the source code and run tests. It does not add any functionality to Servo. So there is no scope for testing in this project.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://www.guru99.com/mutation-testing.html&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://github.com/servo/servo&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo/wiki/Mutation-testing-project&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sdhegde</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112755</id>
		<title>CSC/ECE 517 Fall 2017/M1754 Mutation Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112755"/>
		<updated>2017-11-09T17:40:21Z</updated>

		<summary type="html">&lt;p&gt;Sdhegde: /* Design Pattern */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Servo uses the Web Platform Test (WPT) suite for testing, but does not perform an evaluation of the breadth of the tests. The goal of this project is to use techniques from mutation testing to evaluate the performance of the WPT suite when bugs are deliberately introduced into the code base. &lt;br /&gt;
&lt;br /&gt;
The implementation of this project was done by writing python scripts that would modify the source code to generate mutants and run tests on them expecting failures. The scripts would temporarily modify the source codes, call the corresponding tests and revert back to the original code by reversing the changes that were made earlier. This process was repeated for multiple iterations by modifying various parts of the source code in random order.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use. [https://servo.org Servo] is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks. [https://en.wikipedia.org/wiki/Servo_(layout_engine)]&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://doc.rust-lang.org/book/second-edition/ Rust] is an open source,  systems programming language sponsored by Mozilla Research. Rust performs the majority of its safety checks and memory management decisions at compile time, so that program’s runtime performance is not impacted. Making it useful in programs with predictable space and time requirements, embedding in other languages, and writing low-level code, like device drivers and operating systems.&lt;br /&gt;
&lt;br /&gt;
===Web-platform-tests===&lt;br /&gt;
The [https://github.com/w3c/web-platform-tests web-platform-tests Project] is a W3C-coordinated attempt to build a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This, in turn, gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.&lt;br /&gt;
&lt;br /&gt;
===Mutation Testing===&lt;br /&gt;
Mutation Testing is a type of software testing where we mutate (change) certain statements in the source code and check if the test cases are able to find the errors.The goal of Mutation Testing is to assess the quality of the test cases which should be robust enough to fail mutant code. This method is also called as a Fault-based testing strategy as it involves creating faults in the program.Faults are introduced into the source code of the program by creating many versions called mutants. Each mutant should contain a single fault, and the goal is to cause the mutant version to fail which demonstrates the effectiveness of the test cases.[https://www.guru99.com/mutation-testing.html ]&lt;br /&gt;
&lt;br /&gt;
=='''Project description'''==&lt;br /&gt;
===Environment Setup===&lt;br /&gt;
* Clone the repository from [https://github.com/dsandeephegde/servo link]&lt;br /&gt;
* The steps to setup the environment for different OS are mentioned in readme file [https://github.com/servo/servo link].&lt;br /&gt;
&lt;br /&gt;
====Install packages==== &lt;br /&gt;
&lt;br /&gt;
Example, In OSX(homebrew):&lt;br /&gt;
&lt;br /&gt;
 brew install automake pkg-config python cmake yasm&lt;br /&gt;
 pip install virtualenv&lt;br /&gt;
&lt;br /&gt;
====Running test after setup====&lt;br /&gt;
&lt;br /&gt;
After the setup, make sure that everything works in your machine by building and running tests.&lt;br /&gt;
&lt;br /&gt;
build in release mode:&lt;br /&gt;
&lt;br /&gt;
 ./mach build --release&lt;br /&gt;
&lt;br /&gt;
run WPT tests:&lt;br /&gt;
&lt;br /&gt;
 ./mach test -wpt --release&lt;br /&gt;
&lt;br /&gt;
===Initial steps===&lt;br /&gt;
&lt;br /&gt;
*Implemented a simple mutator as a Python script that finds random uses of &amp;amp;&amp;amp; in Servo's code base and replaces them by ||.&lt;br /&gt;
*Built the mutated implementation of Servo with ./mach build -r and run it on the WPT test suite with ./mach test-wpt:  This produced test failures.&lt;br /&gt;
*Introduced test mapping framework to map source files to WPT test.&lt;br /&gt;
*Optimized the number of test runs by using test mapping to run only relevant tests for a mutant.&lt;br /&gt;
*Automated this process by writing scripts in a new python/servo/mutation directory, and called them from scripts in /etc/ci.&lt;br /&gt;
* Mutation test can be ran using either of the following command from the servo directory:&lt;br /&gt;
&lt;br /&gt;
 python python/servo/mutation/init.py components/script/dom&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 python etc/ci/mutation_test.py&lt;br /&gt;
&lt;br /&gt;
===Subsequent steps===&lt;br /&gt;
&lt;br /&gt;
* implement mutations like replacing if statements by if true/if false, duplicating statements, reordering statements, changing arithmetic &amp;amp; atomic string constant.&lt;br /&gt;
* improving the performance of the testing, for example randomizing the test order, fast-failing, running tests with faster builds (e.g. ./mach build -d).&lt;br /&gt;
* find heuristics for identifying false positives, that is mutations which are expected to have no effect, for example removing logging.&lt;br /&gt;
* find search heuristics for identifying mutations that cause no test failures.&lt;br /&gt;
&lt;br /&gt;
===Existing Mutation Strategy===&lt;br /&gt;
&lt;br /&gt;
* Replace random occurrence of &amp;amp;&amp;amp; with ||&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
    if a &amp;amp;&amp;amp; b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    if a || b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
This will produce a bug. When a is true and b is false also when a is false and b is true the value of c will be wrong. If our WPT test catches this bug then we can say mutant is killed. Otherwise mutant has lived.&lt;br /&gt;
&lt;br /&gt;
===Existing Excecution Flow===&lt;br /&gt;
&lt;br /&gt;
[[File:Oodd servo.png]]&lt;br /&gt;
&lt;br /&gt;
===Design Pattern===&lt;br /&gt;
&lt;br /&gt;
====Strategy Design Pattern====&lt;br /&gt;
There are multiple strategies for mutating a file. Each strategy has the implementation of its strategy in the mutate_line method. The Mutator picks up random strategy during the execution of the program and mutates the file.&lt;br /&gt;
&lt;br /&gt;
[[File:UML_Mutation_Testing.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
&lt;br /&gt;
The project is about writing a python script to change the source code and run tests. It does not add any functionality to Servo. So there is no scope for testing in this project.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://www.guru99.com/mutation-testing.html&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://github.com/servo/servo&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo/wiki/Mutation-testing-project&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sdhegde</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112754</id>
		<title>CSC/ECE 517 Fall 2017/M1754 Mutation Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112754"/>
		<updated>2017-11-09T17:40:13Z</updated>

		<summary type="html">&lt;p&gt;Sdhegde: /* Design Pattern */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Servo uses the Web Platform Test (WPT) suite for testing, but does not perform an evaluation of the breadth of the tests. The goal of this project is to use techniques from mutation testing to evaluate the performance of the WPT suite when bugs are deliberately introduced into the code base. &lt;br /&gt;
&lt;br /&gt;
The implementation of this project was done by writing python scripts that would modify the source code to generate mutants and run tests on them expecting failures. The scripts would temporarily modify the source codes, call the corresponding tests and revert back to the original code by reversing the changes that were made earlier. This process was repeated for multiple iterations by modifying various parts of the source code in random order.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use. [https://servo.org Servo] is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks. [https://en.wikipedia.org/wiki/Servo_(layout_engine)]&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://doc.rust-lang.org/book/second-edition/ Rust] is an open source,  systems programming language sponsored by Mozilla Research. Rust performs the majority of its safety checks and memory management decisions at compile time, so that program’s runtime performance is not impacted. Making it useful in programs with predictable space and time requirements, embedding in other languages, and writing low-level code, like device drivers and operating systems.&lt;br /&gt;
&lt;br /&gt;
===Web-platform-tests===&lt;br /&gt;
The [https://github.com/w3c/web-platform-tests web-platform-tests Project] is a W3C-coordinated attempt to build a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This, in turn, gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.&lt;br /&gt;
&lt;br /&gt;
===Mutation Testing===&lt;br /&gt;
Mutation Testing is a type of software testing where we mutate (change) certain statements in the source code and check if the test cases are able to find the errors.The goal of Mutation Testing is to assess the quality of the test cases which should be robust enough to fail mutant code. This method is also called as a Fault-based testing strategy as it involves creating faults in the program.Faults are introduced into the source code of the program by creating many versions called mutants. Each mutant should contain a single fault, and the goal is to cause the mutant version to fail which demonstrates the effectiveness of the test cases.[https://www.guru99.com/mutation-testing.html ]&lt;br /&gt;
&lt;br /&gt;
=='''Project description'''==&lt;br /&gt;
===Environment Setup===&lt;br /&gt;
* Clone the repository from [https://github.com/dsandeephegde/servo link]&lt;br /&gt;
* The steps to setup the environment for different OS are mentioned in readme file [https://github.com/servo/servo link].&lt;br /&gt;
&lt;br /&gt;
====Install packages==== &lt;br /&gt;
&lt;br /&gt;
Example, In OSX(homebrew):&lt;br /&gt;
&lt;br /&gt;
 brew install automake pkg-config python cmake yasm&lt;br /&gt;
 pip install virtualenv&lt;br /&gt;
&lt;br /&gt;
====Running test after setup====&lt;br /&gt;
&lt;br /&gt;
After the setup, make sure that everything works in your machine by building and running tests.&lt;br /&gt;
&lt;br /&gt;
build in release mode:&lt;br /&gt;
&lt;br /&gt;
 ./mach build --release&lt;br /&gt;
&lt;br /&gt;
run WPT tests:&lt;br /&gt;
&lt;br /&gt;
 ./mach test -wpt --release&lt;br /&gt;
&lt;br /&gt;
===Initial steps===&lt;br /&gt;
&lt;br /&gt;
*Implemented a simple mutator as a Python script that finds random uses of &amp;amp;&amp;amp; in Servo's code base and replaces them by ||.&lt;br /&gt;
*Built the mutated implementation of Servo with ./mach build -r and run it on the WPT test suite with ./mach test-wpt:  This produced test failures.&lt;br /&gt;
*Introduced test mapping framework to map source files to WPT test.&lt;br /&gt;
*Optimized the number of test runs by using test mapping to run only relevant tests for a mutant.&lt;br /&gt;
*Automated this process by writing scripts in a new python/servo/mutation directory, and called them from scripts in /etc/ci.&lt;br /&gt;
* Mutation test can be ran using either of the following command from the servo directory:&lt;br /&gt;
&lt;br /&gt;
 python python/servo/mutation/init.py components/script/dom&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 python etc/ci/mutation_test.py&lt;br /&gt;
&lt;br /&gt;
===Subsequent steps===&lt;br /&gt;
&lt;br /&gt;
* implement mutations like replacing if statements by if true/if false, duplicating statements, reordering statements, changing arithmetic &amp;amp; atomic string constant.&lt;br /&gt;
* improving the performance of the testing, for example randomizing the test order, fast-failing, running tests with faster builds (e.g. ./mach build -d).&lt;br /&gt;
* find heuristics for identifying false positives, that is mutations which are expected to have no effect, for example removing logging.&lt;br /&gt;
* find search heuristics for identifying mutations that cause no test failures.&lt;br /&gt;
&lt;br /&gt;
===Existing Mutation Strategy===&lt;br /&gt;
&lt;br /&gt;
* Replace random occurrence of &amp;amp;&amp;amp; with ||&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
    if a &amp;amp;&amp;amp; b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    if a || b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
This will produce a bug. When a is true and b is false also when a is false and b is true the value of c will be wrong. If our WPT test catches this bug then we can say mutant is killed. Otherwise mutant has lived.&lt;br /&gt;
&lt;br /&gt;
===Existing Excecution Flow===&lt;br /&gt;
&lt;br /&gt;
[[File:Oodd servo.png]]&lt;br /&gt;
&lt;br /&gt;
===Design Pattern===&lt;br /&gt;
&lt;br /&gt;
====Strategy Design Pattern=====&lt;br /&gt;
There are multiple strategies for mutating a file. Each strategy has the implementation of its strategy in the mutate_line method. The Mutator picks up random strategy during the execution of the program and mutates the file.&lt;br /&gt;
&lt;br /&gt;
[[File:UML_Mutation_Testing.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
&lt;br /&gt;
The project is about writing a python script to change the source code and run tests. It does not add any functionality to Servo. So there is no scope for testing in this project.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://www.guru99.com/mutation-testing.html&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://github.com/servo/servo&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo/wiki/Mutation-testing-project&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sdhegde</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112753</id>
		<title>CSC/ECE 517 Fall 2017/M1754 Mutation Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112753"/>
		<updated>2017-11-09T17:39:52Z</updated>

		<summary type="html">&lt;p&gt;Sdhegde: /* Design Pattern */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Servo uses the Web Platform Test (WPT) suite for testing, but does not perform an evaluation of the breadth of the tests. The goal of this project is to use techniques from mutation testing to evaluate the performance of the WPT suite when bugs are deliberately introduced into the code base. &lt;br /&gt;
&lt;br /&gt;
The implementation of this project was done by writing python scripts that would modify the source code to generate mutants and run tests on them expecting failures. The scripts would temporarily modify the source codes, call the corresponding tests and revert back to the original code by reversing the changes that were made earlier. This process was repeated for multiple iterations by modifying various parts of the source code in random order.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use. [https://servo.org Servo] is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks. [https://en.wikipedia.org/wiki/Servo_(layout_engine)]&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://doc.rust-lang.org/book/second-edition/ Rust] is an open source,  systems programming language sponsored by Mozilla Research. Rust performs the majority of its safety checks and memory management decisions at compile time, so that program’s runtime performance is not impacted. Making it useful in programs with predictable space and time requirements, embedding in other languages, and writing low-level code, like device drivers and operating systems.&lt;br /&gt;
&lt;br /&gt;
===Web-platform-tests===&lt;br /&gt;
The [https://github.com/w3c/web-platform-tests web-platform-tests Project] is a W3C-coordinated attempt to build a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This, in turn, gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.&lt;br /&gt;
&lt;br /&gt;
===Mutation Testing===&lt;br /&gt;
Mutation Testing is a type of software testing where we mutate (change) certain statements in the source code and check if the test cases are able to find the errors.The goal of Mutation Testing is to assess the quality of the test cases which should be robust enough to fail mutant code. This method is also called as a Fault-based testing strategy as it involves creating faults in the program.Faults are introduced into the source code of the program by creating many versions called mutants. Each mutant should contain a single fault, and the goal is to cause the mutant version to fail which demonstrates the effectiveness of the test cases.[https://www.guru99.com/mutation-testing.html ]&lt;br /&gt;
&lt;br /&gt;
=='''Project description'''==&lt;br /&gt;
===Environment Setup===&lt;br /&gt;
* Clone the repository from [https://github.com/dsandeephegde/servo link]&lt;br /&gt;
* The steps to setup the environment for different OS are mentioned in readme file [https://github.com/servo/servo link].&lt;br /&gt;
&lt;br /&gt;
====Install packages==== &lt;br /&gt;
&lt;br /&gt;
Example, In OSX(homebrew):&lt;br /&gt;
&lt;br /&gt;
 brew install automake pkg-config python cmake yasm&lt;br /&gt;
 pip install virtualenv&lt;br /&gt;
&lt;br /&gt;
====Running test after setup====&lt;br /&gt;
&lt;br /&gt;
After the setup, make sure that everything works in your machine by building and running tests.&lt;br /&gt;
&lt;br /&gt;
build in release mode:&lt;br /&gt;
&lt;br /&gt;
 ./mach build --release&lt;br /&gt;
&lt;br /&gt;
run WPT tests:&lt;br /&gt;
&lt;br /&gt;
 ./mach test -wpt --release&lt;br /&gt;
&lt;br /&gt;
===Initial steps===&lt;br /&gt;
&lt;br /&gt;
*Implemented a simple mutator as a Python script that finds random uses of &amp;amp;&amp;amp; in Servo's code base and replaces them by ||.&lt;br /&gt;
*Built the mutated implementation of Servo with ./mach build -r and run it on the WPT test suite with ./mach test-wpt:  This produced test failures.&lt;br /&gt;
*Introduced test mapping framework to map source files to WPT test.&lt;br /&gt;
*Optimized the number of test runs by using test mapping to run only relevant tests for a mutant.&lt;br /&gt;
*Automated this process by writing scripts in a new python/servo/mutation directory, and called them from scripts in /etc/ci.&lt;br /&gt;
* Mutation test can be ran using either of the following command from the servo directory:&lt;br /&gt;
&lt;br /&gt;
 python python/servo/mutation/init.py components/script/dom&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 python etc/ci/mutation_test.py&lt;br /&gt;
&lt;br /&gt;
===Subsequent steps===&lt;br /&gt;
&lt;br /&gt;
* implement mutations like replacing if statements by if true/if false, duplicating statements, reordering statements, changing arithmetic &amp;amp; atomic string constant.&lt;br /&gt;
* improving the performance of the testing, for example randomizing the test order, fast-failing, running tests with faster builds (e.g. ./mach build -d).&lt;br /&gt;
* find heuristics for identifying false positives, that is mutations which are expected to have no effect, for example removing logging.&lt;br /&gt;
* find search heuristics for identifying mutations that cause no test failures.&lt;br /&gt;
&lt;br /&gt;
===Existing Mutation Strategy===&lt;br /&gt;
&lt;br /&gt;
* Replace random occurrence of &amp;amp;&amp;amp; with ||&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
    if a &amp;amp;&amp;amp; b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    if a || b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
This will produce a bug. When a is true and b is false also when a is false and b is true the value of c will be wrong. If our WPT test catches this bug then we can say mutant is killed. Otherwise mutant has lived.&lt;br /&gt;
&lt;br /&gt;
===Existing Excecution Flow===&lt;br /&gt;
&lt;br /&gt;
[[File:Oodd servo.png]]&lt;br /&gt;
&lt;br /&gt;
===Design Pattern===&lt;br /&gt;
&lt;br /&gt;
Strategy Design Pattern&lt;br /&gt;
&lt;br /&gt;
[[File:UML_Mutation_Testing.jpg]]&lt;br /&gt;
&lt;br /&gt;
There are multiple strategies for mutating a file. Each strategy has the implementation of its strategy in the mutate_line method. The Mutator picks up random strategy during the execution of the program and mutates the file.&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
&lt;br /&gt;
The project is about writing a python script to change the source code and run tests. It does not add any functionality to Servo. So there is no scope for testing in this project.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://www.guru99.com/mutation-testing.html&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://github.com/servo/servo&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo/wiki/Mutation-testing-project&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sdhegde</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:UML_Mutation_Testing.jpg&amp;diff=112752</id>
		<title>File:UML Mutation Testing.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:UML_Mutation_Testing.jpg&amp;diff=112752"/>
		<updated>2017-11-09T17:35:38Z</updated>

		<summary type="html">&lt;p&gt;Sdhegde: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sdhegde</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112751</id>
		<title>CSC/ECE 517 Fall 2017/M1754 Mutation Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112751"/>
		<updated>2017-11-09T17:33:09Z</updated>

		<summary type="html">&lt;p&gt;Sdhegde: /* Design Pattern */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Servo uses the Web Platform Test (WPT) suite for testing, but does not perform an evaluation of the breadth of the tests. The goal of this project is to use techniques from mutation testing to evaluate the performance of the WPT suite when bugs are deliberately introduced into the code base. &lt;br /&gt;
&lt;br /&gt;
The implementation of this project was done by writing python scripts that would modify the source code to generate mutants and run tests on them expecting failures. The scripts would temporarily modify the source codes, call the corresponding tests and revert back to the original code by reversing the changes that were made earlier. This process was repeated for multiple iterations by modifying various parts of the source code in random order.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use. [https://servo.org Servo] is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks. [https://en.wikipedia.org/wiki/Servo_(layout_engine)]&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://doc.rust-lang.org/book/second-edition/ Rust] is an open source,  systems programming language sponsored by Mozilla Research. Rust performs the majority of its safety checks and memory management decisions at compile time, so that program’s runtime performance is not impacted. Making it useful in programs with predictable space and time requirements, embedding in other languages, and writing low-level code, like device drivers and operating systems.&lt;br /&gt;
&lt;br /&gt;
===Web-platform-tests===&lt;br /&gt;
The [https://github.com/w3c/web-platform-tests web-platform-tests Project] is a W3C-coordinated attempt to build a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This, in turn, gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.&lt;br /&gt;
&lt;br /&gt;
===Mutation Testing===&lt;br /&gt;
Mutation Testing is a type of software testing where we mutate (change) certain statements in the source code and check if the test cases are able to find the errors.The goal of Mutation Testing is to assess the quality of the test cases which should be robust enough to fail mutant code. This method is also called as a Fault-based testing strategy as it involves creating faults in the program.Faults are introduced into the source code of the program by creating many versions called mutants. Each mutant should contain a single fault, and the goal is to cause the mutant version to fail which demonstrates the effectiveness of the test cases.[https://www.guru99.com/mutation-testing.html ]&lt;br /&gt;
&lt;br /&gt;
=='''Project description'''==&lt;br /&gt;
===Environment Setup===&lt;br /&gt;
* Clone the repository from [https://github.com/dsandeephegde/servo link]&lt;br /&gt;
* The steps to setup the environment for different OS are mentioned in readme file [https://github.com/servo/servo link].&lt;br /&gt;
&lt;br /&gt;
====Install packages==== &lt;br /&gt;
&lt;br /&gt;
Example, In OSX(homebrew):&lt;br /&gt;
&lt;br /&gt;
 brew install automake pkg-config python cmake yasm&lt;br /&gt;
 pip install virtualenv&lt;br /&gt;
&lt;br /&gt;
====Running test after setup====&lt;br /&gt;
&lt;br /&gt;
After the setup, make sure that everything works in your machine by building and running tests.&lt;br /&gt;
&lt;br /&gt;
build in release mode:&lt;br /&gt;
&lt;br /&gt;
 ./mach build --release&lt;br /&gt;
&lt;br /&gt;
run WPT tests:&lt;br /&gt;
&lt;br /&gt;
 ./mach test -wpt --release&lt;br /&gt;
&lt;br /&gt;
===Initial steps===&lt;br /&gt;
&lt;br /&gt;
*Implemented a simple mutator as a Python script that finds random uses of &amp;amp;&amp;amp; in Servo's code base and replaces them by ||.&lt;br /&gt;
*Built the mutated implementation of Servo with ./mach build -r and run it on the WPT test suite with ./mach test-wpt:  This produced test failures.&lt;br /&gt;
*Introduced test mapping framework to map source files to WPT test.&lt;br /&gt;
*Optimized the number of test runs by using test mapping to run only relevant tests for a mutant.&lt;br /&gt;
*Automated this process by writing scripts in a new python/servo/mutation directory, and called them from scripts in /etc/ci.&lt;br /&gt;
* Mutation test can be ran using either of the following command from the servo directory:&lt;br /&gt;
&lt;br /&gt;
 python python/servo/mutation/init.py components/script/dom&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 python etc/ci/mutation_test.py&lt;br /&gt;
&lt;br /&gt;
===Subsequent steps===&lt;br /&gt;
&lt;br /&gt;
* implement mutations like replacing if statements by if true/if false, duplicating statements, reordering statements, changing arithmetic &amp;amp; atomic string constant.&lt;br /&gt;
* improving the performance of the testing, for example randomizing the test order, fast-failing, running tests with faster builds (e.g. ./mach build -d).&lt;br /&gt;
* find heuristics for identifying false positives, that is mutations which are expected to have no effect, for example removing logging.&lt;br /&gt;
* find search heuristics for identifying mutations that cause no test failures.&lt;br /&gt;
&lt;br /&gt;
===Existing Mutation Strategy===&lt;br /&gt;
&lt;br /&gt;
* Replace random occurrence of &amp;amp;&amp;amp; with ||&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
    if a &amp;amp;&amp;amp; b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    if a || b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
This will produce a bug. When a is true and b is false also when a is false and b is true the value of c will be wrong. If our WPT test catches this bug then we can say mutant is killed. Otherwise mutant has lived.&lt;br /&gt;
&lt;br /&gt;
===Existing Excecution Flow===&lt;br /&gt;
&lt;br /&gt;
[[File:Oodd servo.png]]&lt;br /&gt;
&lt;br /&gt;
===Design Pattern===&lt;br /&gt;
&lt;br /&gt;
[[File:UML_Mutation_Testing.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
&lt;br /&gt;
The project is about writing a python script to change the source code and run tests. It does not add any functionality to Servo. So there is no scope for testing in this project.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://www.guru99.com/mutation-testing.html&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://github.com/servo/servo&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo/wiki/Mutation-testing-project&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sdhegde</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112688</id>
		<title>CSC/ECE 517 Fall 2017/M1754 Mutation Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112688"/>
		<updated>2017-11-08T05:19:02Z</updated>

		<summary type="html">&lt;p&gt;Sdhegde: Undo revision 112685 by Sdhegde (talk)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Servo uses the Web Platform Test (WPT) suite for testing, but does not perform an evaluation of the breadth of the tests. The goal of this project is to use techniques from mutation testing to evaluate the performance of the WPT suite when bugs are deliberately introduced into the code base. &lt;br /&gt;
&lt;br /&gt;
The implementation of this project was done by writing python scripts that would modify the source code to generate mutants and run tests on them expecting failures. The scripts would temporarily modify the source codes, call the corresponding tests and revert back to the original code by reversing the changes that were made earlier. This process was repeated for multiple iterations by modifying various parts of the source code in random order.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use. [https://servo.org Servo] is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks. [https://en.wikipedia.org/wiki/Servo_(layout_engine)]&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://doc.rust-lang.org/book/second-edition/ Rust] is an open source,  systems programming language sponsored by Mozilla Research. Rust performs the majority of its safety checks and memory management decisions at compile time, so that program’s runtime performance is not impacted. Making it useful in programs with predictable space and time requirements, embedding in other languages, and writing low-level code, like device drivers and operating systems.&lt;br /&gt;
&lt;br /&gt;
===Web-platform-tests===&lt;br /&gt;
The [https://github.com/w3c/web-platform-tests web-platform-tests Project] is a W3C-coordinated attempt to build a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This, in turn, gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.&lt;br /&gt;
&lt;br /&gt;
===Mutation Testing===&lt;br /&gt;
Mutation Testing is a type of software testing where we mutate (change) certain statements in the source code and check if the test cases are able to find the errors.The goal of Mutation Testing is to assess the quality of the test cases which should be robust enough to fail mutant code. This method is also called as a Fault-based testing strategy as it involves creating faults in the program.Faults are introduced into the source code of the program by creating many versions called mutants. Each mutant should contain a single fault, and the goal is to cause the mutant version to fail which demonstrates the effectiveness of the test cases.[https://www.guru99.com/mutation-testing.html ]&lt;br /&gt;
&lt;br /&gt;
=='''Project description'''==&lt;br /&gt;
===Environment Setup===&lt;br /&gt;
* Clone the repository from [https://github.com/dsandeephegde/servo link]&lt;br /&gt;
* The steps to setup the environment for different OS are mentioned in readme file [https://github.com/servo/servo link].&lt;br /&gt;
&lt;br /&gt;
====Install packages==== &lt;br /&gt;
&lt;br /&gt;
Example, In OSX(homebrew):&lt;br /&gt;
&lt;br /&gt;
 brew install automake pkg-config python cmake yasm&lt;br /&gt;
 pip install virtualenv&lt;br /&gt;
&lt;br /&gt;
====Running test after setup====&lt;br /&gt;
&lt;br /&gt;
After the setup, make sure that everything works in your machine by building and running tests.&lt;br /&gt;
&lt;br /&gt;
build in release mode:&lt;br /&gt;
&lt;br /&gt;
 ./mach build --release&lt;br /&gt;
&lt;br /&gt;
run WPT tests:&lt;br /&gt;
&lt;br /&gt;
 ./mach test -wpt --release&lt;br /&gt;
&lt;br /&gt;
===Initial steps===&lt;br /&gt;
&lt;br /&gt;
*Implemented a simple mutator as a Python script that finds random uses of &amp;amp;&amp;amp; in Servo's code base and replaces them by ||.&lt;br /&gt;
*Built the mutated implementation of Servo with ./mach build -r and run it on the WPT test suite with ./mach test-wpt:  This produced test failures.&lt;br /&gt;
*Introduced test mapping framework to map source files to WPT test.&lt;br /&gt;
*Optimized the number of test runs by using test mapping to run only relevant tests for a mutant.&lt;br /&gt;
*Automated this process by writing scripts in a new python/servo/mutation directory, and called them from scripts in /etc/ci.&lt;br /&gt;
* Mutation test can be ran using either of the following command from the servo directory:&lt;br /&gt;
&lt;br /&gt;
 python python/servo/mutation/init.py components/script/dom&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 python etc/ci/mutation_test.py&lt;br /&gt;
&lt;br /&gt;
===Subsequent steps===&lt;br /&gt;
&lt;br /&gt;
* implement mutations like replacing if statements by if true/if false, duplicating statements, reordering statements, changing arithmetic &amp;amp; atomic string constant.&lt;br /&gt;
* improving the performance of the testing, for example randomizing the test order, fast-failing, running tests with faster builds (e.g. ./mach build -d).&lt;br /&gt;
* find heuristics for identifying false positives, that is mutations which are expected to have no effect, for example removing logging.&lt;br /&gt;
* find search heuristics for identifying mutations that cause no test failures.&lt;br /&gt;
&lt;br /&gt;
===Existing Mutation Strategy===&lt;br /&gt;
&lt;br /&gt;
* Replace random occurrence of &amp;amp;&amp;amp; with ||&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
    if a &amp;amp;&amp;amp; b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    if a || b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
This will produce a bug. When a is true and b is false also when a is false and b is true the value of c will be wrong. If our WPT test catches this bug then we can say mutant is killed. Otherwise mutant has lived.&lt;br /&gt;
&lt;br /&gt;
===Existing Excecution Flow===&lt;br /&gt;
&lt;br /&gt;
[[File:Oodd servo.png]]&lt;br /&gt;
&lt;br /&gt;
===Design Pattern===&lt;br /&gt;
&lt;br /&gt;
Design patterns are not applicable as our task is involved in implementing the script to modify files and invoking tests.&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
&lt;br /&gt;
The project is about writing a python script to change the source code and run tests. It does not add any functionality to Servo. So there is no scope for testing in this project.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://www.guru99.com/mutation-testing.html&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://github.com/servo/servo&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo/wiki/Mutation-testing-project&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sdhegde</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112687</id>
		<title>CSC/ECE 517 Fall 2017/M1754 Mutation Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112687"/>
		<updated>2017-11-08T05:18:42Z</updated>

		<summary type="html">&lt;p&gt;Sdhegde: Undo revision 112686 by Sdhegde (talk)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Servo uses the Web Platform Test (WPT) suite for testing, but does not perform an evaluation of the breadth of the tests. The goal of this project is to use techniques from mutation testing to evaluate the performance of the WPT suite when bugs are deliberately introduced into the code base. &lt;br /&gt;
&lt;br /&gt;
The implementation of this project was done by writing python scripts that would modify the source code to generate mutants and run tests on them expecting failures. The scripts would temporarily modify the source codes, call the corresponding tests and revert back to the original code by reversing the changes that were made earlier. This process was repeated for multiple iterations by modifying various parts of the source code in random order.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use. [https://servo.org Servo] is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks. [https://en.wikipedia.org/wiki/Servo_(layout_engine)]&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://doc.rust-lang.org/book/second-edition/ Rust] is an open source,  systems programming language sponsored by Mozilla Research. Rust performs the majority of its safety checks and memory management decisions at compile time, so that program’s runtime performance is not impacted. Making it useful in programs with predictable space and time requirements, embedding in other languages, and writing low-level code, like device drivers and operating systems.&lt;br /&gt;
&lt;br /&gt;
===Web-platform-tests===&lt;br /&gt;
The [https://github.com/w3c/web-platform-tests web-platform-tests Project] is a W3C-coordinated attempt to build a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This, in turn, gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.&lt;br /&gt;
&lt;br /&gt;
===Mutation Testing===&lt;br /&gt;
Mutation Testing is a type of software testing where we mutate (change) certain statements in the source code and check if the test cases are able to find the errors.The goal of Mutation Testing is to assess the quality of the test cases which should be robust enough to fail mutant code. This method is also called as a Fault-based testing strategy as it involves creating faults in the program.Faults are introduced into the source code of the program by creating many versions called mutants. Each mutant should contain a single fault, and the goal is to cause the mutant version to fail which demonstrates the effectiveness of the test cases.[https://www.guru99.com/mutation-testing.html ]&lt;br /&gt;
&lt;br /&gt;
=='''Project description'''==&lt;br /&gt;
===Environment Setup===&lt;br /&gt;
* Clone the repository from [https://github.com/dsandeephegde/servo link]&lt;br /&gt;
* The steps to setup the environment for different OS are mentioned in readme file [https://github.com/servo/servo link].&lt;br /&gt;
&lt;br /&gt;
====Install packages==== &lt;br /&gt;
&lt;br /&gt;
Example, In OSX(homebrew):&lt;br /&gt;
&lt;br /&gt;
 brew install automake pkg-config python cmake yasm&lt;br /&gt;
 pip install virtualenv&lt;br /&gt;
&lt;br /&gt;
====Running test after setup====&lt;br /&gt;
&lt;br /&gt;
After the setup, make sure that everything works in your machine by building and running tests.&lt;br /&gt;
&lt;br /&gt;
build in release mode:&lt;br /&gt;
&lt;br /&gt;
 ./mach build --release&lt;br /&gt;
&lt;br /&gt;
run WPT tests:&lt;br /&gt;
&lt;br /&gt;
 ./mach test -wpt --release&lt;br /&gt;
&lt;br /&gt;
===Initial steps===&lt;br /&gt;
&lt;br /&gt;
*Implemented a simple mutator as a Python script that finds random uses of &amp;amp;&amp;amp; in Servo's code base and replaces them by ||.&lt;br /&gt;
*Built the mutated implementation of Servo with ./mach build -r and run it on the WPT test suite with ./mach test-wpt:  This produced test failures.&lt;br /&gt;
*Introduced test mapping framework to map source files to WPT test.&lt;br /&gt;
*Optimized the number of test runs by using test mapping to run only relevant tests for a mutant.&lt;br /&gt;
*Automated this process by writing scripts in a new python/servo/mutation directory, and called them from scripts in /etc/ci.&lt;br /&gt;
* Mutation test can be ran using either of the following command from the servo directory:&lt;br /&gt;
&lt;br /&gt;
 python python/servo/mutation/init.py components/script/dom&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 python etc/ci/mutation_test.py&lt;br /&gt;
&lt;br /&gt;
===Subsequent steps===&lt;br /&gt;
&lt;br /&gt;
* implement mutations like replacing if statements by if true/if false, duplicating statements, reordering statements, changing arithmetic &amp;amp; atomic string constant.&lt;br /&gt;
* improving the performance of the testing, for example randomizing the test order, fast-failing, running tests with faster builds (e.g. ./mach build -d).&lt;br /&gt;
* find heuristics for identifying false positives, that is mutations which are expected to have no effect, for example removing logging.&lt;br /&gt;
* find search heuristics for identifying mutations that cause no test failures.&lt;br /&gt;
&lt;br /&gt;
===Existing Mutation Strategy===&lt;br /&gt;
&lt;br /&gt;
* Replace random occurrence of &amp;amp;&amp;amp; with ||&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
    if a &amp;amp;&amp;amp; b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    if a || b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
This will produce a bug. When a is true and b is false also when a is false and b is true the value of c will be wrong. If our WPT test catches this bug then we can say mutant is killed. Otherwise mutant has lived.&lt;br /&gt;
&lt;br /&gt;
===Existing Excecution Flow===&lt;br /&gt;
&lt;br /&gt;
[[File:Oodd servo.png]]&lt;br /&gt;
&lt;br /&gt;
===Design Pattern===&lt;br /&gt;
&lt;br /&gt;
Design patterns are not applicable as our task is involved in implementing the script to modify files and invoking tests.&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
&lt;br /&gt;
The project is about writing a python script to change the source code and run tests. It does not add any functionality to Servo. So there is no scope for testing in this project.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://github.com/servo/servo&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://github.com/servo/servo/wiki/Mutation-testing-project&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sdhegde</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112686</id>
		<title>CSC/ECE 517 Fall 2017/M1754 Mutation Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112686"/>
		<updated>2017-11-08T05:17:57Z</updated>

		<summary type="html">&lt;p&gt;Sdhegde: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Servo uses the Web Platform Test (WPT) suite for testing, but does not perform an evaluation of the breadth of the tests. The goal of this project is to use techniques from mutation testing to evaluate the performance of the WPT suite when bugs are deliberately introduced into the code base. &lt;br /&gt;
&lt;br /&gt;
The implementation of this project was done by writing python scripts that would modify the source code to generate mutants and run tests on them expecting failures. The scripts would temporarily modify the source codes, call the corresponding tests and revert back to the original code by reversing the changes that were made earlier. This process was repeated for multiple iterations by modifying various parts of the source code in random order.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use. [https://servo.org Servo] is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks. [https://en.wikipedia.org/wiki/Servo_(layout_engine)]&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://doc.rust-lang.org/book/second-edition/ Rust] is an open source,  systems programming language sponsored by Mozilla Research. Rust performs the majority of its safety checks and memory management decisions at compile time, so that program’s runtime performance is not impacted. Making it useful in programs with predictable space and time requirements, embedding in other languages, and writing low-level code, like device drivers and operating systems.&lt;br /&gt;
&lt;br /&gt;
===Web-platform-tests===&lt;br /&gt;
The [https://github.com/w3c/web-platform-tests web-platform-tests Project] is a W3C-coordinated attempt to build a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This, in turn, gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.&lt;br /&gt;
&lt;br /&gt;
===Mutation Testing===&lt;br /&gt;
Mutation Testing is a type of software testing where we mutate (change) certain statements in the source code and check if the test cases are able to find the errors.The goal of Mutation Testing is to assess the quality of the test cases which should be robust enough to fail mutant code. This method is also called as a Fault-based testing strategy as it involves creating faults in the program.Faults are introduced into the source code of the program by creating many versions called mutants. Each mutant should contain a single fault, and the goal is to cause the mutant version to fail which demonstrates the effectiveness of the test cases.[https://www.guru99.com/mutation-testing.html ]&lt;br /&gt;
&lt;br /&gt;
=='''Project description'''==&lt;br /&gt;
===Environment Setup===&lt;br /&gt;
* Clone the repository from [https://github.com/dsandeephegde/servo link]&lt;br /&gt;
* The steps to setup the environment for different OS are mentioned in readme file [https://github.com/servo/servo link].&lt;br /&gt;
&lt;br /&gt;
====Install packages==== &lt;br /&gt;
&lt;br /&gt;
Example, In OSX(homebrew):&lt;br /&gt;
&lt;br /&gt;
 brew install automake pkg-config python cmake yasm&lt;br /&gt;
 pip install virtualenv&lt;br /&gt;
&lt;br /&gt;
====Running test after setup====&lt;br /&gt;
&lt;br /&gt;
After the setup, make sure that everything works in your machine by building and running tests.&lt;br /&gt;
&lt;br /&gt;
build in release mode:&lt;br /&gt;
&lt;br /&gt;
 ./mach build --release&lt;br /&gt;
&lt;br /&gt;
run WPT tests:&lt;br /&gt;
&lt;br /&gt;
 ./mach test -wpt --release&lt;br /&gt;
&lt;br /&gt;
===Initial steps===&lt;br /&gt;
&lt;br /&gt;
*Implemented a simple mutator as a Python script that finds random uses of &amp;amp;&amp;amp; in Servo's code base and replaces them by ||.&lt;br /&gt;
*Built the mutated implementation of Servo with ./mach build -r and run it on the WPT test suite with ./mach test-wpt:  This produced test failures.&lt;br /&gt;
*Introduced test mapping framework to map source files to WPT test.&lt;br /&gt;
*Optimized the number of test runs by using test mapping to run only relevant tests for a mutant.&lt;br /&gt;
*Automated this process by writing scripts in a new python/servo/mutation directory, and called them from scripts in /etc/ci.&lt;br /&gt;
* Mutation test can be ran using either of the following command from the servo directory:&lt;br /&gt;
&lt;br /&gt;
 python python/servo/mutation/init.py components/script/dom&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 python etc/ci/mutation_test.py&lt;br /&gt;
&lt;br /&gt;
===Subsequent steps===&lt;br /&gt;
&lt;br /&gt;
* implement mutations like replacing if statements by if true/if false, duplicating statements, reordering statements, changing arithmetic &amp;amp; atomic string constant.&lt;br /&gt;
* improving the performance of the testing, for example randomizing the test order, fast-failing, running tests with faster builds (e.g. ./mach build -d).&lt;br /&gt;
* find heuristics for identifying false positives, that is mutations which are expected to have no effect, for example removing logging.&lt;br /&gt;
* find search heuristics for identifying mutations that cause no test failures.&lt;br /&gt;
&lt;br /&gt;
===Existing Mutation Strategy===&lt;br /&gt;
&lt;br /&gt;
* Replace random occurrence of &amp;amp;&amp;amp; with ||&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
    if a &amp;amp;&amp;amp; b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    if a || b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
This will produce a bug. When a is true and b is false also when a is false and b is true the value of c will be wrong. If our WPT test catches this bug then we can say mutant is killed. Otherwise mutant has lived.&lt;br /&gt;
&lt;br /&gt;
===Existing Excecution Flow===&lt;br /&gt;
&lt;br /&gt;
[[File:Oodd servo.png]]&lt;br /&gt;
&lt;br /&gt;
===Design Pattern===&lt;br /&gt;
&lt;br /&gt;
Design patterns are not applicable as our task is involved in implementing the script to modify files and invoking tests.&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
&lt;br /&gt;
The project is about writing a python script to change the source code and run tests. It does not add any functionality to Servo. So there is no scope for testing in this project.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://github.com/servo/servo&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo/wiki/Mutation-testing-project&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sdhegde</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112685</id>
		<title>CSC/ECE 517 Fall 2017/M1754 Mutation Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112685"/>
		<updated>2017-11-08T05:16:50Z</updated>

		<summary type="html">&lt;p&gt;Sdhegde: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Servo uses the Web Platform Test (WPT) suite for testing, but does not perform an evaluation of the breadth of the tests. The goal of this project is to use techniques from mutation testing to evaluate the performance of the WPT suite when bugs are deliberately introduced into the code base. &lt;br /&gt;
&lt;br /&gt;
The implementation of this project was done by writing python scripts that would modify the source code to generate mutants and run tests on them expecting failures. The scripts would temporarily modify the source codes, call the corresponding tests and revert back to the original code by reversing the changes that were made earlier. This process was repeated for multiple iterations by modifying various parts of the source code in random order.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use. [https://servo.org Servo] is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks. [https://en.wikipedia.org/wiki/Servo_(layout_engine)]&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://doc.rust-lang.org/book/second-edition/ Rust] is an open source,  systems programming language sponsored by Mozilla Research. Rust performs the majority of its safety checks and memory management decisions at compile time, so that program’s runtime performance is not impacted. Making it useful in programs with predictable space and time requirements, embedding in other languages, and writing low-level code, like device drivers and operating systems.&lt;br /&gt;
&lt;br /&gt;
===Web-platform-tests===&lt;br /&gt;
The [https://github.com/w3c/web-platform-tests web-platform-tests Project] is a W3C-coordinated attempt to build a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This, in turn, gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.&lt;br /&gt;
&lt;br /&gt;
===Mutation Testing===&lt;br /&gt;
Mutation Testing is a type of software testing where we mutate (change) certain statements in the source code and check if the test cases are able to find the errors.The goal of Mutation Testing is to assess the quality of the test cases which should be robust enough to fail mutant code. This method is also called as a Fault-based testing strategy as it involves creating faults in the program.Faults are introduced into the source code of the program by creating many versions called mutants. Each mutant should contain a single fault, and the goal is to cause the mutant version to fail which demonstrates the effectiveness of the test cases.[https://www.guru99.com/mutation-testing.html ]&lt;br /&gt;
&lt;br /&gt;
=='''Project description'''==&lt;br /&gt;
===Environment Setup===&lt;br /&gt;
* Clone the repository from [https://github.com/dsandeephegde/servo link]&lt;br /&gt;
* The steps to setup the environment for different OS are mentioned in readme file [https://github.com/servo/servo link].&lt;br /&gt;
&lt;br /&gt;
====Install packages==== &lt;br /&gt;
&lt;br /&gt;
Example, In OSX(homebrew):&lt;br /&gt;
&lt;br /&gt;
 brew install automake pkg-config python cmake yasm&lt;br /&gt;
 pip install virtualenv&lt;br /&gt;
&lt;br /&gt;
====Running test after setup====&lt;br /&gt;
&lt;br /&gt;
After the setup, make sure that everything works in your machine by building and running tests.&lt;br /&gt;
&lt;br /&gt;
build in release mode:&lt;br /&gt;
&lt;br /&gt;
 ./mach build --release&lt;br /&gt;
&lt;br /&gt;
run WPT tests:&lt;br /&gt;
&lt;br /&gt;
 ./mach test -wpt --release&lt;br /&gt;
&lt;br /&gt;
===Initial steps===&lt;br /&gt;
&lt;br /&gt;
*Implemented a simple mutator as a Python script that finds random uses of &amp;amp;&amp;amp; in Servo's code base and replaces them by ||.&lt;br /&gt;
*Built the mutated implementation of Servo with ./mach build -r and run it on the WPT test suite with ./mach test-wpt:  This produced test failures.&lt;br /&gt;
*Introduced test mapping framework to map source files to WPT test.&lt;br /&gt;
*Optimized the number of test runs by using test mapping to run only relevant tests for a mutant.&lt;br /&gt;
*Automated this process by writing scripts in a new python/servo/mutation directory, and called them from scripts in /etc/ci.&lt;br /&gt;
* Mutation test can be ran using either of the following command from the servo directory:&lt;br /&gt;
&lt;br /&gt;
 python python/servo/mutation/init.py components/script/dom&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 python etc/ci/mutation_test.py&lt;br /&gt;
&lt;br /&gt;
===Subsequent steps===&lt;br /&gt;
&lt;br /&gt;
* implement mutations like replacing if statements by if true/if false, duplicating statements, reordering statements, changing arithmetic &amp;amp; atomic string constant.&lt;br /&gt;
* improving the performance of the testing, for example randomizing the test order, fast-failing, running tests with faster builds (e.g. ./mach build -d).&lt;br /&gt;
* find heuristics for identifying false positives, that is mutations which are expected to have no effect, for example removing logging.&lt;br /&gt;
* find search heuristics for identifying mutations that cause no test failures.&lt;br /&gt;
&lt;br /&gt;
===Existing Mutation Strategy===&lt;br /&gt;
&lt;br /&gt;
* Replace random occurrence of &amp;amp;&amp;amp; with ||&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
    if a &amp;amp;&amp;amp; b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    if a || b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
This will produce a bug. When a is true and b is false also when a is false and b is true the value of c will be wrong. If our WPT test catches this bug then we can say mutant is killed. Otherwise mutant has lived.&lt;br /&gt;
&lt;br /&gt;
===Existing Excecution Flow===&lt;br /&gt;
&lt;br /&gt;
[[File:Oodd servo.png]]&lt;br /&gt;
&lt;br /&gt;
===Design Pattern===&lt;br /&gt;
&lt;br /&gt;
Design patterns are not applicable as our task is involved in implementing the script to modify files and invoking tests.&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
&lt;br /&gt;
The project is about writing a python script to change the source code and run tests. It does not add any functionality to Servo. So there is no scope for testing in this project.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://github.com/servo/servo&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://github.com/servo/servo/wiki/Mutation-testing-project&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sdhegde</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112147</id>
		<title>CSC/ECE 517 Fall 2017/M1754 Mutation Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112147"/>
		<updated>2017-11-07T02:43:07Z</updated>

		<summary type="html">&lt;p&gt;Sdhegde: /* Existing Mutation Strategy */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Servo uses the Web Platform Test (WPT) suite for testing, but does not perform an evaluation of the breadth of the tests. The goal of this project is to use techniques from mutation testing to evaluate the performance of the WPT suite when bugs are deliberately introduced into the code base. &lt;br /&gt;
&lt;br /&gt;
The implementation of this project was done by writing python scripts that would modify the source code to generate mutants and run tests on them expecting failures. The scripts would temporarily modify the source codes, call the corresponding tests and revert back to the original code by reversing the changes that were made earlier. This process was repeated for multiple iterations by modifying various parts of the source code in random order.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use. [https://servo.org Servo] is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks. [https://en.wikipedia.org/wiki/Servo_(layout_engine)]&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://doc.rust-lang.org/book/second-edition/ Rust] is an open source,  systems programming language sponsored by Mozilla Research. Rust performs the majority of its safety checks and memory management decisions at compile time, so that program’s runtime performance is not impacted. Making it useful in programs with predictable space and time requirements, embedding in other languages, and writing low-level code, like device drivers and operating systems.&lt;br /&gt;
&lt;br /&gt;
===Web-platform-tests===&lt;br /&gt;
The [https://github.com/w3c/web-platform-tests web-platform-tests Project] is a W3C-coordinated attempt to build a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This, in turn, gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.&lt;br /&gt;
&lt;br /&gt;
===Mutation Testing===&lt;br /&gt;
Mutation Testing is a type of software testing where we mutate (change) certain statements in the source code and check if the test cases are able to find the errors.The goal of Mutation Testing is to assess the quality of the test cases which should be robust enough to fail mutant code. This method is also called as a Fault-based testing strategy as it involves creating faults in the program.Faults are introduced into the source code of the program by creating many versions called mutants. Each mutant should contain a single fault, and the goal is to cause the mutant version to fail which demonstrates the effectiveness of the test cases.[https://www.guru99.com/mutation-testing.html ]&lt;br /&gt;
&lt;br /&gt;
=='''Project description'''==&lt;br /&gt;
===Environment Setup===&lt;br /&gt;
* Clone the repository from [https://github.com/dsandeephegde/servo link]&lt;br /&gt;
* The steps to setup the environment for different OS are mentioned in readme file [https://github.com/servo/servo link].&lt;br /&gt;
&lt;br /&gt;
====Install packages==== &lt;br /&gt;
&lt;br /&gt;
Example, In OSX(homebrew):&lt;br /&gt;
&lt;br /&gt;
 brew install automake pkg-config python cmake yasm&lt;br /&gt;
 pip install virtualenv&lt;br /&gt;
&lt;br /&gt;
====Running test after setup====&lt;br /&gt;
&lt;br /&gt;
After the setup, make sure that everything works in your machine by building and running tests.&lt;br /&gt;
&lt;br /&gt;
build in release mode:&lt;br /&gt;
&lt;br /&gt;
 ./mach build --release&lt;br /&gt;
&lt;br /&gt;
run WPT tests:&lt;br /&gt;
&lt;br /&gt;
 ./mach test -wpt --release&lt;br /&gt;
&lt;br /&gt;
===Initial steps===&lt;br /&gt;
&lt;br /&gt;
*Implemented a simple mutator as a Python script that finds random uses of &amp;amp;&amp;amp; in Servo's code base and replaces them by ||.&lt;br /&gt;
*Built the mutated implementation of Servo with ./mach build -r and run it on the WPT test suite with ./mach test-wpt:  This produced test failures.&lt;br /&gt;
*Introduced test mapping framework to map source files to WPT test.&lt;br /&gt;
*Optimized the number of test runs by using test mapping to run only relevant tests for a mutant.&lt;br /&gt;
*Automated this process by writing scripts in a new python/servo/mutation directory, and called them from scripts in /etc/ci.&lt;br /&gt;
* Mutation test can be ran using either of the following command from the servo directory:&lt;br /&gt;
&lt;br /&gt;
 python python/servo/mutation/init.py components/script/dom&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 python etc/ci/mutation_test.py&lt;br /&gt;
&lt;br /&gt;
===Subsequent steps===&lt;br /&gt;
&lt;br /&gt;
* implement mutations like replacing if statements by if true/if false, duplicating statements, reordering statements, changing arithmetic &amp;amp; atomic string constant.&lt;br /&gt;
* improving the performance of the testing, for example randomizing the test order, fast-failing, running tests with faster builds (e.g. ./mach build -d).&lt;br /&gt;
* find heuristics for identifying false positives, that is mutations which are expected to have no effect, for example removing logging.&lt;br /&gt;
* find search heuristics for identifying mutations that cause no test failures.&lt;br /&gt;
&lt;br /&gt;
===Existing Mutation Strategy===&lt;br /&gt;
&lt;br /&gt;
* Replace random occurrence of &amp;amp;&amp;amp; with ||&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
    if a &amp;amp;&amp;amp; b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    if a || b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
This will produce a bug. When a is true and b is false also when a is false and b is true the value of c will be wrong. If our WPT test catches this bug then we can say mutant is killed. Otherwise mutant has lived.&lt;br /&gt;
&lt;br /&gt;
===Existing Excecution Flow===&lt;br /&gt;
&lt;br /&gt;
Given a path&lt;br /&gt;
:mutation test(path)&lt;br /&gt;
::Look for test mapping file in that path&lt;br /&gt;
::for each file the in the test mapping&lt;br /&gt;
:::skip this file if there are local uncommitted changes&lt;br /&gt;
:::mutate a random line using some strategy in the file&lt;br /&gt;
:::build project and run WPT tests corresponding to it&lt;br /&gt;
:::if wpt tests pass?&lt;br /&gt;
::::report mautation test failure&lt;br /&gt;
:::else&lt;br /&gt;
::::report mutation test success&lt;br /&gt;
for each subfolder folder in the path&lt;br /&gt;
:mutation test(subfolder)&lt;br /&gt;
&lt;br /&gt;
===Design Pattern===&lt;br /&gt;
&lt;br /&gt;
Design patterns are not applicable as our task is involved in implementing the script to modify files and invoking tests.&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
&lt;br /&gt;
The project is about writing a python script to change the source code and run tests. It does not add any functionality to Servo. So there is no scope for testing in this project.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://www.guru99.com/mutation-testing.html&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://github.com/servo/servo&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo/wiki/Mutation-testing-project&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sdhegde</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112144</id>
		<title>CSC/ECE 517 Fall 2017/M1754 Mutation Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112144"/>
		<updated>2017-11-07T02:38:49Z</updated>

		<summary type="html">&lt;p&gt;Sdhegde: /* Existing Mutation Strategy */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Servo uses the Web Platform Test (WPT) suite for testing, but does not perform an evaluation of the breadth of the tests. The goal of this project is to use techniques from mutation testing to evaluate the performance of the WPT suite when bugs are deliberately introduced into the code base. &lt;br /&gt;
&lt;br /&gt;
The implementation of this project was done by writing python scripts that would modify the source code to generate mutants and run tests on them expecting failures. The scripts would temporarily modify the source codes, call the corresponding tests and revert back to the original code by reversing the changes that were made earlier. This process was repeated for multiple iterations by modifying various parts of the source code in random order.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use. [https://servo.org Servo] is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks. [https://en.wikipedia.org/wiki/Servo_(layout_engine)]&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://doc.rust-lang.org/book/second-edition/ Rust] is an open source,  systems programming language sponsored by Mozilla Research. Rust performs the majority of its safety checks and memory management decisions at compile time, so that program’s runtime performance is not impacted. Making it useful in programs with predictable space and time requirements, embedding in other languages, and writing low-level code, like device drivers and operating systems.&lt;br /&gt;
&lt;br /&gt;
===Web-platform-tests===&lt;br /&gt;
The [https://github.com/w3c/web-platform-tests web-platform-tests Project] is a W3C-coordinated attempt to build a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This, in turn, gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.&lt;br /&gt;
&lt;br /&gt;
===Mutation Testing===&lt;br /&gt;
Mutation Testing is a type of software testing where we mutate (change) certain statements in the source code and check if the test cases are able to find the errors.The goal of Mutation Testing is to assess the quality of the test cases which should be robust enough to fail mutant code. This method is also called as a Fault-based testing strategy as it involves creating faults in the program.Faults are introduced into the source code of the program by creating many versions called mutants. Each mutant should contain a single fault, and the goal is to cause the mutant version to fail which demonstrates the effectiveness of the test cases.[https://www.guru99.com/mutation-testing.html ]&lt;br /&gt;
&lt;br /&gt;
=='''Project description'''==&lt;br /&gt;
===Environment Setup===&lt;br /&gt;
* Clone the repository from [https://github.com/dsandeephegde/servo link]&lt;br /&gt;
* The steps to setup the environment for different OS are mentioned in readme file [https://github.com/servo/servo link].&lt;br /&gt;
&lt;br /&gt;
====Install packages==== &lt;br /&gt;
&lt;br /&gt;
Example, In OSX(homebrew):&lt;br /&gt;
&lt;br /&gt;
 brew install automake pkg-config python cmake yasm&lt;br /&gt;
 pip install virtualenv&lt;br /&gt;
&lt;br /&gt;
====Running test after setup====&lt;br /&gt;
&lt;br /&gt;
After the setup, make sure that everything works in your machine by building and running tests.&lt;br /&gt;
&lt;br /&gt;
build in release mode:&lt;br /&gt;
&lt;br /&gt;
 ./mach build --release&lt;br /&gt;
&lt;br /&gt;
run WPT tests:&lt;br /&gt;
&lt;br /&gt;
 ./mach test -wpt --release&lt;br /&gt;
&lt;br /&gt;
===Initial steps===&lt;br /&gt;
&lt;br /&gt;
*Implemented a simple mutator as a Python script that finds random uses of &amp;amp;&amp;amp; in Servo's code base and replaces them by ||.&lt;br /&gt;
*Built the mutated implementation of Servo with ./mach build -r and run it on the WPT test suite with ./mach test-wpt:  This produced test failures.&lt;br /&gt;
*Introduced test mapping framework to map source files to WPT test.&lt;br /&gt;
*Optimized the number of test runs by using test mapping to run only relevant tests for a mutant.&lt;br /&gt;
*Automated this process by writing scripts in a new python/servo/mutation directory, and called them from scripts in /etc/ci.&lt;br /&gt;
* Mutation test can be ran using either of the following command from the servo directory:&lt;br /&gt;
&lt;br /&gt;
 python python/servo/mutation/init.py components/script/dom&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 python etc/ci/mutation_test.py&lt;br /&gt;
&lt;br /&gt;
===Subsequent steps===&lt;br /&gt;
&lt;br /&gt;
* implement mutations like replacing if statements by if true/if false, duplicating statements, reordering statements, changing arithmetic &amp;amp; atomic string constant.&lt;br /&gt;
* improving the performance of the testing, for example randomizing the test order, fast-failing, running tests with faster builds (e.g. ./mach build -d).&lt;br /&gt;
* find heuristics for identifying false positives, that is mutations which are expected to have no effect, for example removing logging.&lt;br /&gt;
* find search heuristics for identifying mutations that cause no test failures.&lt;br /&gt;
&lt;br /&gt;
===Existing Mutation Strategy===&lt;br /&gt;
&lt;br /&gt;
* Replace random occurrence of &amp;amp;&amp;amp; with ||&lt;br /&gt;
&lt;br /&gt;
Example&lt;br /&gt;
&lt;br /&gt;
    if a &amp;amp;&amp;amp; b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    if a || b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
===Existing Excecution Flow===&lt;br /&gt;
&lt;br /&gt;
Given a path&lt;br /&gt;
:mutation test(path)&lt;br /&gt;
::Look for test mapping file in that path&lt;br /&gt;
::for each file the in the test mapping&lt;br /&gt;
:::skip this file if there are local uncommitted changes&lt;br /&gt;
:::mutate a random line using some strategy in the file&lt;br /&gt;
:::build project and run WPT tests corresponding to it&lt;br /&gt;
:::if wpt tests pass?&lt;br /&gt;
::::report mautation test failure&lt;br /&gt;
:::else&lt;br /&gt;
::::report mutation test success&lt;br /&gt;
for each subfolder folder in the path&lt;br /&gt;
:mutation test(subfolder)&lt;br /&gt;
&lt;br /&gt;
===Design Pattern===&lt;br /&gt;
&lt;br /&gt;
Design patterns are not applicable as our task is involved in implementing the script to modify files and invoking tests.&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
&lt;br /&gt;
The project is about writing a python script to change the source code and run tests. It does not add any functionality to Servo. So there is no scope for testing in this project.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://www.guru99.com/mutation-testing.html&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://github.com/servo/servo&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo/wiki/Mutation-testing-project&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sdhegde</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112143</id>
		<title>CSC/ECE 517 Fall 2017/M1754 Mutation Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112143"/>
		<updated>2017-11-07T02:38:15Z</updated>

		<summary type="html">&lt;p&gt;Sdhegde: /* Existing Mutation Strategy */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Servo uses the Web Platform Test (WPT) suite for testing, but does not perform an evaluation of the breadth of the tests. The goal of this project is to use techniques from mutation testing to evaluate the performance of the WPT suite when bugs are deliberately introduced into the code base. &lt;br /&gt;
&lt;br /&gt;
The implementation of this project was done by writing python scripts that would modify the source code to generate mutants and run tests on them expecting failures. The scripts would temporarily modify the source codes, call the corresponding tests and revert back to the original code by reversing the changes that were made earlier. This process was repeated for multiple iterations by modifying various parts of the source code in random order.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use. [https://servo.org Servo] is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks. [https://en.wikipedia.org/wiki/Servo_(layout_engine)]&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://doc.rust-lang.org/book/second-edition/ Rust] is an open source,  systems programming language sponsored by Mozilla Research. Rust performs the majority of its safety checks and memory management decisions at compile time, so that program’s runtime performance is not impacted. Making it useful in programs with predictable space and time requirements, embedding in other languages, and writing low-level code, like device drivers and operating systems.&lt;br /&gt;
&lt;br /&gt;
===Web-platform-tests===&lt;br /&gt;
The [https://github.com/w3c/web-platform-tests web-platform-tests Project] is a W3C-coordinated attempt to build a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This, in turn, gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.&lt;br /&gt;
&lt;br /&gt;
===Mutation Testing===&lt;br /&gt;
Mutation Testing is a type of software testing where we mutate (change) certain statements in the source code and check if the test cases are able to find the errors.The goal of Mutation Testing is to assess the quality of the test cases which should be robust enough to fail mutant code. This method is also called as a Fault-based testing strategy as it involves creating faults in the program.Faults are introduced into the source code of the program by creating many versions called mutants. Each mutant should contain a single fault, and the goal is to cause the mutant version to fail which demonstrates the effectiveness of the test cases.[https://www.guru99.com/mutation-testing.html ]&lt;br /&gt;
&lt;br /&gt;
=='''Project description'''==&lt;br /&gt;
===Environment Setup===&lt;br /&gt;
* Clone the repository from [https://github.com/dsandeephegde/servo link]&lt;br /&gt;
* The steps to setup the environment for different OS are mentioned in readme file [https://github.com/servo/servo link].&lt;br /&gt;
&lt;br /&gt;
====Install packages==== &lt;br /&gt;
&lt;br /&gt;
Example, In OSX(homebrew):&lt;br /&gt;
&lt;br /&gt;
 brew install automake pkg-config python cmake yasm&lt;br /&gt;
 pip install virtualenv&lt;br /&gt;
&lt;br /&gt;
====Running test after setup====&lt;br /&gt;
&lt;br /&gt;
After the setup, make sure that everything works in your machine by building and running tests.&lt;br /&gt;
&lt;br /&gt;
build in release mode:&lt;br /&gt;
&lt;br /&gt;
 ./mach build --release&lt;br /&gt;
&lt;br /&gt;
run WPT tests:&lt;br /&gt;
&lt;br /&gt;
 ./mach test -wpt --release&lt;br /&gt;
&lt;br /&gt;
===Initial steps===&lt;br /&gt;
&lt;br /&gt;
*Implemented a simple mutator as a Python script that finds random uses of &amp;amp;&amp;amp; in Servo's code base and replaces them by ||.&lt;br /&gt;
*Built the mutated implementation of Servo with ./mach build -r and run it on the WPT test suite with ./mach test-wpt:  This produced test failures.&lt;br /&gt;
*Introduced test mapping framework to map source files to WPT test.&lt;br /&gt;
*Optimized the number of test runs by using test mapping to run only relevant tests for a mutant.&lt;br /&gt;
*Automated this process by writing scripts in a new python/servo/mutation directory, and called them from scripts in /etc/ci.&lt;br /&gt;
* Mutation test can be ran using either of the following command from the servo directory:&lt;br /&gt;
&lt;br /&gt;
 python python/servo/mutation/init.py components/script/dom&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 python etc/ci/mutation_test.py&lt;br /&gt;
&lt;br /&gt;
===Subsequent steps===&lt;br /&gt;
&lt;br /&gt;
* implement mutations like replacing if statements by if true/if false, duplicating statements, reordering statements, changing arithmetic &amp;amp; atomic string constant.&lt;br /&gt;
* improving the performance of the testing, for example randomizing the test order, fast-failing, running tests with faster builds (e.g. ./mach build -d).&lt;br /&gt;
* find heuristics for identifying false positives, that is mutations which are expected to have no effect, for example removing logging.&lt;br /&gt;
* find search heuristics for identifying mutations that cause no test failures.&lt;br /&gt;
&lt;br /&gt;
===Existing Mutation Strategy===&lt;br /&gt;
&lt;br /&gt;
* Replace random occurrence of &amp;amp;&amp;amp; with ||&lt;br /&gt;
&lt;br /&gt;
    if a &amp;amp;&amp;amp; b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    if a || b {&lt;br /&gt;
        c = 1;&lt;br /&gt;
    } else {&lt;br /&gt;
        c = 0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
===Existing Excecution Flow===&lt;br /&gt;
&lt;br /&gt;
Given a path&lt;br /&gt;
:mutation test(path)&lt;br /&gt;
::Look for test mapping file in that path&lt;br /&gt;
::for each file the in the test mapping&lt;br /&gt;
:::skip this file if there are local uncommitted changes&lt;br /&gt;
:::mutate a random line using some strategy in the file&lt;br /&gt;
:::build project and run WPT tests corresponding to it&lt;br /&gt;
:::if wpt tests pass?&lt;br /&gt;
::::report mautation test failure&lt;br /&gt;
:::else&lt;br /&gt;
::::report mutation test success&lt;br /&gt;
for each subfolder folder in the path&lt;br /&gt;
:mutation test(subfolder)&lt;br /&gt;
&lt;br /&gt;
===Design Pattern===&lt;br /&gt;
&lt;br /&gt;
Design patterns are not applicable as our task is involved in implementing the script to modify files and invoking tests.&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
&lt;br /&gt;
The project is about writing a python script to change the source code and run tests. It does not add any functionality to Servo. So there is no scope for testing in this project.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://www.guru99.com/mutation-testing.html&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://github.com/servo/servo&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo/wiki/Mutation-testing-project&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sdhegde</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112138</id>
		<title>CSC/ECE 517 Fall 2017/M1754 Mutation Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112138"/>
		<updated>2017-11-07T02:33:16Z</updated>

		<summary type="html">&lt;p&gt;Sdhegde: /* Existing Mutation Strategy */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Servo uses the Web Platform Test (WPT) suite for testing, but does not perform an evaluation of the breadth of the tests. The goal of this project is to use techniques from mutation testing to evaluate the performance of the WPT suite when bugs are deliberately introduced into the code base. &lt;br /&gt;
&lt;br /&gt;
The implementation of this project was done by writing python scripts that would modify the source code to generate mutants and run tests on them expecting failures. The scripts would temporarily modify the source codes, call the corresponding tests and revert back to the original code by reversing the changes that were made earlier. This process was repeated for multiple iterations by modifying various parts of the source code in random order.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use. [https://servo.org Servo] is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks. [https://en.wikipedia.org/wiki/Servo_(layout_engine)]&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://doc.rust-lang.org/book/second-edition/ Rust] is an open source,  systems programming language sponsored by Mozilla Research. Rust performs the majority of its safety checks and memory management decisions at compile time, so that program’s runtime performance is not impacted. Making it useful in programs with predictable space and time requirements, embedding in other languages, and writing low-level code, like device drivers and operating systems.&lt;br /&gt;
&lt;br /&gt;
===Web-platform-tests===&lt;br /&gt;
The [https://github.com/w3c/web-platform-tests web-platform-tests Project] is a W3C-coordinated attempt to build a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This, in turn, gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.&lt;br /&gt;
&lt;br /&gt;
===Mutation Testing===&lt;br /&gt;
Mutation Testing is a type of software testing where we mutate (change) certain statements in the source code and check if the test cases are able to find the errors.The goal of Mutation Testing is to assess the quality of the test cases which should be robust enough to fail mutant code. This method is also called as a Fault-based testing strategy as it involves creating faults in the program.Faults are introduced into the source code of the program by creating many versions called mutants. Each mutant should contain a single fault, and the goal is to cause the mutant version to fail which demonstrates the effectiveness of the test cases.[https://www.guru99.com/mutation-testing.html ]&lt;br /&gt;
&lt;br /&gt;
=='''Project description'''==&lt;br /&gt;
===Environment Setup===&lt;br /&gt;
* Clone the repository from [https://github.com/dsandeephegde/servo link]&lt;br /&gt;
* The steps to setup the environment for different OS are mentioned in readme file [https://github.com/servo/servo link].&lt;br /&gt;
&lt;br /&gt;
====Install packages==== &lt;br /&gt;
&lt;br /&gt;
Example, In OSX(homebrew):&lt;br /&gt;
&lt;br /&gt;
 brew install automake pkg-config python cmake yasm&lt;br /&gt;
 pip install virtualenv&lt;br /&gt;
&lt;br /&gt;
====Running test after setup====&lt;br /&gt;
&lt;br /&gt;
After the setup, make sure that everything works in your machine by building and running tests.&lt;br /&gt;
&lt;br /&gt;
build in release mode:&lt;br /&gt;
&lt;br /&gt;
 ./mach build --release&lt;br /&gt;
&lt;br /&gt;
run WPT tests:&lt;br /&gt;
&lt;br /&gt;
 ./mach test -wpt --release&lt;br /&gt;
&lt;br /&gt;
===Initial steps===&lt;br /&gt;
&lt;br /&gt;
*Implemented a simple mutator as a Python script that finds random uses of &amp;amp;&amp;amp; in Servo's code base and replaces them by ||.&lt;br /&gt;
*Built the mutated implementation of Servo with ./mach build -r and run it on the WPT test suite with ./mach test-wpt:  This produced test failures.&lt;br /&gt;
*Introduced test mapping framework to map source files to WPT test.&lt;br /&gt;
*Optimized the number of test runs by using test mapping to run only relevant tests for a mutant.&lt;br /&gt;
*Automated this process by writing scripts in a new python/servo/mutation directory, and called them from scripts in /etc/ci.&lt;br /&gt;
* Mutation test can be ran using either of the following command from the servo directory:&lt;br /&gt;
&lt;br /&gt;
 python python/servo/mutation/init.py components/script/dom&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 python etc/ci/mutation_test.py&lt;br /&gt;
&lt;br /&gt;
===Subsequent steps===&lt;br /&gt;
&lt;br /&gt;
* implement mutations like replacing if statements by if true/if false, duplicating statements, reordering statements, changing arithmetic &amp;amp; atomic string constant.&lt;br /&gt;
* improving the performance of the testing, for example randomizing the test order, fast-failing, running tests with faster builds (e.g. ./mach build -d).&lt;br /&gt;
* find heuristics for identifying false positives, that is mutations which are expected to have no effect, for example removing logging.&lt;br /&gt;
* find search heuristics for identifying mutations that cause no test failures.&lt;br /&gt;
&lt;br /&gt;
===Existing Mutation Strategy===&lt;br /&gt;
&lt;br /&gt;
* Replace random occurrence of &amp;amp;&amp;amp; with ||&lt;br /&gt;
&lt;br /&gt;
    `if n &amp;lt; 0 {&lt;br /&gt;
        print!(&amp;quot;{} is negative&amp;quot;, n);&lt;br /&gt;
    } else if n &amp;gt; 0 {&lt;br /&gt;
        print!(&amp;quot;{} is positive&amp;quot;, n);&lt;br /&gt;
    } else {&lt;br /&gt;
        print!(&amp;quot;{} is zero&amp;quot;, n);&lt;br /&gt;
    }`&lt;br /&gt;
&lt;br /&gt;
===Existing Excecution Flow===&lt;br /&gt;
&lt;br /&gt;
Given a path&lt;br /&gt;
:mutation test(path)&lt;br /&gt;
::Look for test mapping file in that path&lt;br /&gt;
::for each file the in the test mapping&lt;br /&gt;
:::skip this file if there are local uncommitted changes&lt;br /&gt;
:::mutate a random line using some strategy in the file&lt;br /&gt;
:::build project and run WPT tests corresponding to it&lt;br /&gt;
:::if wpt tests pass?&lt;br /&gt;
::::report mautation test failure&lt;br /&gt;
:::else&lt;br /&gt;
::::report mutation test success&lt;br /&gt;
for each subfolder folder in the path&lt;br /&gt;
:mutation test(subfolder)&lt;br /&gt;
&lt;br /&gt;
===Design Pattern===&lt;br /&gt;
&lt;br /&gt;
Design patterns are not applicable as our task is involved in implementing the script to modify files and invoking tests.&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
&lt;br /&gt;
The project is about writing a python script to change the source code and run tests. It does not add any functionality to Servo. So there is no scope for testing in this project.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://www.guru99.com/mutation-testing.html&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://github.com/servo/servo&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo/wiki/Mutation-testing-project&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sdhegde</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112135</id>
		<title>CSC/ECE 517 Fall 2017/M1754 Mutation Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112135"/>
		<updated>2017-11-07T02:31:30Z</updated>

		<summary type="html">&lt;p&gt;Sdhegde: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Servo uses the Web Platform Test (WPT) suite for testing, but does not perform an evaluation of the breadth of the tests. The goal of this project is to use techniques from mutation testing to evaluate the performance of the WPT suite when bugs are deliberately introduced into the code base. &lt;br /&gt;
&lt;br /&gt;
The implementation of this project was done by writing python scripts that would modify the source code to generate mutants and run tests on them expecting failures. The scripts would temporarily modify the source codes, call the corresponding tests and revert back to the original code by reversing the changes that were made earlier. This process was repeated for multiple iterations by modifying various parts of the source code in random order.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use. [https://servo.org Servo] is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks. [https://en.wikipedia.org/wiki/Servo_(layout_engine)]&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://doc.rust-lang.org/book/second-edition/ Rust] is an open source,  systems programming language sponsored by Mozilla Research. Rust performs the majority of its safety checks and memory management decisions at compile time, so that program’s runtime performance is not impacted. Making it useful in programs with predictable space and time requirements, embedding in other languages, and writing low-level code, like device drivers and operating systems.&lt;br /&gt;
&lt;br /&gt;
===Web-platform-tests===&lt;br /&gt;
The [https://github.com/w3c/web-platform-tests web-platform-tests Project] is a W3C-coordinated attempt to build a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This, in turn, gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.&lt;br /&gt;
&lt;br /&gt;
===Mutation Testing===&lt;br /&gt;
Mutation Testing is a type of software testing where we mutate (change) certain statements in the source code and check if the test cases are able to find the errors.The goal of Mutation Testing is to assess the quality of the test cases which should be robust enough to fail mutant code. This method is also called as a Fault-based testing strategy as it involves creating faults in the program.Faults are introduced into the source code of the program by creating many versions called mutants. Each mutant should contain a single fault, and the goal is to cause the mutant version to fail which demonstrates the effectiveness of the test cases.[https://www.guru99.com/mutation-testing.html ]&lt;br /&gt;
&lt;br /&gt;
=='''Project description'''==&lt;br /&gt;
===Environment Setup===&lt;br /&gt;
* Clone the repository from [https://github.com/dsandeephegde/servo link]&lt;br /&gt;
* The steps to setup the environment for different OS are mentioned in readme file [https://github.com/servo/servo link].&lt;br /&gt;
&lt;br /&gt;
====Install packages==== &lt;br /&gt;
&lt;br /&gt;
Example, In OSX(homebrew):&lt;br /&gt;
&lt;br /&gt;
 brew install automake pkg-config python cmake yasm&lt;br /&gt;
 pip install virtualenv&lt;br /&gt;
&lt;br /&gt;
====Running test after setup====&lt;br /&gt;
&lt;br /&gt;
After the setup, make sure that everything works in your machine by building and running tests.&lt;br /&gt;
&lt;br /&gt;
build in release mode:&lt;br /&gt;
&lt;br /&gt;
 ./mach build --release&lt;br /&gt;
&lt;br /&gt;
run WPT tests:&lt;br /&gt;
&lt;br /&gt;
 ./mach test -wpt --release&lt;br /&gt;
&lt;br /&gt;
===Initial steps===&lt;br /&gt;
&lt;br /&gt;
*Implemented a simple mutator as a Python script that finds random uses of &amp;amp;&amp;amp; in Servo's code base and replaces them by ||.&lt;br /&gt;
*Built the mutated implementation of Servo with ./mach build -r and run it on the WPT test suite with ./mach test-wpt:  This produced test failures.&lt;br /&gt;
*Introduced test mapping framework to map source files to WPT test.&lt;br /&gt;
*Optimized the number of test runs by using test mapping to run only relevant tests for a mutant.&lt;br /&gt;
*Automated this process by writing scripts in a new python/servo/mutation directory, and called them from scripts in /etc/ci.&lt;br /&gt;
* Mutation test can be ran using either of the following command from the servo directory:&lt;br /&gt;
&lt;br /&gt;
 python python/servo/mutation/init.py components/script/dom&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 python etc/ci/mutation_test.py&lt;br /&gt;
&lt;br /&gt;
===Subsequent steps===&lt;br /&gt;
&lt;br /&gt;
* implement mutations like replacing if statements by if true/if false, duplicating statements, reordering statements, changing arithmetic &amp;amp; atomic string constant.&lt;br /&gt;
* improving the performance of the testing, for example randomizing the test order, fast-failing, running tests with faster builds (e.g. ./mach build -d).&lt;br /&gt;
* find heuristics for identifying false positives, that is mutations which are expected to have no effect, for example removing logging.&lt;br /&gt;
* find search heuristics for identifying mutations that cause no test failures.&lt;br /&gt;
&lt;br /&gt;
===Existing Mutation Strategy===&lt;br /&gt;
&lt;br /&gt;
* Replace random occurrence of &amp;amp;&amp;amp; with ||&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Existing Excecution Flow===&lt;br /&gt;
&lt;br /&gt;
Given a path&lt;br /&gt;
:mutation test(path)&lt;br /&gt;
::Look for test mapping file in that path&lt;br /&gt;
::for each file the in the test mapping&lt;br /&gt;
:::skip this file if there are local uncommitted changes&lt;br /&gt;
:::mutate a random line using some strategy in the file&lt;br /&gt;
:::build project and run WPT tests corresponding to it&lt;br /&gt;
:::if wpt tests pass?&lt;br /&gt;
::::report mautation test failure&lt;br /&gt;
:::else&lt;br /&gt;
::::report mutation test success&lt;br /&gt;
for each subfolder folder in the path&lt;br /&gt;
:mutation test(subfolder)&lt;br /&gt;
&lt;br /&gt;
===Design Pattern===&lt;br /&gt;
&lt;br /&gt;
Design patterns are not applicable as our task is involved in implementing the script to modify files and invoking tests.&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
&lt;br /&gt;
The project is about writing a python script to change the source code and run tests. It does not add any functionality to Servo. So there is no scope for testing in this project.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://www.guru99.com/mutation-testing.html&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://github.com/servo/servo&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo/wiki/Mutation-testing-project&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sdhegde</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112106</id>
		<title>CSC/ECE 517 Fall 2017/M1754 Mutation Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112106"/>
		<updated>2017-11-07T01:47:20Z</updated>

		<summary type="html">&lt;p&gt;Sdhegde: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Servo uses the Web Platform Test (WPT) suite for testing, but does not perform an evaluation of the breadth of the tests. The goal of this project is to use techniques from mutation testing to evaluate the performance of the WPT suite when bugs are deliberately introduced into the code base. &lt;br /&gt;
&lt;br /&gt;
The implementation of this project was done by writing python scripts that would modify the source code to generate mutants and run tests on them expecting failures. The scripts would temporarily modify the source codes, call the corresponding tests and revert back to the original code by reversing the changes that were made earlier. This process was repeated for multiple iterations by modifying various parts of the source code in random order.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use. [https://servo.org Servo] is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks. [https://en.wikipedia.org/wiki/Servo_(layout_engine)]&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://doc.rust-lang.org/book/second-edition/ Rust] is an open source,  systems programming language sponsored by Mozilla Research. Rust performs the majority of its safety checks and memory management decisions at compile time, so that program’s runtime performance is not impacted. Making it useful in programs with predictable space and time requirements, embedding in other languages, and writing low-level code, like device drivers and operating systems.&lt;br /&gt;
&lt;br /&gt;
===Web-platform-tests===&lt;br /&gt;
The [https://github.com/w3c/web-platform-tests web-platform-tests Project] is a W3C-coordinated attempt to build a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This, in turn, gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.&lt;br /&gt;
&lt;br /&gt;
===Mutation Testing===&lt;br /&gt;
Mutation Testing is a type of software testing where we mutate (change) certain statements in the source code and check if the test cases are able to find the errors.The goal of Mutation Testing is to assess the quality of the test cases which should be robust enough to fail mutant code. This method is also called as a Fault-based testing strategy as it involves creating faults in the program.Faults are introduced into the source code of the program by creating many versions called mutants. Each mutant should contain a single fault, and the goal is to cause the mutant version to fail which demonstrates the effectiveness of the test cases.[https://www.guru99.com/mutation-testing.html ]&lt;br /&gt;
&lt;br /&gt;
=='''Project description'''==&lt;br /&gt;
===Environment Setup===&lt;br /&gt;
* Clone the repository from [https://github.com/dsandeephegde/servo link]&lt;br /&gt;
* The steps to setup the environment for different OS are mentioned in readme file [https://github.com/servo/servo link].&lt;br /&gt;
&lt;br /&gt;
====Install packages==== &lt;br /&gt;
&lt;br /&gt;
Example, In OSX(homebrew):&lt;br /&gt;
&lt;br /&gt;
 brew install automake pkg-config python cmake yasm&lt;br /&gt;
 pip install virtualenv&lt;br /&gt;
&lt;br /&gt;
====Running test after setup====&lt;br /&gt;
&lt;br /&gt;
After the setup, make sure that everything works in your machine by building and running tests.&lt;br /&gt;
&lt;br /&gt;
build in release mode:&lt;br /&gt;
&lt;br /&gt;
 ./mach build --release&lt;br /&gt;
&lt;br /&gt;
run WPT tests:&lt;br /&gt;
&lt;br /&gt;
 ./mach test -wpt --release&lt;br /&gt;
&lt;br /&gt;
===Initial steps===&lt;br /&gt;
&lt;br /&gt;
*Implemented a simple mutator as a Python script that finds random uses of &amp;amp;&amp;amp; in Servo's code base and replaces them by ||.&lt;br /&gt;
*Built the mutated implementation of Servo with ./mach build -r and run it on the WPT test suite with ./mach test-wpt:  This produced test failures.&lt;br /&gt;
*Introduced test mapping framework to map source files to WPT test.&lt;br /&gt;
*Optimized the number of test runs by using test mapping to run only relevant tests for a mutant.&lt;br /&gt;
*Automated this process by writing scripts in a new python/servo/mutation directory, and called them from scripts in /etc/ci.&lt;br /&gt;
* Mutation test can be ran using either of the following command from the servo directory:&lt;br /&gt;
&lt;br /&gt;
 python python/servo/mutation/init.py components/script/dom&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 python etc/ci/mutation_test.py&lt;br /&gt;
&lt;br /&gt;
===Subsequent steps===&lt;br /&gt;
&lt;br /&gt;
* implement mutations like replacing if statements by if true/if false, duplicating statements, reordering statements, changing arithmetic &amp;amp; atomic string constant.&lt;br /&gt;
* improving the performance of the testing, for example randomizing the test order, fast-failing, running tests with faster builds (e.g. ./mach build -d).&lt;br /&gt;
* find heuristics for identifying false positives, that is mutations which are expected to have no effect, for example removing logging.&lt;br /&gt;
* find search heuristics for identifying mutations that cause no test failures.&lt;br /&gt;
&lt;br /&gt;
===Existing Excecution Flow===&lt;br /&gt;
&lt;br /&gt;
Given a path&lt;br /&gt;
:mutation test(path)&lt;br /&gt;
::Look for test mapping file in that path&lt;br /&gt;
::for each file the in the test mapping&lt;br /&gt;
:::skip this file if there are local uncommitted changes&lt;br /&gt;
:::mutate a random line using some strategy in the file&lt;br /&gt;
:::build project and run WPT tests corresponding to it&lt;br /&gt;
:::if wpt tests pass?&lt;br /&gt;
::::report mautation test failure&lt;br /&gt;
:::else&lt;br /&gt;
::::report mutation test success&lt;br /&gt;
for each subfolder folder in the path&lt;br /&gt;
:mutation test(subfolder)&lt;br /&gt;
&lt;br /&gt;
===Design Pattern===&lt;br /&gt;
&lt;br /&gt;
Design patterns are not applicable as our task is involved in implementing the script to modify files and invoking tests.&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
&lt;br /&gt;
The project is about writing a python script to change the source code and run tests. It does not add any functionality to Servo. So there is no scope for testing in this project.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://www.guru99.com/mutation-testing.html&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://github.com/servo/servo&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo/wiki/Mutation-testing-project&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sdhegde</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112104</id>
		<title>CSC/ECE 517 Fall 2017/M1754 Mutation Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112104"/>
		<updated>2017-11-07T01:36:40Z</updated>

		<summary type="html">&lt;p&gt;Sdhegde: /* Excecution Flow */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Servo uses the Web Platform Test (WPT) suite for testing, but does not perform an evaluation of the breadth of the tests. The goal of this project is to use techniques from mutation testing to evaluate the performance of the WPT suite when bugs are deliberately introduced into the code base. &lt;br /&gt;
&lt;br /&gt;
The implementation of this project was done by writing python scripts that would modify the source code to generate mutants and run tests on them expecting failures. The scripts would temporarily modify the source codes, call the corresponding tests and revert back to the original code by reversing the changes that were made earlier. This process was repeated for multiple iterations by modifying various parts of the source code in random order.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use. [https://servo.org Servo] is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks. [https://en.wikipedia.org/wiki/Servo_(layout_engine)]&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://doc.rust-lang.org/book/second-edition/ Rust] is an open source,  systems programming language sponsored by Mozilla Research. Rust performs the majority of its safety checks and memory management decisions at compile time, so that program’s runtime performance is not impacted. Making it useful in programs with predictable space and time requirements, embedding in other languages, and writing low-level code, like device drivers and operating systems.&lt;br /&gt;
&lt;br /&gt;
===Web-platform-tests===&lt;br /&gt;
The [https://github.com/w3c/web-platform-tests web-platform-tests Project] is a W3C-coordinated attempt to build a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This, in turn, gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.&lt;br /&gt;
&lt;br /&gt;
===Mutation Testing===&lt;br /&gt;
Mutation Testing is a type of software testing where we mutate (change) certain statements in the source code and check if the test cases are able to find the errors.The goal of Mutation Testing is to assess the quality of the test cases which should be robust enough to fail mutant code. This method is also called as a Fault-based testing strategy as it involves creating faults in the program.Faults are introduced into the source code of the program by creating many versions called mutants. Each mutant should contain a single fault, and the goal is to cause the mutant version to fail which demonstrates the effectiveness of the test cases.[https://www.guru99.com/mutation-testing.html ]&lt;br /&gt;
&lt;br /&gt;
=='''Project description'''==&lt;br /&gt;
===Environment Setup===&lt;br /&gt;
* Clone the repository from [https://github.com/dsandeephegde/servo link]&lt;br /&gt;
* The steps to setup the environment for different OS are mentioned in readme file [https://github.com/servo/servo link].&lt;br /&gt;
&lt;br /&gt;
====Install packages==== &lt;br /&gt;
&lt;br /&gt;
Example, In OSX(homebrew):&lt;br /&gt;
&lt;br /&gt;
 brew install automake pkg-config python cmake yasm&lt;br /&gt;
 pip install virtualenv&lt;br /&gt;
&lt;br /&gt;
====Running test after setup====&lt;br /&gt;
&lt;br /&gt;
After the setup, make sure that everything works in your machine by building and running tests.&lt;br /&gt;
&lt;br /&gt;
build in release mode:&lt;br /&gt;
&lt;br /&gt;
 ./mach build --release&lt;br /&gt;
&lt;br /&gt;
run WPT tests:&lt;br /&gt;
&lt;br /&gt;
 ./mach test -wpt --release&lt;br /&gt;
&lt;br /&gt;
===Initial steps===&lt;br /&gt;
&lt;br /&gt;
*Implemented a simple mutator as a Python script that finds random uses of &amp;amp;&amp;amp; in Servo's code base and replaces them by ||.&lt;br /&gt;
*Built the mutated implementation of Servo with ./mach build -r and run it on the WPT test suite with ./mach test-wpt:  This produced test failures.&lt;br /&gt;
*Introduced test mapping framework to map source files to WPT test.&lt;br /&gt;
*Optimized the number of test runs by using test mapping to run only relevant tests for a mutant.&lt;br /&gt;
*Automated this process by writing scripts in a new python/servo/mutation directory, and called them from scripts in /etc/ci.&lt;br /&gt;
* Mutation test can be ran using either of the following command from the servo directory:&lt;br /&gt;
&lt;br /&gt;
 python python/servo/mutation/init.py components/script/dom&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 python etc/ci/mutation_test.py&lt;br /&gt;
&lt;br /&gt;
===Subsequent steps===&lt;br /&gt;
&lt;br /&gt;
* implement mutations like replacing if statements by if true/if false, duplicating statements, reordering statements, changing arithmetic &amp;amp; atomic string constant.&lt;br /&gt;
* improving the performance of the testing, for example randomizing the test order, fast-failing, running tests with faster builds (e.g. ./mach build -d).&lt;br /&gt;
* find heuristics for identifying false positives, that is mutations which are expected to have no effect, for example removing logging.&lt;br /&gt;
* find search heuristics for identifying mutations that cause no test failures.&lt;br /&gt;
&lt;br /&gt;
===Existing Excecution Flow===&lt;br /&gt;
&lt;br /&gt;
Given a path&lt;br /&gt;
:mutation test(path)&lt;br /&gt;
::Look for test mapping file in that path&lt;br /&gt;
::for each file the in the test mapping&lt;br /&gt;
:::skip this file if there are local uncommitted changes&lt;br /&gt;
:::mutate a random line using some strategy in the file&lt;br /&gt;
:::build project and run WPT tests corresponding to it&lt;br /&gt;
:::if wpt tests pass?&lt;br /&gt;
::::report mautation test failure&lt;br /&gt;
:::else&lt;br /&gt;
::::report mutation test success&lt;br /&gt;
for each subfolder folder in the path&lt;br /&gt;
:mutation test(subfolder)&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
&lt;br /&gt;
The project is about writing a python script to change the source code and run tests. It does not add any functionality to Servo. So there is no scope for testing in this project.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://www.guru99.com/mutation-testing.html&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://github.com/servo/servo&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo/wiki/Mutation-testing-project&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sdhegde</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112103</id>
		<title>CSC/ECE 517 Fall 2017/M1754 Mutation Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112103"/>
		<updated>2017-11-07T01:35:20Z</updated>

		<summary type="html">&lt;p&gt;Sdhegde: /* Initial steps */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Servo uses the Web Platform Test (WPT) suite for testing, but does not perform an evaluation of the breadth of the tests. The goal of this project is to use techniques from mutation testing to evaluate the performance of the WPT suite when bugs are deliberately introduced into the code base. &lt;br /&gt;
&lt;br /&gt;
The implementation of this project was done by writing python scripts that would modify the source code to generate mutants and run tests on them expecting failures. The scripts would temporarily modify the source codes, call the corresponding tests and revert back to the original code by reversing the changes that were made earlier. This process was repeated for multiple iterations by modifying various parts of the source code in random order.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use. [https://servo.org Servo] is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks. [https://en.wikipedia.org/wiki/Servo_(layout_engine)]&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://doc.rust-lang.org/book/second-edition/ Rust] is an open source,  systems programming language sponsored by Mozilla Research. Rust performs the majority of its safety checks and memory management decisions at compile time, so that program’s runtime performance is not impacted. Making it useful in programs with predictable space and time requirements, embedding in other languages, and writing low-level code, like device drivers and operating systems.&lt;br /&gt;
&lt;br /&gt;
===Web-platform-tests===&lt;br /&gt;
The [https://github.com/w3c/web-platform-tests web-platform-tests Project] is a W3C-coordinated attempt to build a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This, in turn, gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.&lt;br /&gt;
&lt;br /&gt;
===Mutation Testing===&lt;br /&gt;
Mutation Testing is a type of software testing where we mutate (change) certain statements in the source code and check if the test cases are able to find the errors.The goal of Mutation Testing is to assess the quality of the test cases which should be robust enough to fail mutant code. This method is also called as a Fault-based testing strategy as it involves creating faults in the program.Faults are introduced into the source code of the program by creating many versions called mutants. Each mutant should contain a single fault, and the goal is to cause the mutant version to fail which demonstrates the effectiveness of the test cases.[https://www.guru99.com/mutation-testing.html ]&lt;br /&gt;
&lt;br /&gt;
=='''Project description'''==&lt;br /&gt;
===Environment Setup===&lt;br /&gt;
* Clone the repository from [https://github.com/dsandeephegde/servo link]&lt;br /&gt;
* The steps to setup the environment for different OS are mentioned in readme file [https://github.com/servo/servo link].&lt;br /&gt;
&lt;br /&gt;
====Install packages==== &lt;br /&gt;
&lt;br /&gt;
Example, In OSX(homebrew):&lt;br /&gt;
&lt;br /&gt;
 brew install automake pkg-config python cmake yasm&lt;br /&gt;
 pip install virtualenv&lt;br /&gt;
&lt;br /&gt;
====Running test after setup====&lt;br /&gt;
&lt;br /&gt;
After the setup, make sure that everything works in your machine by building and running tests.&lt;br /&gt;
&lt;br /&gt;
build in release mode:&lt;br /&gt;
&lt;br /&gt;
 ./mach build --release&lt;br /&gt;
&lt;br /&gt;
run WPT tests:&lt;br /&gt;
&lt;br /&gt;
 ./mach test -wpt --release&lt;br /&gt;
&lt;br /&gt;
===Initial steps===&lt;br /&gt;
&lt;br /&gt;
*Implemented a simple mutator as a Python script that finds random uses of &amp;amp;&amp;amp; in Servo's code base and replaces them by ||.&lt;br /&gt;
*Built the mutated implementation of Servo with ./mach build -r and run it on the WPT test suite with ./mach test-wpt:  This produced test failures.&lt;br /&gt;
*Introduced test mapping framework to map source files to WPT test.&lt;br /&gt;
*Optimized the number of test runs by using test mapping to run only relevant tests for a mutant.&lt;br /&gt;
*Automated this process by writing scripts in a new python/servo/mutation directory, and called them from scripts in /etc/ci.&lt;br /&gt;
* Mutation test can be ran using either of the following command from the servo directory:&lt;br /&gt;
&lt;br /&gt;
 python python/servo/mutation/init.py components/script/dom&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 python etc/ci/mutation_test.py&lt;br /&gt;
&lt;br /&gt;
===Subsequent steps===&lt;br /&gt;
&lt;br /&gt;
* implement mutations like replacing if statements by if true/if false, duplicating statements, reordering statements, changing arithmetic &amp;amp; atomic string constant.&lt;br /&gt;
* improving the performance of the testing, for example randomizing the test order, fast-failing, running tests with faster builds (e.g. ./mach build -d).&lt;br /&gt;
* find heuristics for identifying false positives, that is mutations which are expected to have no effect, for example removing logging.&lt;br /&gt;
* find search heuristics for identifying mutations that cause no test failures.&lt;br /&gt;
&lt;br /&gt;
===Excecution Flow===&lt;br /&gt;
&lt;br /&gt;
Given a path&lt;br /&gt;
:mutation test(path)&lt;br /&gt;
::Look for test mapping file in that path&lt;br /&gt;
::for each file the in the test mapping&lt;br /&gt;
:::mutate a random line using some strategy in the file&lt;br /&gt;
:::build project and run WPT tests corresponding to it&lt;br /&gt;
:::if wpt tests pass?&lt;br /&gt;
::::report mautation test failure&lt;br /&gt;
:::else&lt;br /&gt;
::::report mutation test success&lt;br /&gt;
for each subfolder folder in the path&lt;br /&gt;
:mutation test(subfolder)&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
&lt;br /&gt;
The project is about writing a python script to change the source code and run tests. It does not add any functionality to Servo. So there is no scope for testing in this project.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://www.guru99.com/mutation-testing.html&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://github.com/servo/servo&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo/wiki/Mutation-testing-project&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sdhegde</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112102</id>
		<title>CSC/ECE 517 Fall 2017/M1754 Mutation Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112102"/>
		<updated>2017-11-07T01:34:58Z</updated>

		<summary type="html">&lt;p&gt;Sdhegde: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Servo uses the Web Platform Test (WPT) suite for testing, but does not perform an evaluation of the breadth of the tests. The goal of this project is to use techniques from mutation testing to evaluate the performance of the WPT suite when bugs are deliberately introduced into the code base. &lt;br /&gt;
&lt;br /&gt;
The implementation of this project was done by writing python scripts that would modify the source code to generate mutants and run tests on them expecting failures. The scripts would temporarily modify the source codes, call the corresponding tests and revert back to the original code by reversing the changes that were made earlier. This process was repeated for multiple iterations by modifying various parts of the source code in random order.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use. [https://servo.org Servo] is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks. [https://en.wikipedia.org/wiki/Servo_(layout_engine)]&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://doc.rust-lang.org/book/second-edition/ Rust] is an open source,  systems programming language sponsored by Mozilla Research. Rust performs the majority of its safety checks and memory management decisions at compile time, so that program’s runtime performance is not impacted. Making it useful in programs with predictable space and time requirements, embedding in other languages, and writing low-level code, like device drivers and operating systems.&lt;br /&gt;
&lt;br /&gt;
===Web-platform-tests===&lt;br /&gt;
The [https://github.com/w3c/web-platform-tests web-platform-tests Project] is a W3C-coordinated attempt to build a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This, in turn, gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.&lt;br /&gt;
&lt;br /&gt;
===Mutation Testing===&lt;br /&gt;
Mutation Testing is a type of software testing where we mutate (change) certain statements in the source code and check if the test cases are able to find the errors.The goal of Mutation Testing is to assess the quality of the test cases which should be robust enough to fail mutant code. This method is also called as a Fault-based testing strategy as it involves creating faults in the program.Faults are introduced into the source code of the program by creating many versions called mutants. Each mutant should contain a single fault, and the goal is to cause the mutant version to fail which demonstrates the effectiveness of the test cases.[https://www.guru99.com/mutation-testing.html ]&lt;br /&gt;
&lt;br /&gt;
=='''Project description'''==&lt;br /&gt;
===Environment Setup===&lt;br /&gt;
* Clone the repository from [https://github.com/dsandeephegde/servo link]&lt;br /&gt;
* The steps to setup the environment for different OS are mentioned in readme file [https://github.com/servo/servo link].&lt;br /&gt;
&lt;br /&gt;
====Install packages==== &lt;br /&gt;
&lt;br /&gt;
Example, In OSX(homebrew):&lt;br /&gt;
&lt;br /&gt;
 brew install automake pkg-config python cmake yasm&lt;br /&gt;
 pip install virtualenv&lt;br /&gt;
&lt;br /&gt;
====Running test after setup====&lt;br /&gt;
&lt;br /&gt;
After the setup, make sure that everything works in your machine by building and running tests.&lt;br /&gt;
&lt;br /&gt;
build in release mode:&lt;br /&gt;
&lt;br /&gt;
 ./mach build --release&lt;br /&gt;
&lt;br /&gt;
run WPT tests:&lt;br /&gt;
&lt;br /&gt;
 ./mach test -wpt --release&lt;br /&gt;
&lt;br /&gt;
===Initial steps===&lt;br /&gt;
&lt;br /&gt;
*Implemented a simple mutator as a Python script that finds random uses of &amp;amp;&amp;amp; in Servo's code base and replaces them by ||.&lt;br /&gt;
*Built the mutated implementation of Servo with ./mach build -r and run it on the WPT test suite with ./mach test-wpt:  This produced test failures.&lt;br /&gt;
*Introduced test mapping framework to map source files to WPT test.&lt;br /&gt;
*Optimized the number of test runs by using test mapping to run only relevant tests for a mutant.&lt;br /&gt;
*Automated this process by writing scripts in a new python/servo/mutation directory, and called them from scripts in /etc/ci.&lt;br /&gt;
&lt;br /&gt;
* Mutation test can be ran using either of the following command from the servo directory:&lt;br /&gt;
&lt;br /&gt;
 python python/servo/mutation/init.py components/script/dom&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 python etc/ci/mutation_test.py&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Subsequent steps===&lt;br /&gt;
&lt;br /&gt;
* implement mutations like replacing if statements by if true/if false, duplicating statements, reordering statements, changing arithmetic &amp;amp; atomic string constant.&lt;br /&gt;
* improving the performance of the testing, for example randomizing the test order, fast-failing, running tests with faster builds (e.g. ./mach build -d).&lt;br /&gt;
* find heuristics for identifying false positives, that is mutations which are expected to have no effect, for example removing logging.&lt;br /&gt;
* find search heuristics for identifying mutations that cause no test failures.&lt;br /&gt;
&lt;br /&gt;
===Excecution Flow===&lt;br /&gt;
&lt;br /&gt;
Given a path&lt;br /&gt;
:mutation test(path)&lt;br /&gt;
::Look for test mapping file in that path&lt;br /&gt;
::for each file the in the test mapping&lt;br /&gt;
:::mutate a random line using some strategy in the file&lt;br /&gt;
:::build project and run WPT tests corresponding to it&lt;br /&gt;
:::if wpt tests pass?&lt;br /&gt;
::::report mautation test failure&lt;br /&gt;
:::else&lt;br /&gt;
::::report mutation test success&lt;br /&gt;
for each subfolder folder in the path&lt;br /&gt;
:mutation test(subfolder)&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
&lt;br /&gt;
The project is about writing a python script to change the source code and run tests. It does not add any functionality to Servo. So there is no scope for testing in this project.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://www.guru99.com/mutation-testing.html&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://github.com/servo/servo&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo/wiki/Mutation-testing-project&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sdhegde</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112101</id>
		<title>CSC/ECE 517 Fall 2017/M1754 Mutation Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112101"/>
		<updated>2017-11-07T01:30:43Z</updated>

		<summary type="html">&lt;p&gt;Sdhegde: /* Initial steps */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Servo uses the Web Platform Test (WPT) suite for testing, but does not perform an evaluation of the breadth of the tests. The goal of this project is to use techniques from mutation testing to evaluate the performance of the WPT suite when bugs are deliberately introduced into the code base. &lt;br /&gt;
&lt;br /&gt;
The implementation of this project was done by writing python scripts that would modify the source code to generate mutants and run tests on them expecting failures. The scripts would temporarily modify the source codes, call the corresponding tests and revert back to the original code by reversing the changes that were made earlier. This process was repeated for multiple iterations by modifying various parts of the source code in random order.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use. [https://servo.org Servo] is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks. [https://en.wikipedia.org/wiki/Servo_(layout_engine)]&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://doc.rust-lang.org/book/second-edition/ Rust] is an open source,  systems programming language sponsored by Mozilla Research. Rust performs the majority of its safety checks and memory management decisions at compile time, so that program’s runtime performance is not impacted. Making it useful in programs with predictable space and time requirements, embedding in other languages, and writing low-level code, like device drivers and operating systems.&lt;br /&gt;
&lt;br /&gt;
===Web-platform-tests===&lt;br /&gt;
The [https://github.com/w3c/web-platform-tests web-platform-tests Project] is a W3C-coordinated attempt to build a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This, in turn, gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.&lt;br /&gt;
&lt;br /&gt;
===Mutation Testing===&lt;br /&gt;
Mutation Testing is a type of software testing where we mutate (change) certain statements in the source code and check if the test cases are able to find the errors.The goal of Mutation Testing is to assess the quality of the test cases which should be robust enough to fail mutant code. This method is also called as a Fault-based testing strategy as it involves creating faults in the program.Faults are introduced into the source code of the program by creating many versions called mutants. Each mutant should contain a single fault, and the goal is to cause the mutant version to fail which demonstrates the effectiveness of the test cases.[https://www.guru99.com/mutation-testing.html ]&lt;br /&gt;
&lt;br /&gt;
=='''Project description'''==&lt;br /&gt;
===Environment Setup===&lt;br /&gt;
* Clone the repository from [https://github.com/dsandeephegde/servo link]&lt;br /&gt;
* The steps to setup the environment for different OS are mentioned in readme file [https://github.com/servo/servo link].&lt;br /&gt;
&lt;br /&gt;
====Install packages==== &lt;br /&gt;
&lt;br /&gt;
Example, In OSX(homebrew):&lt;br /&gt;
&lt;br /&gt;
 brew install automake pkg-config python cmake yasm&lt;br /&gt;
 pip install virtualenv&lt;br /&gt;
&lt;br /&gt;
====Running test after setup====&lt;br /&gt;
&lt;br /&gt;
After the setup, make sure that everything works in your machine by building and running tests.&lt;br /&gt;
&lt;br /&gt;
build in release mode:&lt;br /&gt;
&lt;br /&gt;
 ./mach build --release&lt;br /&gt;
&lt;br /&gt;
run WPT tests:&lt;br /&gt;
&lt;br /&gt;
 ./mach test -wpt --release&lt;br /&gt;
&lt;br /&gt;
===Initial steps===&lt;br /&gt;
&lt;br /&gt;
*Implemented a simple mutator as a Python script that finds random uses of &amp;amp;&amp;amp; in Servo's code base and replaces them by ||.&lt;br /&gt;
*Built the mutated implementation of Servo with ./mach build -r and run it on the WPT test suite with ./mach test-wpt:  This produced test failures.&lt;br /&gt;
*Introduced test mapping framework to map source files to WPT test.&lt;br /&gt;
*Optimized the number of test runs by using test mapping to run only relevant tests for a mutant.&lt;br /&gt;
*Automated this process by writing scripts in a new python/servo/mutation directory, and called them from scripts in /etc/ci.&lt;br /&gt;
&lt;br /&gt;
===Subsequent steps===&lt;br /&gt;
&lt;br /&gt;
* implement mutations like replacing if statements by if true/if false, duplicating statements, reordering statements, changing arithmetic &amp;amp; atomic string constant.&lt;br /&gt;
* improving the performance of the testing, for example randomizing the test order, fast-failing, running tests with faster builds (e.g. ./mach build -d).&lt;br /&gt;
* find heuristics for identifying false positives, that is mutations which are expected to have no effect, for example removing logging.&lt;br /&gt;
* find search heuristics for identifying mutations that cause no test failures.&lt;br /&gt;
&lt;br /&gt;
===Execution===&lt;br /&gt;
* Mutation test can be ran using either of the following command from the servo directory:&lt;br /&gt;
&lt;br /&gt;
 python python/servo/mutation/init.py components/script/dom&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 python etc/ci/mutation_test.py&lt;br /&gt;
&lt;br /&gt;
===Excecution Flow===&lt;br /&gt;
&lt;br /&gt;
Given a path&lt;br /&gt;
:mutation test(path)&lt;br /&gt;
::Look for test mapping file in that path&lt;br /&gt;
::for each file the in the test mapping&lt;br /&gt;
:::mutate a random line using some strategy in the file&lt;br /&gt;
:::build project and run WPT tests corresponding to it&lt;br /&gt;
:::if wpt tests pass?&lt;br /&gt;
::::report mautation test failure&lt;br /&gt;
:::else&lt;br /&gt;
::::report mutation test success&lt;br /&gt;
for each subfolder folder in the path&lt;br /&gt;
:mutation test(subfolder)&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
&lt;br /&gt;
The project is about writing a python script to change the source code and run tests. It does not add any functionality to Servo. So there is no scope for testing in this project.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://www.guru99.com/mutation-testing.html&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://github.com/servo/servo&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo/wiki/Mutation-testing-project&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sdhegde</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112100</id>
		<title>CSC/ECE 517 Fall 2017/M1754 Mutation Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112100"/>
		<updated>2017-11-07T01:27:57Z</updated>

		<summary type="html">&lt;p&gt;Sdhegde: /* Initial steps */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Servo uses the Web Platform Test (WPT) suite for testing, but does not perform an evaluation of the breadth of the tests. The goal of this project is to use techniques from mutation testing to evaluate the performance of the WPT suite when bugs are deliberately introduced into the code base. &lt;br /&gt;
&lt;br /&gt;
The implementation of this project was done by writing python scripts that would modify the source code to generate mutants and run tests on them expecting failures. The scripts would temporarily modify the source codes, call the corresponding tests and revert back to the original code by reversing the changes that were made earlier. This process was repeated for multiple iterations by modifying various parts of the source code in random order.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use. [https://servo.org Servo] is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks. [https://en.wikipedia.org/wiki/Servo_(layout_engine)]&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://doc.rust-lang.org/book/second-edition/ Rust] is an open source,  systems programming language sponsored by Mozilla Research. Rust performs the majority of its safety checks and memory management decisions at compile time, so that program’s runtime performance is not impacted. Making it useful in programs with predictable space and time requirements, embedding in other languages, and writing low-level code, like device drivers and operating systems.&lt;br /&gt;
&lt;br /&gt;
===Web-platform-tests===&lt;br /&gt;
The [https://github.com/w3c/web-platform-tests web-platform-tests Project] is a W3C-coordinated attempt to build a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This, in turn, gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.&lt;br /&gt;
&lt;br /&gt;
===Mutation Testing===&lt;br /&gt;
Mutation Testing is a type of software testing where we mutate (change) certain statements in the source code and check if the test cases are able to find the errors.The goal of Mutation Testing is to assess the quality of the test cases which should be robust enough to fail mutant code. This method is also called as a Fault-based testing strategy as it involves creating faults in the program.Faults are introduced into the source code of the program by creating many versions called mutants. Each mutant should contain a single fault, and the goal is to cause the mutant version to fail which demonstrates the effectiveness of the test cases.[https://www.guru99.com/mutation-testing.html ]&lt;br /&gt;
&lt;br /&gt;
=='''Project description'''==&lt;br /&gt;
===Environment Setup===&lt;br /&gt;
* Clone the repository from [https://github.com/dsandeephegde/servo link]&lt;br /&gt;
* The steps to setup the environment for different OS are mentioned in readme file [https://github.com/servo/servo link].&lt;br /&gt;
&lt;br /&gt;
====Install packages==== &lt;br /&gt;
&lt;br /&gt;
Example, In OSX(homebrew):&lt;br /&gt;
&lt;br /&gt;
 brew install automake pkg-config python cmake yasm&lt;br /&gt;
 pip install virtualenv&lt;br /&gt;
&lt;br /&gt;
====Running test after setup====&lt;br /&gt;
&lt;br /&gt;
After the setup, make sure that everything works in your machine by building and running tests.&lt;br /&gt;
&lt;br /&gt;
build in release mode:&lt;br /&gt;
&lt;br /&gt;
 ./mach build --release&lt;br /&gt;
&lt;br /&gt;
run WPT tests:&lt;br /&gt;
&lt;br /&gt;
 ./mach test -wpt --release&lt;br /&gt;
&lt;br /&gt;
===Initial steps===&lt;br /&gt;
&lt;br /&gt;
*Implemented a simple mutator as a Python script that finds random uses of &amp;amp;&amp;amp; in Servo's code base and replaces them by ||.&lt;br /&gt;
*Built the mutated implementation of Servo with ./mach build -r and run it on the WPT test suite with ./mach test-wpt:  This produced test failures.&lt;br /&gt;
*Introduced test mapping framework to map source files to WPT test.&lt;br /&gt;
*Automated this process by writing scripts in a new python/servo/mutation directory, and called them from scripts in /etc/ci.&lt;br /&gt;
&lt;br /&gt;
===Subsequent steps===&lt;br /&gt;
&lt;br /&gt;
* implement mutations like replacing if statements by if true/if false, duplicating statements, reordering statements, changing arithmetic &amp;amp; atomic string constant.&lt;br /&gt;
* improving the performance of the testing, for example randomizing the test order, fast-failing, running tests with faster builds (e.g. ./mach build -d).&lt;br /&gt;
* find heuristics for identifying false positives, that is mutations which are expected to have no effect, for example removing logging.&lt;br /&gt;
* find search heuristics for identifying mutations that cause no test failures.&lt;br /&gt;
&lt;br /&gt;
===Execution===&lt;br /&gt;
* Mutation test can be ran using either of the following command from the servo directory:&lt;br /&gt;
&lt;br /&gt;
 python python/servo/mutation/init.py components/script/dom&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 python etc/ci/mutation_test.py&lt;br /&gt;
&lt;br /&gt;
===Excecution Flow===&lt;br /&gt;
&lt;br /&gt;
Given a path&lt;br /&gt;
:mutation test(path)&lt;br /&gt;
::Look for test mapping file in that path&lt;br /&gt;
::for each file the in the test mapping&lt;br /&gt;
:::mutate a random line using some strategy in the file&lt;br /&gt;
:::build project and run WPT tests corresponding to it&lt;br /&gt;
:::if wpt tests pass?&lt;br /&gt;
::::report mautation test failure&lt;br /&gt;
:::else&lt;br /&gt;
::::report mutation test success&lt;br /&gt;
for each subfolder folder in the path&lt;br /&gt;
:mutation test(subfolder)&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
&lt;br /&gt;
The project is about writing a python script to change the source code and run tests. It does not add any functionality to Servo. So there is no scope for testing in this project.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://www.guru99.com/mutation-testing.html&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://github.com/servo/servo&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo/wiki/Mutation-testing-project&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sdhegde</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112099</id>
		<title>CSC/ECE 517 Fall 2017/M1754 Mutation Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112099"/>
		<updated>2017-11-07T01:21:26Z</updated>

		<summary type="html">&lt;p&gt;Sdhegde: /* Subsequent steps */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Servo uses the Web Platform Test (WPT) suite for testing, but does not perform an evaluation of the breadth of the tests. The goal of this project is to use techniques from mutation testing to evaluate the performance of the WPT suite when bugs are deliberately introduced into the code base. &lt;br /&gt;
&lt;br /&gt;
The implementation of this project was done by writing python scripts that would modify the source code to generate mutants and run tests on them expecting failures. The scripts would temporarily modify the source codes, call the corresponding tests and revert back to the original code by reversing the changes that were made earlier. This process was repeated for multiple iterations by modifying various parts of the source code in random order.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use. [https://servo.org Servo] is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks. [https://en.wikipedia.org/wiki/Servo_(layout_engine)]&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://doc.rust-lang.org/book/second-edition/ Rust] is an open source,  systems programming language sponsored by Mozilla Research. Rust performs the majority of its safety checks and memory management decisions at compile time, so that program’s runtime performance is not impacted. Making it useful in programs with predictable space and time requirements, embedding in other languages, and writing low-level code, like device drivers and operating systems.&lt;br /&gt;
&lt;br /&gt;
===Web-platform-tests===&lt;br /&gt;
The [https://github.com/w3c/web-platform-tests web-platform-tests Project] is a W3C-coordinated attempt to build a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This, in turn, gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.&lt;br /&gt;
&lt;br /&gt;
===Mutation Testing===&lt;br /&gt;
Mutation Testing is a type of software testing where we mutate (change) certain statements in the source code and check if the test cases are able to find the errors.The goal of Mutation Testing is to assess the quality of the test cases which should be robust enough to fail mutant code. This method is also called as a Fault-based testing strategy as it involves creating faults in the program.Faults are introduced into the source code of the program by creating many versions called mutants. Each mutant should contain a single fault, and the goal is to cause the mutant version to fail which demonstrates the effectiveness of the test cases.[https://www.guru99.com/mutation-testing.html ]&lt;br /&gt;
&lt;br /&gt;
=='''Project description'''==&lt;br /&gt;
===Environment Setup===&lt;br /&gt;
* Clone the repository from [https://github.com/dsandeephegde/servo link]&lt;br /&gt;
* The steps to setup the environment for different OS are mentioned in readme file [https://github.com/servo/servo link].&lt;br /&gt;
&lt;br /&gt;
====Install packages==== &lt;br /&gt;
&lt;br /&gt;
Example, In OSX(homebrew):&lt;br /&gt;
&lt;br /&gt;
 brew install automake pkg-config python cmake yasm&lt;br /&gt;
 pip install virtualenv&lt;br /&gt;
&lt;br /&gt;
====Running test after setup====&lt;br /&gt;
&lt;br /&gt;
After the setup, make sure that everything works in your machine by building and running tests.&lt;br /&gt;
&lt;br /&gt;
build in release mode:&lt;br /&gt;
&lt;br /&gt;
 ./mach build --release&lt;br /&gt;
&lt;br /&gt;
run WPT tests:&lt;br /&gt;
&lt;br /&gt;
 ./mach test -wpt --release&lt;br /&gt;
&lt;br /&gt;
===Initial steps===&lt;br /&gt;
The approach adopted was based on the requirements mentioned [https://github.com/servo/servo/wiki/Mutation-testing-project here]. The below steps implement the initial steps mentioned in the project description.&lt;br /&gt;
&lt;br /&gt;
* Step 1: A python script was written to mutate one source file and the corresponding WPT was run on it to check if the mutant was killed.&lt;br /&gt;
&lt;br /&gt;
* Step 2: A test framework was defined to identify the source files that require mutation testing along with their corresponding WPTs. This framework is implemented in /servo/components/script/dom.&lt;br /&gt;
&lt;br /&gt;
* Step 3: The script was expanded to include the test framework and automate the process of generating mutations for multiple source files and running their corresponding WPTs based on the test_mapping.json. The script also traverses through subfolders of the parsed path to check for the .json file. The script also logs on the terminal any mutants that the WPT failed to kill.&lt;br /&gt;
&lt;br /&gt;
* Step 4: Integrated the script so that it can be invoked from the CI tool.&lt;br /&gt;
&lt;br /&gt;
===Subsequent steps===&lt;br /&gt;
&lt;br /&gt;
* implement mutations like replacing if statements by if true/if false, duplicating statements, reordering statements, changing arithmetic &amp;amp; atomic string constant.&lt;br /&gt;
* improving the performance of the testing, for example randomizing the test order, fast-failing, running tests with faster builds (e.g. ./mach build -d).&lt;br /&gt;
* find heuristics for identifying false positives, that is mutations which are expected to have no effect, for example removing logging.&lt;br /&gt;
* find search heuristics for identifying mutations that cause no test failures.&lt;br /&gt;
&lt;br /&gt;
===Execution===&lt;br /&gt;
* Mutation test can be ran using either of the following command from the servo directory:&lt;br /&gt;
&lt;br /&gt;
 python python/servo/mutation/init.py components/script/dom&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 python etc/ci/mutation_test.py&lt;br /&gt;
&lt;br /&gt;
===Excecution Flow===&lt;br /&gt;
&lt;br /&gt;
Given a path&lt;br /&gt;
:mutation test(path)&lt;br /&gt;
::Look for test mapping file in that path&lt;br /&gt;
::for each file the in the test mapping&lt;br /&gt;
:::mutate a random line using some strategy in the file&lt;br /&gt;
:::build project and run WPT tests corresponding to it&lt;br /&gt;
:::if wpt tests pass?&lt;br /&gt;
::::report mautation test failure&lt;br /&gt;
:::else&lt;br /&gt;
::::report mutation test success&lt;br /&gt;
for each subfolder folder in the path&lt;br /&gt;
:mutation test(subfolder)&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
&lt;br /&gt;
The project is about writing a python script to change the source code and run tests. It does not add any functionality to Servo. So there is no scope for testing in this project.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://www.guru99.com/mutation-testing.html&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://github.com/servo/servo&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo/wiki/Mutation-testing-project&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sdhegde</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112098</id>
		<title>CSC/ECE 517 Fall 2017/M1754 Mutation Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112098"/>
		<updated>2017-11-07T01:20:52Z</updated>

		<summary type="html">&lt;p&gt;Sdhegde: /* Implemented steps */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Servo uses the Web Platform Test (WPT) suite for testing, but does not perform an evaluation of the breadth of the tests. The goal of this project is to use techniques from mutation testing to evaluate the performance of the WPT suite when bugs are deliberately introduced into the code base. &lt;br /&gt;
&lt;br /&gt;
The implementation of this project was done by writing python scripts that would modify the source code to generate mutants and run tests on them expecting failures. The scripts would temporarily modify the source codes, call the corresponding tests and revert back to the original code by reversing the changes that were made earlier. This process was repeated for multiple iterations by modifying various parts of the source code in random order.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use. [https://servo.org Servo] is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks. [https://en.wikipedia.org/wiki/Servo_(layout_engine)]&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://doc.rust-lang.org/book/second-edition/ Rust] is an open source,  systems programming language sponsored by Mozilla Research. Rust performs the majority of its safety checks and memory management decisions at compile time, so that program’s runtime performance is not impacted. Making it useful in programs with predictable space and time requirements, embedding in other languages, and writing low-level code, like device drivers and operating systems.&lt;br /&gt;
&lt;br /&gt;
===Web-platform-tests===&lt;br /&gt;
The [https://github.com/w3c/web-platform-tests web-platform-tests Project] is a W3C-coordinated attempt to build a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This, in turn, gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.&lt;br /&gt;
&lt;br /&gt;
===Mutation Testing===&lt;br /&gt;
Mutation Testing is a type of software testing where we mutate (change) certain statements in the source code and check if the test cases are able to find the errors.The goal of Mutation Testing is to assess the quality of the test cases which should be robust enough to fail mutant code. This method is also called as a Fault-based testing strategy as it involves creating faults in the program.Faults are introduced into the source code of the program by creating many versions called mutants. Each mutant should contain a single fault, and the goal is to cause the mutant version to fail which demonstrates the effectiveness of the test cases.[https://www.guru99.com/mutation-testing.html ]&lt;br /&gt;
&lt;br /&gt;
=='''Project description'''==&lt;br /&gt;
===Environment Setup===&lt;br /&gt;
* Clone the repository from [https://github.com/dsandeephegde/servo link]&lt;br /&gt;
* The steps to setup the environment for different OS are mentioned in readme file [https://github.com/servo/servo link].&lt;br /&gt;
&lt;br /&gt;
====Install packages==== &lt;br /&gt;
&lt;br /&gt;
Example, In OSX(homebrew):&lt;br /&gt;
&lt;br /&gt;
 brew install automake pkg-config python cmake yasm&lt;br /&gt;
 pip install virtualenv&lt;br /&gt;
&lt;br /&gt;
====Running test after setup====&lt;br /&gt;
&lt;br /&gt;
After the setup, make sure that everything works in your machine by building and running tests.&lt;br /&gt;
&lt;br /&gt;
build in release mode:&lt;br /&gt;
&lt;br /&gt;
 ./mach build --release&lt;br /&gt;
&lt;br /&gt;
run WPT tests:&lt;br /&gt;
&lt;br /&gt;
 ./mach test -wpt --release&lt;br /&gt;
&lt;br /&gt;
===Initial steps===&lt;br /&gt;
The approach adopted was based on the requirements mentioned [https://github.com/servo/servo/wiki/Mutation-testing-project here]. The below steps implement the initial steps mentioned in the project description.&lt;br /&gt;
&lt;br /&gt;
* Step 1: A python script was written to mutate one source file and the corresponding WPT was run on it to check if the mutant was killed.&lt;br /&gt;
&lt;br /&gt;
* Step 2: A test framework was defined to identify the source files that require mutation testing along with their corresponding WPTs. This framework is implemented in /servo/components/script/dom.&lt;br /&gt;
&lt;br /&gt;
* Step 3: The script was expanded to include the test framework and automate the process of generating mutations for multiple source files and running their corresponding WPTs based on the test_mapping.json. The script also traverses through subfolders of the parsed path to check for the .json file. The script also logs on the terminal any mutants that the WPT failed to kill.&lt;br /&gt;
&lt;br /&gt;
* Step 4: Integrated the script so that it can be invoked from the CI tool.&lt;br /&gt;
&lt;br /&gt;
===Subsequent steps===&lt;br /&gt;
&lt;br /&gt;
The following subsequent steps will be followed to meet the project requirements as per this [https://github.com/servo/servo/wiki/Mutation-testing-project].&lt;br /&gt;
&lt;br /&gt;
* implement mutations like replacing if statements by if true/if false, duplicating statements, reordering statements, changing arithmetic &amp;amp; atomic string constant.&lt;br /&gt;
* improving the performance of the testing, for example randomizing the test order, fast-failing, running tests with faster builds (e.g. ./mach build -d).&lt;br /&gt;
* find heuristics for identifying false positives, that is mutations which are expected to have no effect, for example removing logging.&lt;br /&gt;
* find search heuristics for identifying mutations that cause no test failures.&lt;br /&gt;
&lt;br /&gt;
===Execution===&lt;br /&gt;
* Mutation test can be ran using either of the following command from the servo directory:&lt;br /&gt;
&lt;br /&gt;
 python python/servo/mutation/init.py components/script/dom&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 python etc/ci/mutation_test.py&lt;br /&gt;
&lt;br /&gt;
===Excecution Flow===&lt;br /&gt;
&lt;br /&gt;
Given a path&lt;br /&gt;
:mutation test(path)&lt;br /&gt;
::Look for test mapping file in that path&lt;br /&gt;
::for each file the in the test mapping&lt;br /&gt;
:::mutate a random line using some strategy in the file&lt;br /&gt;
:::build project and run WPT tests corresponding to it&lt;br /&gt;
:::if wpt tests pass?&lt;br /&gt;
::::report mautation test failure&lt;br /&gt;
:::else&lt;br /&gt;
::::report mutation test success&lt;br /&gt;
for each subfolder folder in the path&lt;br /&gt;
:mutation test(subfolder)&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
&lt;br /&gt;
The project is about writing a python script to change the source code and run tests. It does not add any functionality to Servo. So there is no scope for testing in this project.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://www.guru99.com/mutation-testing.html&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://github.com/servo/servo&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo/wiki/Mutation-testing-project&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sdhegde</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112097</id>
		<title>CSC/ECE 517 Fall 2017/M1754 Mutation Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112097"/>
		<updated>2017-11-07T01:18:29Z</updated>

		<summary type="html">&lt;p&gt;Sdhegde: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Servo uses the Web Platform Test (WPT) suite for testing, but does not perform an evaluation of the breadth of the tests. The goal of this project is to use techniques from mutation testing to evaluate the performance of the WPT suite when bugs are deliberately introduced into the code base. &lt;br /&gt;
&lt;br /&gt;
The implementation of this project was done by writing python scripts that would modify the source code to generate mutants and run tests on them expecting failures. The scripts would temporarily modify the source codes, call the corresponding tests and revert back to the original code by reversing the changes that were made earlier. This process was repeated for multiple iterations by modifying various parts of the source code in random order.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use. [https://servo.org Servo] is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks. [https://en.wikipedia.org/wiki/Servo_(layout_engine)]&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://doc.rust-lang.org/book/second-edition/ Rust] is an open source,  systems programming language sponsored by Mozilla Research. Rust performs the majority of its safety checks and memory management decisions at compile time, so that program’s runtime performance is not impacted. Making it useful in programs with predictable space and time requirements, embedding in other languages, and writing low-level code, like device drivers and operating systems.&lt;br /&gt;
&lt;br /&gt;
===Web-platform-tests===&lt;br /&gt;
The [https://github.com/w3c/web-platform-tests web-platform-tests Project] is a W3C-coordinated attempt to build a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This, in turn, gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.&lt;br /&gt;
&lt;br /&gt;
===Mutation Testing===&lt;br /&gt;
Mutation Testing is a type of software testing where we mutate (change) certain statements in the source code and check if the test cases are able to find the errors.The goal of Mutation Testing is to assess the quality of the test cases which should be robust enough to fail mutant code. This method is also called as a Fault-based testing strategy as it involves creating faults in the program.Faults are introduced into the source code of the program by creating many versions called mutants. Each mutant should contain a single fault, and the goal is to cause the mutant version to fail which demonstrates the effectiveness of the test cases.[https://www.guru99.com/mutation-testing.html ]&lt;br /&gt;
&lt;br /&gt;
=='''Project description'''==&lt;br /&gt;
===Environment Setup===&lt;br /&gt;
* Clone the repository from [https://github.com/dsandeephegde/servo link]&lt;br /&gt;
* The steps to setup the environment for different OS are mentioned in readme file [https://github.com/servo/servo link].&lt;br /&gt;
&lt;br /&gt;
====Install packages==== &lt;br /&gt;
&lt;br /&gt;
Example, In OSX(homebrew):&lt;br /&gt;
&lt;br /&gt;
 brew install automake pkg-config python cmake yasm&lt;br /&gt;
 pip install virtualenv&lt;br /&gt;
&lt;br /&gt;
====Running test after setup====&lt;br /&gt;
&lt;br /&gt;
After the setup, make sure that everything works in your machine by building and running tests.&lt;br /&gt;
&lt;br /&gt;
build in release mode:&lt;br /&gt;
&lt;br /&gt;
 ./mach build --release&lt;br /&gt;
&lt;br /&gt;
run WPT tests:&lt;br /&gt;
&lt;br /&gt;
 ./mach test -wpt --release&lt;br /&gt;
&lt;br /&gt;
===Implemented steps===&lt;br /&gt;
The approach adopted was based on the requirements mentioned [https://github.com/servo/servo/wiki/Mutation-testing-project here]. The below steps implement the initial steps mentioned in the project description.&lt;br /&gt;
&lt;br /&gt;
* Step 1: A python script was written to mutate one source file and the corresponding WPT was run on it to check if the mutant was killed.&lt;br /&gt;
&lt;br /&gt;
* Step 2: A test framework was defined to identify the source files that require mutation testing along with their corresponding WPTs. This framework is implemented in /servo/components/script/dom.&lt;br /&gt;
&lt;br /&gt;
* Step 3: The script was expanded to include the test framework and automate the process of generating mutations for multiple source files and running their corresponding WPTs based on the test_mapping.json. The script also traverses through subfolders of the parsed path to check for the .json file. The script also logs on the terminal any mutants that the WPT failed to kill.&lt;br /&gt;
&lt;br /&gt;
* Step 4: Integrated the script so that it can be invoked from the CI tool.&lt;br /&gt;
&lt;br /&gt;
===Subsequent steps===&lt;br /&gt;
&lt;br /&gt;
The following subsequent steps will be followed to meet the project requirements as per this [https://github.com/servo/servo/wiki/Mutation-testing-project].&lt;br /&gt;
&lt;br /&gt;
* implement mutations like replacing if statements by if true/if false, duplicating statements, reordering statements, changing arithmetic &amp;amp; atomic string constant.&lt;br /&gt;
* improving the performance of the testing, for example randomizing the test order, fast-failing, running tests with faster builds (e.g. ./mach build -d).&lt;br /&gt;
* find heuristics for identifying false positives, that is mutations which are expected to have no effect, for example removing logging.&lt;br /&gt;
* find search heuristics for identifying mutations that cause no test failures.&lt;br /&gt;
&lt;br /&gt;
===Execution===&lt;br /&gt;
* Mutation test can be ran using either of the following command from the servo directory:&lt;br /&gt;
&lt;br /&gt;
 python python/servo/mutation/init.py components/script/dom&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 python etc/ci/mutation_test.py&lt;br /&gt;
&lt;br /&gt;
===Excecution Flow===&lt;br /&gt;
&lt;br /&gt;
Given a path&lt;br /&gt;
:mutation test(path)&lt;br /&gt;
::Look for test mapping file in that path&lt;br /&gt;
::for each file the in the test mapping&lt;br /&gt;
:::mutate a random line using some strategy in the file&lt;br /&gt;
:::build project and run WPT tests corresponding to it&lt;br /&gt;
:::if wpt tests pass?&lt;br /&gt;
::::report mautation test failure&lt;br /&gt;
:::else&lt;br /&gt;
::::report mutation test success&lt;br /&gt;
for each subfolder folder in the path&lt;br /&gt;
:mutation test(subfolder)&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
&lt;br /&gt;
The project is about writing a python script to change the source code and run tests. It does not add any functionality to Servo. So there is no scope for testing in this project.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://www.guru99.com/mutation-testing.html&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://github.com/servo/servo&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo/wiki/Mutation-testing-project&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sdhegde</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112096</id>
		<title>CSC/ECE 517 Fall 2017/M1754 Mutation Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112096"/>
		<updated>2017-11-07T01:13:48Z</updated>

		<summary type="html">&lt;p&gt;Sdhegde: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Servo uses the Web Platform Test (WPT) suite for testing, but does not perform an evaluation of the breadth of the tests. The goal of this project is to use techniques from mutation testing to evaluate the performance of the WPT suite when bugs are deliberately introduced into the code base. &lt;br /&gt;
&lt;br /&gt;
The implementation of this project was done by writing python scripts that would modify the source code to generate mutants and run tests on them expecting failures. The scripts would temporarily modify the source codes, call the corresponding tests and revert back to the original code by reversing the changes that were made earlier. This process was repeated for multiple iterations by modifying various parts of the source code in random order.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use. [https://servo.org Servo] is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks. [https://en.wikipedia.org/wiki/Servo_(layout_engine)]&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://doc.rust-lang.org/book/second-edition/ Rust] is an open source,  systems programming language sponsored by Mozilla Research. Rust performs the majority of its safety checks and memory management decisions at compile time, so that program’s runtime performance is not impacted. Making it useful in programs with predictable space and time requirements, embedding in other languages, and writing low-level code, like device drivers and operating systems.&lt;br /&gt;
&lt;br /&gt;
===Web-platform-tests===&lt;br /&gt;
The [https://github.com/w3c/web-platform-tests web-platform-tests Project] is a W3C-coordinated attempt to build a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This, in turn, gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.&lt;br /&gt;
&lt;br /&gt;
===Mutation Testing===&lt;br /&gt;
Mutation Testing is a type of software testing where we mutate (change) certain statements in the source code and check if the test cases are able to find the errors.The goal of Mutation Testing is to assess the quality of the test cases which should be robust enough to fail mutant code. This method is also called as a Fault-based testing strategy as it involves creating faults in the program.Faults are introduced into the source code of the program by creating many versions called mutants. Each mutant should contain a single fault, and the goal is to cause the mutant version to fail which demonstrates the effectiveness of the test cases.[https://www.guru99.com/mutation-testing.html ]&lt;br /&gt;
&lt;br /&gt;
=='''Project description'''==&lt;br /&gt;
===Environment Setup===&lt;br /&gt;
* Clone the repository from [https://github.com/dsandeephegde/servo link]&lt;br /&gt;
* The steps to setup the environment for different OS are mentioned in readme file [https://github.com/servo/servo link].&lt;br /&gt;
&lt;br /&gt;
====Install packages==== &lt;br /&gt;
&lt;br /&gt;
Example, In OSX(homebrew):&lt;br /&gt;
&lt;br /&gt;
 brew install automake pkg-config python cmake yasm&lt;br /&gt;
 pip install virtualenv&lt;br /&gt;
&lt;br /&gt;
====Running test after setup====&lt;br /&gt;
&lt;br /&gt;
After the setup, make sure that everything works in your machine by building and running tests.&lt;br /&gt;
&lt;br /&gt;
build in release mode:&lt;br /&gt;
&lt;br /&gt;
 ./mach build --release&lt;br /&gt;
&lt;br /&gt;
run WPT tests:&lt;br /&gt;
&lt;br /&gt;
 ./mach test -wpt --release&lt;br /&gt;
&lt;br /&gt;
===Implemented steps===&lt;br /&gt;
The approach adopted was based on the requirements mentioned [https://github.com/servo/servo/wiki/Mutation-testing-project here]. The below steps implement the initial steps mentioned in the project description.&lt;br /&gt;
&lt;br /&gt;
* Step 1: A python script was written to mutate one source file and the corresponding WPT was run on it to check if the mutant was killed.&lt;br /&gt;
&lt;br /&gt;
* Step 2: A test framework was defined to identify the source files that require mutation testing along with their corresponding WPTs. This framework is implemented in /servo/components/script/dom.&lt;br /&gt;
&lt;br /&gt;
* Step 3: The script was expanded to include the test framework and automate the process of generating mutations for multiple source files and running their corresponding WPTs based on the test_mapping.json. The script also traverses through subfolders of the parsed path to check for the .json file. The script also logs on the terminal any mutants that the WPT failed to kill.&lt;br /&gt;
&lt;br /&gt;
* Step 4: Integrated the script so that it can be invoked from the CI tool.&lt;br /&gt;
&lt;br /&gt;
===Execution===&lt;br /&gt;
* Mutation test can be ran using either of the following command from the servo directory:&lt;br /&gt;
&lt;br /&gt;
 python python/servo/mutation/init.py components/script/dom&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 python etc/ci/mutation_test.py&lt;br /&gt;
&lt;br /&gt;
===Excecution Flow===&lt;br /&gt;
&lt;br /&gt;
Given a path&lt;br /&gt;
:mutation test(path)&lt;br /&gt;
::Look for test mapping file in that path&lt;br /&gt;
::for each file the in the test mapping&lt;br /&gt;
:::mutate a random line using some strategy in the file&lt;br /&gt;
:::build project and run WPT tests corresponding to it&lt;br /&gt;
:::if wpt tests pass?&lt;br /&gt;
::::report mautation test failure&lt;br /&gt;
:::else&lt;br /&gt;
::::report mutation test success&lt;br /&gt;
for each subfolder folder in the path&lt;br /&gt;
:mutation test(subfolder)&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
&lt;br /&gt;
The project is about writing a python script to change the source code and run tests. It does not add any functionality to Servo. So there is no scope for testing in this project.&lt;br /&gt;
&lt;br /&gt;
===Subsequent steps===&lt;br /&gt;
&lt;br /&gt;
The following subsequent steps will be followed to meet the project requirements as per this [https://github.com/servo/servo/wiki/Mutation-testing-project].&lt;br /&gt;
&lt;br /&gt;
* implement mutations like replacing if statements by if true/if false, duplicating statements, reordering statements, changing arithmetic &amp;amp; atomic string constant.&lt;br /&gt;
* improving the performance of the testing, for example randomizing the test order, fast-failing, running tests with faster builds (e.g. ./mach build -d).&lt;br /&gt;
* find heuristics for identifying false positives, that is mutations which are expected to have no effect, for example removing logging.&lt;br /&gt;
* find search heuristics for identifying mutations that cause no test failures.&lt;br /&gt;
&lt;br /&gt;
===Challenges===&lt;br /&gt;
&lt;br /&gt;
1. Setting up the environment on the local machine:&lt;br /&gt;
&lt;br /&gt;
*The amount of time taken to build and test the WPT on the local machine was pretty long due to machine memory. Additionally faced problems on intermittent WPT test failures. It is expected that any reviewer will face a similar challenge.&lt;br /&gt;
&lt;br /&gt;
We overcame this challenge by discussing possibilities with Mozilla team who suggested us to use Janitor Technology. The servo image would be already set up with the latest code, we can edit code in cloud9 and execute it. Using this platform for our testing made the project agnostic of the environment on the local machine and any hassle associated with same.&lt;br /&gt;
&lt;br /&gt;
2. Defining the test mapping framework:&lt;br /&gt;
 &lt;br /&gt;
*Servo consists of multiple components of which there are many WPT tests written for each component. The test cases are organized according to the functionality they test, whereas the servo source code is organized according to the specific components. Due to a large number of source files and WPT tests for the entire project, it was difficult for one individual to have information on the mapping of components to their corresponding WPTs. &lt;br /&gt;
&lt;br /&gt;
Hence, we had to have a mapping to run the corresponding tests for a source file. The mapping framework enabled us to run tests on a few components and provide a base for other members from Mozilla team to add and replicate the same framework as per their requirement. We still need to find if there can be any automated way to populate the mapping.&lt;br /&gt;
&lt;br /&gt;
3. The extent of mutation testing to be performed.&lt;br /&gt;
&lt;br /&gt;
*There are standard techniques that define what a mutant is. For example, replacing '&amp;amp;&amp;amp;' with '||'. However, there is no specification for the number of replacements that must be made within a single source code, nor is there any specification on the permutations of possible mutations for each technique. This is an ambiguity in the project and our initial implementation replaces all instances of '&amp;amp;&amp;amp;' to '||' to generate a single type of mutant for each file of the source code. But now our implementation mutates random lines using a strategy. The code needs to evolve based on how runs/performs. And there is no predefined answer for it.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://www.guru99.com/mutation-testing.html&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://github.com/servo/servo&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo/wiki/Mutation-testing-project&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sdhegde</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017&amp;diff=112095</id>
		<title>CSC/ECE 517 Fall 2017</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017&amp;diff=112095"/>
		<updated>2017-11-07T01:07:50Z</updated>

		<summary type="html">&lt;p&gt;Sdhegde: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Design Project Documentation'''&lt;br /&gt;
*[[CSC/ECE 517 Fall 2017/E17A2 Lightweight Badging System]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2017/E17A8. Use a profiler to identify the problems / pages that take some time to load &amp;amp; fix them]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2017/E1793. Help students find teams to join]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2017/E17A4 Allow calibration to be part of an assignment]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2017/E17A0 Team-based reviewing]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2017/E1793. Help students find teams to join_Team1964]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2017/E1791. Track the time that students look at the other submissions - logging improvement]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2017/E1799 Improve self-review Link peer review &amp;amp; self-review to derive grades]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submissions]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/E17A1|CSC/ECE_517_Fall_2017/E17A1 - Let experts as well as students do reviews]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2017/M1754_Mutation_Testing]]&lt;br /&gt;
'''Writing Assignment 2'''&lt;br /&gt;
*[[CSC/ECE 517 Fall 2017/E1779. Fix teammate advertisements and requests to join a team]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/E1773 Investigate and Fix Expertiza Production Version Runtime Exceptions.rb]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/E1774 Metareview fixes and improvements.rb]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/E1788 OSS project Maroon Heatmap fixes]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2017/E1781 Topic Management]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/E1745_Refactor_response_controller.rb]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/E1752 Refactor assignments controller]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/E1776_Enhance_Imports]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/E1756 TLD Refactor response.rb]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/E1772_Refactor reputation_web_service_controller.rb]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/M1754_Mutation Testing on Servo]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/E1753 OSS project bidding tests]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/E1766_Test team functionality]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2017/E1767 Improve imports]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/E1786_OSS project Juniper Bookmark Enhancements]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/E1787_OSS project Bronze Score calculations]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/E1763 Fix Staggered-Deadline Assignments]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2017/E1757 Introduce a Student View for instructors]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2017/E1769_Refactor assignment_form.rb]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2017/E1754_Feature_test_of_rubric_advice]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2017/E1782 OSS Project Red Assignment Directories]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2017/E1748 Add past-due assignments to task list]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2017/E1761 Test First Development Refactor assignment.rb]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/E1780_OSS_Project_Teal_Email_Notification_Enhancements]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/E1762 Test various kinds of response-map hierarchies]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/E1759 ]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/E1749_Test First Development Refactor questionnaire_controller.rb]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2017/E1777 Coherent specification of review requirements.rb]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2017/E1771_Refactor_team.rb]]&lt;/div&gt;</summary>
		<author><name>Sdhegde</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112094</id>
		<title>CSC/ECE 517 Fall 2017/M1754 Mutation Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing&amp;diff=112094"/>
		<updated>2017-11-07T01:07:06Z</updated>

		<summary type="html">&lt;p&gt;Sdhegde: Created page with &amp;quot;Servo uses the Web Platform Test (WPT) suite for testing, but does not perform an evaluation of the breadth of the tests. The goal of this project is to use techniques from mutat...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Servo uses the Web Platform Test (WPT) suite for testing, but does not perform an evaluation of the breadth of the tests. The goal of this project is to use techniques from mutation testing to evaluate the performance of the WPT suite when bugs are deliberately introduced into the code base. &lt;br /&gt;
&lt;br /&gt;
The implementation of this project was done by writing python scripts that would modify the source code to generate mutants and run tests on them expecting failures. The scripts would temporarily modify the source codes, call the corresponding tests and revert back to the original code by reversing the changes that were made earlier. This process was repeated for multiple iterations by modifying various parts of the source code in random order.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use. [https://servo.org Servo] is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks. [https://en.wikipedia.org/wiki/Servo_(layout_engine)]&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://doc.rust-lang.org/book/second-edition/ Rust] is an open source,  systems programming language sponsored by Mozilla Research. Rust performs the majority of its safety checks and memory management decisions at compile time, so that program’s runtime performance is not impacted. Making it useful in programs with predictable space and time requirements, embedding in other languages, and writing low-level code, like device drivers and operating systems.&lt;br /&gt;
&lt;br /&gt;
===Web-platform-tests===&lt;br /&gt;
The [https://github.com/w3c/web-platform-tests web-platform-tests Project] is a W3C-coordinated attempt to build a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This, in turn, gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.&lt;br /&gt;
&lt;br /&gt;
===Mutation Testing===&lt;br /&gt;
Mutation Testing is a type of software testing where we mutate (change) certain statements in the source code and check if the test cases are able to find the errors.The goal of Mutation Testing is to assess the quality of the test cases which should be robust enough to fail mutant code. This method is also called as a Fault-based testing strategy as it involves creating faults in the program.Faults are introduced into the source code of the program by creating many versions called mutants. Each mutant should contain a single fault, and the goal is to cause the mutant version to fail which demonstrates the effectiveness of the test cases.[https://www.guru99.com/mutation-testing.html ]&lt;br /&gt;
&lt;br /&gt;
=='''Project description'''==&lt;br /&gt;
===Environment Setup===&lt;br /&gt;
* Clone the repository from [https://github.com/dsandeephegde/servo link]&lt;br /&gt;
* The steps to setup the environment for different OS are mentioned in readme file [https://github.com/servo/servo link].&lt;br /&gt;
&lt;br /&gt;
====Install packages==== &lt;br /&gt;
&lt;br /&gt;
Example, In OSX(homebrew):&lt;br /&gt;
&lt;br /&gt;
 brew install automake pkg-config python cmake yasm&lt;br /&gt;
 pip install virtualenv&lt;br /&gt;
&lt;br /&gt;
====Running test after setup====&lt;br /&gt;
&lt;br /&gt;
After the setup, make sure that everything works in your machine by building and running tests.&lt;br /&gt;
&lt;br /&gt;
build in release mode:&lt;br /&gt;
&lt;br /&gt;
 ./mach build --release&lt;br /&gt;
&lt;br /&gt;
run WPT tests:&lt;br /&gt;
&lt;br /&gt;
 ./mach test -wpt --release&lt;br /&gt;
&lt;br /&gt;
===Implemented steps===&lt;br /&gt;
The approach adopted was based on the requirements mentioned [https://github.com/servo/servo/wiki/Mutation-testing-project here]. The below steps implement the initial steps mentioned in the project description.&lt;br /&gt;
&lt;br /&gt;
* Step 1: A python script was written to mutate one source file and the corresponding WPT was run on it to check if the mutant was killed.&lt;br /&gt;
&lt;br /&gt;
* Step 2: A test framework was defined to identify the source files that require mutation testing along with their corresponding WPTs. This framework is implemented in /servo/components/script/dom.&lt;br /&gt;
&lt;br /&gt;
* Step 3: The script was expanded to include the test framework and automate the process of generating mutations for multiple source files and running their corresponding WPTs based on the test_mapping.json. The script also traverses through subfolders of the parsed path to check for the .json file. The script also logs on the terminal any mutants that the WPT failed to kill.&lt;br /&gt;
&lt;br /&gt;
* Step 4: Integrated the script so that it can be invoked from the CI tool.&lt;br /&gt;
&lt;br /&gt;
===Execution===&lt;br /&gt;
* Mutation test can be ran using either of the following command from the servo directory:&lt;br /&gt;
&lt;br /&gt;
 python python/servo/mutation/init.py components/script/dom&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 python etc/ci/mutation_test.py&lt;br /&gt;
&lt;br /&gt;
===Excecution Flow===&lt;br /&gt;
&lt;br /&gt;
Given a path&lt;br /&gt;
:mutation test(path)&lt;br /&gt;
::Look for test mapping file in that path&lt;br /&gt;
::for each file the in the test mapping&lt;br /&gt;
:::mutate a random line using some strategy in the file&lt;br /&gt;
:::build project and run WPT tests corresponding to it&lt;br /&gt;
:::if wpt tests pass?&lt;br /&gt;
::::report mautation test failure&lt;br /&gt;
:::else&lt;br /&gt;
::::report mutation test success&lt;br /&gt;
for each subfolder folder in the path&lt;br /&gt;
:mutation test(subfolder)&lt;br /&gt;
&lt;br /&gt;
===Output===&lt;br /&gt;
&lt;br /&gt;
The log for success to kill a mutant is as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Oss4.png]]&lt;br /&gt;
&lt;br /&gt;
The log for failure to kill a mutant is as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Oss1.png]]&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
&lt;br /&gt;
The project is about writing a python script to change the source code and run tests. It does not add any functionality to Servo. So there is no scope for testing in this project.&lt;br /&gt;
&lt;br /&gt;
===Subsequent steps===&lt;br /&gt;
&lt;br /&gt;
The following subsequent steps will be followed to meet the project requirements as per this [https://github.com/servo/servo/wiki/Mutation-testing-project].&lt;br /&gt;
&lt;br /&gt;
* implement mutations like replacing if statements by if true/if false, duplicating statements, reordering statements, changing arithmetic &amp;amp; atomic string constant.&lt;br /&gt;
* improving the performance of the testing, for example randomizing the test order, fast-failing, running tests with faster builds (e.g. ./mach build -d).&lt;br /&gt;
* find heuristics for identifying false positives, that is mutations which are expected to have no effect, for example removing logging.&lt;br /&gt;
* find search heuristics for identifying mutations that cause no test failures.&lt;br /&gt;
&lt;br /&gt;
===Challenges===&lt;br /&gt;
&lt;br /&gt;
1. Setting up the environment on the local machine:&lt;br /&gt;
&lt;br /&gt;
*The amount of time taken to build and test the WPT on the local machine was pretty long due to machine memory. Additionally faced problems on intermittent WPT test failures. It is expected that any reviewer will face a similar challenge.&lt;br /&gt;
&lt;br /&gt;
We overcame this challenge by discussing possibilities with Mozilla team who suggested us to use Janitor Technology. The servo image would be already set up with the latest code, we can edit code in cloud9 and execute it. Using this platform for our testing made the project agnostic of the environment on the local machine and any hassle associated with same.&lt;br /&gt;
&lt;br /&gt;
2. Defining the test mapping framework:&lt;br /&gt;
 &lt;br /&gt;
*Servo consists of multiple components of which there are many WPT tests written for each component. The test cases are organized according to the functionality they test, whereas the servo source code is organized according to the specific components. Due to a large number of source files and WPT tests for the entire project, it was difficult for one individual to have information on the mapping of components to their corresponding WPTs. &lt;br /&gt;
&lt;br /&gt;
Hence, we had to have a mapping to run the corresponding tests for a source file. The mapping framework enabled us to run tests on a few components and provide a base for other members from Mozilla team to add and replicate the same framework as per their requirement. We still need to find if there can be any automated way to populate the mapping.&lt;br /&gt;
&lt;br /&gt;
3. The extent of mutation testing to be performed.&lt;br /&gt;
&lt;br /&gt;
*There are standard techniques that define what a mutant is. For example, replacing '&amp;amp;&amp;amp;' with '||'. However, there is no specification for the number of replacements that must be made within a single source code, nor is there any specification on the permutations of possible mutations for each technique. This is an ambiguity in the project and our initial implementation replaces all instances of '&amp;amp;&amp;amp;' to '||' to generate a single type of mutant for each file of the source code. But now our implementation mutates random lines using a strategy. The code needs to evolve based on how runs/performs. And there is no predefined answer for it.&lt;br /&gt;
&lt;br /&gt;
==Pull Request==&lt;br /&gt;
&lt;br /&gt;
Here is our pull request [https://github.com/servo/servo/pull/18984  link]. &lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://www.guru99.com/mutation-testing.html&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://github.com/servo/servo&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo/wiki/Mutation-testing-project&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sdhegde</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing_on_Servo&amp;diff=111543</id>
		<title>CSC/ECE 517 Fall 2017/M1754 Mutation Testing on Servo</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing_on_Servo&amp;diff=111543"/>
		<updated>2017-11-02T23:47:11Z</updated>

		<summary type="html">&lt;p&gt;Sdhegde: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Servo uses the Web Platform Test (WPT) suite for testing, but does not perform an evaluation of the breadth of the tests. The goal of this project is to use techniques from mutation testing to evaluate the performance of the WPT suite when bugs are deliberately introduced into the code base. &lt;br /&gt;
&lt;br /&gt;
The implementation of this project was done by writing python scripts that would modify the source code to generate mutants and run tests on them expecting failures. The scripts would temporarily modify the source codes, call the corresponding tests and revert back to the original code by reversing the changes that were made earlier. This process was repeated for multiple iterations by modifying various parts of the source code in random order.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use. [https://servo.org Servo] is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks. [https://en.wikipedia.org/wiki/Servo_(layout_engine)]&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://doc.rust-lang.org/book/second-edition/ Rust] is an open source,  systems programming language sponsored by Mozilla Research. Rust performs the majority of its safety checks and memory management decisions at compile time, so that program’s runtime performance is not impacted. Making it useful in programs with predictable space and time requirements, embedding in other languages, and writing low-level code, like device drivers and operating systems.&lt;br /&gt;
&lt;br /&gt;
===Web-platform-tests===&lt;br /&gt;
The [https://github.com/w3c/web-platform-tests web-platform-tests Project] is a W3C-coordinated attempt to build a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This, in turn, gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.&lt;br /&gt;
&lt;br /&gt;
===Mutation Testing===&lt;br /&gt;
Mutation Testing is a type of software testing where we mutate (change) certain statements in the source code and check if the test cases are able to find the errors.The goal of Mutation Testing is to assess the quality of the test cases which should be robust enough to fail mutant code. This method is also called as a Fault-based testing strategy as it involves creating faults in the program.Faults are introduced into the source code of the program by creating many versions called mutants. Each mutant should contain a single fault, and the goal is to cause the mutant version to fail which demonstrates the effectiveness of the test cases.[https://www.guru99.com/mutation-testing.html ]&lt;br /&gt;
&lt;br /&gt;
=='''Project description'''==&lt;br /&gt;
===Environment Setup===&lt;br /&gt;
* Clone the repository from [https://github.com/dsandeephegde/servo link]&lt;br /&gt;
* The steps to setup the environment for different OS are mentioned in readme file [https://github.com/servo/servo link].&lt;br /&gt;
&lt;br /&gt;
====Install packages==== &lt;br /&gt;
&lt;br /&gt;
Example, In OSX(homebrew):&lt;br /&gt;
&lt;br /&gt;
 brew install automake pkg-config python cmake yasm&lt;br /&gt;
 pip install virtualenv&lt;br /&gt;
&lt;br /&gt;
====Running test after setup====&lt;br /&gt;
&lt;br /&gt;
After the setup, make sure that everything works in your machine by building and running tests.&lt;br /&gt;
&lt;br /&gt;
build in release mode:&lt;br /&gt;
&lt;br /&gt;
 ./mach build --release&lt;br /&gt;
&lt;br /&gt;
run WPT tests:&lt;br /&gt;
&lt;br /&gt;
 ./mach test -wpt --release&lt;br /&gt;
&lt;br /&gt;
===Implemented steps===&lt;br /&gt;
The approach adopted was based on the requirements mentioned [https://github.com/servo/servo/wiki/Mutation-testing-project here]. The below steps implement the initial steps mentioned in the project description.&lt;br /&gt;
&lt;br /&gt;
* Step 1: A python script was written to mutate one source file and the corresponding WPT was run on it to check if the mutant was killed.&lt;br /&gt;
&lt;br /&gt;
* Step 2: A test framework was defined to identify the source files that require mutation testing along with their corresponding WPTs. This framework is implemented in /servo/components/script/dom.&lt;br /&gt;
&lt;br /&gt;
* Step 3: The script was expanded to include the test framework and automate the process of generating mutations for multiple source files and running their corresponding WPTs based on the test_mapping.json. The script also traverses through subfolders of the parsed path to check for the .json file. The script also logs on the terminal any mutants that the WPT failed to kill.&lt;br /&gt;
&lt;br /&gt;
* Step 4: Integrated the script so that it can be invoked from the CI tool.&lt;br /&gt;
&lt;br /&gt;
===Execution===&lt;br /&gt;
* Mutation test can be ran using either of the following command from the servo directory:&lt;br /&gt;
&lt;br /&gt;
 python python/servo/mutation/init.py components/script/dom&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 python etc/ci/mutation_test.py&lt;br /&gt;
&lt;br /&gt;
===Excecution Flow===&lt;br /&gt;
&lt;br /&gt;
Given a path&lt;br /&gt;
:mutation test(path)&lt;br /&gt;
::Look for test mapping file in that path&lt;br /&gt;
::for each file the in the test mapping&lt;br /&gt;
:::mutate a random line using some strategy in the file&lt;br /&gt;
:::build project and run WPT tests corresponding to it&lt;br /&gt;
:::if wpt tests pass?&lt;br /&gt;
::::report mautation test failure&lt;br /&gt;
:::else&lt;br /&gt;
::::report mutation test success&lt;br /&gt;
for each subfolder folder in the path&lt;br /&gt;
:mutation test(subfolder)&lt;br /&gt;
&lt;br /&gt;
===Output===&lt;br /&gt;
&lt;br /&gt;
The log for success to kill a mutant is as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Oss4.png]]&lt;br /&gt;
&lt;br /&gt;
The log for failure to kill a mutant is as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Oss1.png]]&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
&lt;br /&gt;
The project is about writing a python script to change the source code and run tests. It does not add any functionality to Servo. So there is no scope for testing in this project.&lt;br /&gt;
&lt;br /&gt;
===Subsequent steps===&lt;br /&gt;
&lt;br /&gt;
The following subsequent steps will be followed to meet the project requirements as per this [https://github.com/servo/servo/wiki/Mutation-testing-project].&lt;br /&gt;
&lt;br /&gt;
* implement mutations like replacing if statements by if true/if false, duplicating statements, reordering statements, changing arithmetic &amp;amp; atomic string constant.&lt;br /&gt;
* improving the performance of the testing, for example randomizing the test order, fast-failing, running tests with faster builds (e.g. ./mach build -d).&lt;br /&gt;
* find heuristics for identifying false positives, that is mutations which are expected to have no effect, for example removing logging.&lt;br /&gt;
* find search heuristics for identifying mutations that cause no test failures.&lt;br /&gt;
&lt;br /&gt;
===Challenges===&lt;br /&gt;
&lt;br /&gt;
1. Setting up the environment on the local machine:&lt;br /&gt;
&lt;br /&gt;
*The amount of time taken to build and test the WPT on the local machine was pretty long due to machine memory. Additionally faced problems on intermittent WPT test failures. It is expected that any reviewer will face a similar challenge.&lt;br /&gt;
&lt;br /&gt;
We overcame this challenge by discussing possibilities with Mozilla team who suggested us to use Janitor Technology. The servo image would be already set up with the latest code, we can edit code in cloud9 and execute it. Using this platform for our testing made the project agnostic of the environment on the local machine and any hassle associated with same.&lt;br /&gt;
&lt;br /&gt;
2. Defining the test mapping framework:&lt;br /&gt;
 &lt;br /&gt;
*Servo consists of multiple components of which there are many WPT tests written for each component. The test cases are organized according to the functionality they test, whereas the servo source code is organized according to the specific components. Due to a large number of source files and WPT tests for the entire project, it was difficult for one individual to have information on the mapping of components to their corresponding WPTs. &lt;br /&gt;
&lt;br /&gt;
Hence, we had to have a mapping to run the corresponding tests for a source file. The mapping framework enabled us to run tests on a few components and provide a base for other members from Mozilla team to add and replicate the same framework as per their requirement. We still need to find if there can be any automated way to populate the mapping.&lt;br /&gt;
&lt;br /&gt;
3. The extent of mutation testing to be performed.&lt;br /&gt;
&lt;br /&gt;
*There are standard techniques that define what a mutant is. For example, replacing '&amp;amp;&amp;amp;' with '||'. However, there is no specification for the number of replacements that must be made within a single source code, nor is there any specification on the permutations of possible mutations for each technique. This is an ambiguity in the project and our initial implementation replaces all instances of '&amp;amp;&amp;amp;' to '||' to generate a single type of mutant for each file of the source code. But now our implementation mutates random lines using a strategy. The code needs to evolve based on how runs/performs. And there is no predefined answer for it.&lt;br /&gt;
&lt;br /&gt;
==Pull Request==&lt;br /&gt;
&lt;br /&gt;
Here is our pull request [https://github.com/servo/servo/pull/18984  link]. &lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://www.guru99.com/mutation-testing.html&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://github.com/servo/servo&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo/wiki/Mutation-testing-project&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sdhegde</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing_on_Servo&amp;diff=111320</id>
		<title>CSC/ECE 517 Fall 2017/M1754 Mutation Testing on Servo</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing_on_Servo&amp;diff=111320"/>
		<updated>2017-11-02T19:27:30Z</updated>

		<summary type="html">&lt;p&gt;Sdhegde: /* Challenges */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Servo uses the Web Platform Test (WPT) suite for testing, but does not perform an evaluation of the breadth of the tests. The goal of this project is to use techniques from mutation testing to evaluate the performance of the WPT suite when bugs are deliberately introduced into the code base. &lt;br /&gt;
&lt;br /&gt;
The implementation of this project was done by writing python scripts that would modify the source code to generate mutants and run tests on them expecting failures. The scripts would temporarily modify the source codes, call the corresponding tests and revert back to the original code by reversing the changes that were made earlier. This process was repeated for multiple iterations by modifying various parts of the source code in random order.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use. [https://servo.org Servo] is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks. [https://en.wikipedia.org/wiki/Servo_(layout_engine)]&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://doc.rust-lang.org/book/second-edition/ Rust] is an open source,  systems programming language sponsored by Mozilla Research. Rust performs the majority of its safety checks and memory management decisions at compile time, so that program’s runtime performance is not impacted. Making it useful in programs with predictable space and time requirements, embedding in other languages, and writing low-level code, like device drivers and operating systems.&lt;br /&gt;
&lt;br /&gt;
===Web-platform-tests===&lt;br /&gt;
The [https://github.com/w3c/web-platform-tests web-platform-tests Project] is a W3C-coordinated attempt to build a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This in turn, gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.&lt;br /&gt;
&lt;br /&gt;
===Mutation Testing===&lt;br /&gt;
Mutation Testing is a type of software testing where we mutate (change) certain statements in the source code and check if the test cases are able to find the errors.The goal of Mutation Testing is to assess the quality of the test cases which should be robust enough to fail mutant code. This method is also called as a Fault-based testing strategy as it involves creating faults in the program.Faults are introduced into the source code of the program by creating many versions called mutants. Each mutant should contain a single fault, and the goal is to cause the mutant version to fail which demonstrates the effectiveness of the test cases.[https://www.guru99.com/mutation-testing.html ]&lt;br /&gt;
&lt;br /&gt;
=='''Project description'''==&lt;br /&gt;
===Environment Setup===&lt;br /&gt;
* Clone the repository from [https://github.com/dsandeephegde/servo link]&lt;br /&gt;
* The steps to setup the environment for different OS are mentioned in readme file [https://github.com/servo/servo link].&lt;br /&gt;
&lt;br /&gt;
====Install packages==== &lt;br /&gt;
&lt;br /&gt;
Example, In OSX(homebrew):&lt;br /&gt;
&lt;br /&gt;
 brew install automake pkg-config python cmake yasm&lt;br /&gt;
 pip install virtualenv&lt;br /&gt;
&lt;br /&gt;
====Running test after setup====&lt;br /&gt;
&lt;br /&gt;
After the setup, make sure that everything works in your machine by building and running tests.&lt;br /&gt;
&lt;br /&gt;
build in release mode:&lt;br /&gt;
&lt;br /&gt;
 ./mach build --release&lt;br /&gt;
&lt;br /&gt;
run WPT tests:&lt;br /&gt;
&lt;br /&gt;
 ./mach test -wpt --release&lt;br /&gt;
&lt;br /&gt;
===Implemented steps===&lt;br /&gt;
The approach adopted was based on the requirements mentioned [https://github.com/servo/servo/wiki/Mutation-testing-project here]. The below steps implement the initial steps mentioned in the project description.&lt;br /&gt;
&lt;br /&gt;
* Step 1: A python script was written to mutate one source file and the corresponding WPT was run on it to check if the mutant was killed.&lt;br /&gt;
&lt;br /&gt;
* Step 2: A test framework was defined to identify the source files that require mutation testing along with their corresponding WPTs. This framework is implemented in /servo/components/script/dom.&lt;br /&gt;
&lt;br /&gt;
* Step 3: The script was expanded to include the test framework and automate the process of generating mutations for multiple source files and running their corresponding WPTs based on the test_mapping.json. The script also traverses through sub folders of the parsed path to check for the .json file. The script also logs on the terminal any mutants that the WPT failed to kill.&lt;br /&gt;
&lt;br /&gt;
* Step 4: Integrated the script so that it can be invoked from the CI tool.&lt;br /&gt;
&lt;br /&gt;
===Execution===&lt;br /&gt;
* Mutation test can be ran using either of the following command from the servo directory:&lt;br /&gt;
&lt;br /&gt;
 python python/servo/mutation/init.py components/script/dom&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 python etc/ci/mutation_test.py&lt;br /&gt;
&lt;br /&gt;
===Excecution Flow===&lt;br /&gt;
&lt;br /&gt;
Given a path&lt;br /&gt;
:mutation test(path)&lt;br /&gt;
::Look for test mapping file in that path&lt;br /&gt;
::for each file the in the test mapping&lt;br /&gt;
:::mutate a random line using some strategy in the file&lt;br /&gt;
:::build project and run wpt tests corresponding to it&lt;br /&gt;
:::if wpt tests pass?&lt;br /&gt;
::::report mautation test failure&lt;br /&gt;
:::else&lt;br /&gt;
::::report mautation test success&lt;br /&gt;
for each subfolder folder in the path&lt;br /&gt;
:mutation test(subfolder)&lt;br /&gt;
&lt;br /&gt;
===Output===&lt;br /&gt;
&lt;br /&gt;
The log for success to kill a mutant is as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Oss4.png]]&lt;br /&gt;
&lt;br /&gt;
The log for failure to kill a mutant is as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Oss1.png]]&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
&lt;br /&gt;
The project is about writing a python script to change the source code and run tests. It does not add any functionality to Servo. So there is no scope for testing in this project.&lt;br /&gt;
&lt;br /&gt;
===Subsequent steps===&lt;br /&gt;
&lt;br /&gt;
The following subsequent steps will be followed to meet the project requirements as per this [https://github.com/servo/servo/wiki/Mutation-testing-project].&lt;br /&gt;
&lt;br /&gt;
* implement mutations like replacing if statements by if true/if false, duplicating statements, reordering statements, changing arithmetic &amp;amp; atomic string constant.&lt;br /&gt;
* improving the performance of the testing, for example randomizing the test order, fast-failing, running tests with faster builds (e.g. ./mach build -d).&lt;br /&gt;
* find heuristics for identifying false positives, that is mutations which are expected to have no effect, for example removing logging.&lt;br /&gt;
* find search heuristics for identifying mutations that cause no test failures.&lt;br /&gt;
&lt;br /&gt;
===Challenges===&lt;br /&gt;
&lt;br /&gt;
1. Setting up the environment on the local machine:&lt;br /&gt;
&lt;br /&gt;
*The amount of time taken to build and test the WPT in the local machine was pretty long due to machine memory. Additionally faced problems on intermittent WPT test failures. It is expected that any reviewer will face a similar challenge.&lt;br /&gt;
&lt;br /&gt;
We overcame this challenge by discussing possibilities with Mozilla team who suggested us to use Janitor Technology. The servo image would be already set up with the latest code, we can edit code in cloud9 and execute it. Using this platform for our testing made the project agnostic of the environment on the local machine and any hassle associated with same.&lt;br /&gt;
&lt;br /&gt;
2. Defining the test mapping framework:&lt;br /&gt;
 &lt;br /&gt;
*Servo consists of multiple components of which there are many WPT tests written for each component. The test cases are organized according to the functionality they test, whereas the servo source code is organized according to the specific components. Due to a large number of source files and WPT tests for the entire project, it was difficult for one individual to have information on the mapping of components to their corresponding WPTs. &lt;br /&gt;
&lt;br /&gt;
Hence, we had to have a mapping to run the corresponding tests for a source file. The mapping framework enabled us to run tests on a few components and provide a base for other members from Mozilla team to add and replicate the same framework as per their requirement. We still need to find if there can be any automated way to populate the mapping.&lt;br /&gt;
&lt;br /&gt;
3. The extent of mutation testing to be performed.&lt;br /&gt;
&lt;br /&gt;
*There are standard techniques that define what a mutant is. For example, replacing '&amp;amp;&amp;amp;' with '||'. However, there is no specification for the number of replacements that must be made within a single source code, nor is there any specification on the permutations of possible mutations for each technique. This is an ambiguity in the project and our initial implementation replaces all instances of '&amp;amp;&amp;amp;' to '||' to generate a single type of mutant for each file of the source code. But now our implementation mutates random lines using a strategy. The code needs to evolve based on how runs/performs. And there is no predefined answer for it.&lt;br /&gt;
&lt;br /&gt;
==Pull Request==&lt;br /&gt;
&lt;br /&gt;
Here is our pull request [https://github.com/servo/servo/pull/18984  link]. &lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://www.guru99.com/mutation-testing.html&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://github.com/servo/servo&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo/wiki/Mutation-testing-project&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sdhegde</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing_on_Servo&amp;diff=111254</id>
		<title>CSC/ECE 517 Fall 2017/M1754 Mutation Testing on Servo</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/M1754_Mutation_Testing_on_Servo&amp;diff=111254"/>
		<updated>2017-11-02T18:26:58Z</updated>

		<summary type="html">&lt;p&gt;Sdhegde: /* Running test after setup */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Servo uses the Web Platform Test (WPT) suite for testing, but does not perform an evaluation of the breadth of the tests. The goal of this project is to use techniques from mutation testing to evaluate the performance of the WPT suite when bugs are deliberately introduced into the code base. &lt;br /&gt;
&lt;br /&gt;
The implementation of this project was done by writing python scripts that would modify the source code to generate mutants and run tests on them expecting failures. The scripts would temporarily modify the source codes, call the corresponding tests and revert back to the original code by reversing the changes that were made earlier. This process was repeated for multiple iterations by modifying various parts of the source code in random order.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use. [https://servo.org Servo] is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks. [https://en.wikipedia.org/wiki/Servo_(layout_engine)]&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://doc.rust-lang.org/book/second-edition/ Rust] is an open source,  systems programming language sponsored by Mozilla Research. Rust performs the majority of its safety checks and memory management decisions at compile time, so that program’s runtime performance is not impacted. Making it useful in programs with predictable space and time requirements, embedding in other languages, and writing low-level code, like device drivers and operating systems.&lt;br /&gt;
&lt;br /&gt;
===Web-platform-tests===&lt;br /&gt;
The [https://github.com/w3c/web-platform-tests web-platform-tests Project] is a W3C-coordinated attempt to build a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This in turn, gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.&lt;br /&gt;
&lt;br /&gt;
===Mutation Testing===&lt;br /&gt;
Mutation Testing is a type of software testing where we mutate (change) certain statements in the source code and check if the test cases are able to find the errors.The goal of Mutation Testing is to assess the quality of the test cases which should be robust enough to fail mutant code. This method is also called as a Fault-based testing strategy as it involves creating faults in the program.Faults are introduced into the source code of the program by creating many versions called mutants. Each mutant should contain a single fault, and the goal is to cause the mutant version to fail which demonstrates the effectiveness of the test cases.[https://www.guru99.com/mutation-testing.html ]&lt;br /&gt;
&lt;br /&gt;
=='''Project description'''==&lt;br /&gt;
===Environment Setup===&lt;br /&gt;
* Clone the repository from [https://github.com/dsandeephegde/servo link]&lt;br /&gt;
* The steps to setup the environment for different OS are mentioned in readme file [https://github.com/servo/servo link].&lt;br /&gt;
&lt;br /&gt;
====Install packages==== &lt;br /&gt;
&lt;br /&gt;
Example, In OSX(homebrew):&lt;br /&gt;
&lt;br /&gt;
 brew install automake pkg-config python cmake yasm&lt;br /&gt;
 pip install virtualenv&lt;br /&gt;
&lt;br /&gt;
====Running test after setup====&lt;br /&gt;
&lt;br /&gt;
After the setup, make sure that everything works in your machine by building and running tests.&lt;br /&gt;
&lt;br /&gt;
build in release mode:&lt;br /&gt;
&lt;br /&gt;
 ./mach build --release&lt;br /&gt;
&lt;br /&gt;
run WPT tests:&lt;br /&gt;
&lt;br /&gt;
 ./mach test -wpt --release&lt;br /&gt;
&lt;br /&gt;
===Implemented steps===&lt;br /&gt;
The approach adopted was based on the requirements mentioned [https://github.com/servo/servo/wiki/Mutation-testing-project here]. The below steps implement the initial steps mentioned in the project description.&lt;br /&gt;
&lt;br /&gt;
* Step 1: A python script was written to mutate one source file and the corresponding WPT was run on it to check if the mutant was killed.&lt;br /&gt;
&lt;br /&gt;
* Step 2: A test framework was defined to identify the source files that require mutation testing along with their corresponding WPTs. This framework is implemented in /servo/components/script/dom.&lt;br /&gt;
&lt;br /&gt;
* Step 3: The script was expanded to include the test framework and automate the process of generating mutations for multiple source files and running their corresponding WPTs based on the test_mapping.json. The script also traverses through sub folders of the parsed path to check for the .json file. The script also logs on the terminal any mutants that the WPT failed to kill.&lt;br /&gt;
&lt;br /&gt;
* Step 4: Integrated the script so that it can be invoked from the CI tool.&lt;br /&gt;
&lt;br /&gt;
===Execution===&lt;br /&gt;
* Mutation test can be ran using either of the following command from the servo directory:&lt;br /&gt;
&lt;br /&gt;
 python python/servo/mutation/init.py components/script/dom&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 python etc/ci/mutation_test.py&lt;br /&gt;
&lt;br /&gt;
===Excecution Flow===&lt;br /&gt;
&lt;br /&gt;
Given a path&lt;br /&gt;
:mutation test(path)&lt;br /&gt;
::Look for test mapping file in that path&lt;br /&gt;
::for each file the in the test mapping&lt;br /&gt;
:::mutate a random line using some strategy in the file&lt;br /&gt;
:::build project and run wpt tests corresponding to it&lt;br /&gt;
:::if wpt tests pass?&lt;br /&gt;
::::report mautation test failure&lt;br /&gt;
:::else&lt;br /&gt;
::::report mautation test success&lt;br /&gt;
for each subfolder folder in the path&lt;br /&gt;
:mutation test(subfolder)&lt;br /&gt;
&lt;br /&gt;
===Output===&lt;br /&gt;
&lt;br /&gt;
The log for success to kill a mutant is as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Oss4.png]]&lt;br /&gt;
&lt;br /&gt;
The log for failure to kill a mutant is as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Oss1.png]]&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
&lt;br /&gt;
The project is about writing a python script to change the source code and run tests. It does not add any functionality to Servo. So there is no scope for testing in this project.&lt;br /&gt;
&lt;br /&gt;
===Subsequent steps===&lt;br /&gt;
&lt;br /&gt;
The following subsequent steps will be followed to meet the project requirements as per this [https://github.com/servo/servo/wiki/Mutation-testing-project].&lt;br /&gt;
&lt;br /&gt;
* implement mutations like replacing if statements by if true/if false, duplicating statements, reordering statements, changing arithmetic &amp;amp; atomic string constant.&lt;br /&gt;
* improving the performance of the testing, for example randomizing the test order, fast-failing, running tests with faster builds (e.g. ./mach build -d).&lt;br /&gt;
* find heuristics for identifying false positives, that is mutations which are expected to have no effect, for example removing logging.&lt;br /&gt;
* find search heuristics for identifying mutations that cause no test failures.&lt;br /&gt;
&lt;br /&gt;
===Challenges===&lt;br /&gt;
&lt;br /&gt;
1. Setting up the environment on the local machine:&lt;br /&gt;
&lt;br /&gt;
*The amount of time taken to build and test the WPT in the local machine was pretty long due to machine memory. Additionally faced problems on intermittent WPT test failures. It is expected that any reviewer will face a similar challenge.&lt;br /&gt;
&lt;br /&gt;
We overcame this challenge by discussing possibilities with Mozilla team who suggested us to use Janitor Technology. The servo image would be already set up with the latest code, we can edit code in cloud9 and execute it. Using this platform for our testing made the project agnostic of the environment on the local machine and any hassle associated with same.&lt;br /&gt;
&lt;br /&gt;
2. Defining the test mapping framework:&lt;br /&gt;
 &lt;br /&gt;
*Servo consists of multiple components of which there are many WPT tests written for each component. The test cases are organized according to the functionality they test, whereas the servo source code is organized according to the specific components. Due to a large number of source files and WPT tests for the entire project, it was difficult for one individual to have information on the mapping of components to their corresponding WPTs. &lt;br /&gt;
&lt;br /&gt;
Hence, we had to have a mapping to run the corresponding tests for a source file. The mapping framework enabled us to run tests on a few components and provide a base for other members from Mozilla team to add and replicate the same framework as per their requirement.&lt;br /&gt;
&lt;br /&gt;
3. Understanding the extent of mutation testing to be performed.&lt;br /&gt;
&lt;br /&gt;
*There are standard techniques that define what a mutant is. For example, replacing '&amp;amp;&amp;amp;' with '||'. However, there is no specification for the number of replacements that must be made within a single source code, nor is there any specification on the permutations of possible mutations for each technique. This is an ambiguity in the project and our implementation replaces all instances of '&amp;amp;&amp;amp;' to '||' to generate a single type of mutant for the each file of the source code.&lt;br /&gt;
&lt;br /&gt;
==Pull Request==&lt;br /&gt;
&lt;br /&gt;
Here is our pull request [https://github.com/servo/servo/pull/18984  link]. &lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://www.guru99.com/mutation-testing.html&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://github.com/servo/servo&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo/wiki/Mutation-testing-project&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sdhegde</name></author>
	</entry>
</feed>