Presentation is loading. Please wait.

Presentation is loading. Please wait.

Dynamic Symbolic Execution

Similar presentations


Presentation on theme: "Dynamic Symbolic Execution"— Presentation transcript:

1 Dynamic Symbolic Execution
Tao Xie

2 Test Data Generation Human Brute Force Semi - Random
Expensive, incomplete, … Brute Force Pairwise, predefined data, etc… Semi - Random Cheap, Fast “It passed a thousand tests” feeling Dynamic Symbolic Execution: IntelliTest/Pex, SAGE, CUTE, … Automated white-box Not random – Constraint Solving

3 Assumptions and Assertions
void PexAssume.IsTrue(bool c) { if (!c) throw new AssumptionViolationException(); } void PexAssert.IsTrue(bool c) { if (!c) throw new AssertionViolationException(); } Assumptions and assertions induce branches Executions which cause assumption violations are ignored, not reported as errors or test cases

4 Background: DSE Choose next path Generates test data systematically
Solve Execute&Monitor void CoverMe(int[] a) { if (a == null) return; if (a.Length > 0) if (a[0] == ) throw new Exception("bug"); } Constraints to solve a!=null a!=null && a.Length>0 a.Length>0 && a[0]== Input null {} {0} {123…} Observed constraints a==null a!=null && !(a.Length>0) a==null && a.Length>0 && a[0]!= a[0]== a==null F T a.Length>0 F T Done: There is no path left. a[0]==123… F T 4 4 4 4

5 Pex4Fun 1,857,924 clicked 'Ask Pex!' http://pex4fun.com/
Nikolai Tillmann, Jonathan De Halleux, Tao Xie, Sumit Gulwani and Judith Bishop. Teaching and Learning Programming and Software Engineering via Interactive Gaming. In ICSE 2013, SEE.

6 Pex4Fun https://sites.google.com/site/teachpex/Home/pex-usage-tips
Click  Copy and modify the following code snippet in the code editing box (or simply click here) using System; using Microsoft.Pex.Framework; using Microsoft.Pex.Framework.Settings; [PexClass] public class Program  { [PexMethod]//[PexMethod(TestEmissionFilter=PexTestEmissionFilter.All)]   public static string testMethod(int x, int y)   {     PexAssume.IsTrue(y >= 0);//replace here with your assumption     //... enter your code under test here     //if (x == 10000) throw new Exception();     PexAssert.IsTrue(y >= 0);//replace here with your assertion     return PexSymbolicValue.GetPathConditionString();   } }

7 Microsoft Visual Studio 2015/2017 IntelliTest

8 Microsoft Visual Studio 2015/2017 IntelliTest


Download ppt "Dynamic Symbolic Execution"

Similar presentations


Ads by Google