Comments (8)
Thanks @pdeligia, looking forward to it!
from coyote.
@pdeligia You rock! Thanks for the quick help. The above thing works.
from coyote.
Hey @ankushdesai, we will put out a new version soon that will include an API that allows you to do this. It will look like this:
// For replaying a bug and single stepping
Configuration configuration = Configuration.Create();
configuration.WithVerbosityEnabled(true);
// update the path to the schedule file.
configuration.WithReplayStrategy("AfterNewUpdate.schedule");
TestingEngine engine = TestingEngine.Create(configuration, (Action<IActorRuntime>)function.start);
engine.Run();
string bug = engine.TestReport.BugReports.FirstOrDefault();
if (bug != null)
{
Console.WriteLine(bug);
}
The following API:
ITestingEngine engine = TestingEngineFactory.CreateReplayEngine(configuration, (Action<IActorRuntime>)function.start);
is replaced by:
TestingEngine engine = TestingEngine.Create(configuration, (Action<IActorRuntime>)function.start);
That is already available. What is missing is:
configuration.WithReplayStrategy("AfterNewUpdate.schedule");
from coyote.
@ankushdesai v1.0.4 is out, so this should work now, but let me know if it doesn't!
from coyote.
Thanks a lot @pdeligia, will try it out and get back to you.
from coyote.
I am able to use this feature now, thanks for all the help!
@pdeligia
from coyote.
@pdeligia There seems to be some problem with the usage of the new API.
configuration.WithReplayStrategy("xx.schedule");
TestingEngine engine = TestingEngine.Create(configuration, (Action<IActorRuntime>)function.start);
It throws the following exception when passed any string as input:
Unhandled exception. System.FormatException: Input string was not in a correct format.
at System.Number.ThrowOverflowOrFormatException(ParsingStatus status, TypeCode type)
at Microsoft.Coyote.SystematicTesting.ScheduleTrace..ctor(String[] traceDump)
at Microsoft.Coyote.SystematicTesting.TestingEngine..ctor(Configuration configuration, TestMethodInfo testMethodInfo)
at Microsoft.Coyote.SystematicTesting.TestingEngine..ctor(Configuration configuration, Delegate test)
at Microsoft.Coyote.SystematicTesting.TestingEngine.Create(Configuration configuration, Action`1 test)
Can you please help?
from coyote.
@ankushdesai actually you need to pass the contents of the file to this API, rather than the file itself :) Sorry if this was confusing! We plan to write some documentation page on how to use the programmatic test API and will clarify there.
You could do something like:
File.WriteAllText("xx.schedule", reproducableTrace);
configuration.WithReplayStrategy(reproducableTrace);
But there is another way, that works if in the same test you already run the non-replay testing engine! You could do something like:
// Test to find a bug.
Configuration testConfiguration = Configuration.Create(); // assign more options
TestingEngine testingEngine = TestingEngine.Create(testConfiguration, (Action<IActorRuntime>)function.start);
engine.Run();
string bug = testingEngine.TestReport.BugReports.FirstOrDefault();
if (testingEngine.TestReport.NumOfFoundBugs > 0)
{
Configuration replayConfiguration = Configuration.Create().WithReplayStrategy(testingEngine.ReproducableTrace);
TestingEngine replayEngine = TestingEngine.Create(replayConfiguration, (Action<IActorRuntime>)function.start);
replayEngine.Run();
}
Basically, in the next version, we will expose two currently internal APIs (only set during testing, not replay):
string TestingEngine.ReadableTrace;
string TestingEngine.ReproducableTrace;
The first gives you the contents of the human readable trace (which are normally dump inside the schedule .txt
file), and the second gives you the contents of the .schedule
file. So you can then do all these stuff programmatically (and even write them in your own custom locations/files). This is just optional btw, you can still read the file content of the schedule and pass it to the method as I described in the start of this post :)
Hope this helps!
from coyote.
Related Issues (20)
- fix compatibility issue with VS Code coverage and assembly rewriting HOT 3
- include the test method name in the schedule file
- Why does coyote find no bugs in this code? HOT 1
- fix send event logs when actor runtime has terminated
- Question: About Coyote supporting .NET Core HOT 2
- coyote test failure: Could not load file or assembly 'Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. HOT 5
- Deadlock when using SemaphoreSlim HOT 9
- Error: Please provide RewritingOptions.AssemblyPaths HOT 3
- Improve logging infrastructure when used with xUnit HOT 4
- disable periodic deadlock monitor when running in a debugger
- InvalidProgramException while trying coyote on my library. HOT 13
- IAsyncEnumerable with ToArrayAsync System.BadImageFormatException HOT 2
- race in updating coverage report
- Exception when trying to rewrite WPF .NET 6.0 application; unable to find PresentationCore HOT 5
- Potential bug with race condition HOT 4
- Deadlock if Interleave point inside a static constructor
- Unable to load one or more of the requested types
- Reschdule after AutoResetEvent.Set HOT 6
- System.NullReferenceException when using Timer in test class
- "Object reference not set to an instance of an object" when running the rewriter.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from coyote.