public void Tc031() { var testdata = InitTestData <TestDataAddWrapConversion>(); WrapTrackShell = Get <IWrapTrackWebShell>(); // Use default user WrapTrackShell.Login(); var testCaseUtil = new TestCaseUtils(StfAssert); var addCarrier = testCaseUtil.GetAddCarrier(WrapTrackShell, testdata.CarrierType); StfAssert.IsTrue("HandleHomeMade", testCaseUtil.HandleHomeMade(addCarrier, testdata.HomeMade)); testCaseUtil.HandleBrandCarriertypenicknameCarriermodel( addCarrier, testdata.Brand, testdata.CarrierTypeNickName, testdata.CarrierModel); StfAssert.IsTrue("Save", addCarrier.Save()); // Log where we got redirected to - Page Safe is fine - Control is better:-) StfLogger.LogScreenshot(StfLogLevel.SubHeader, "After Pressed Save"); }
public void Tc026() { // Set up user context for actual test // Use default user WrapTrackShell.Login(); var me = WrapTrackShell.Me(); StfAssert.IsNotNull("WrapTrackShell", WrapTrackShell); StfAssert.IsInstanceOfType("me", me, typeof(IMeProfile)); // Create a new wrap var wrapCollection = me.GetCollection(); StfAssert.IsNotNull("check if me.GetCollection null", wrapCollection); var newWrapWtId = wrapCollection.AddWrap(); // Move to the new wrap var wraptoSendOnVisit = WrapTrackShell.GetToWrap(newWrapWtId); StfAssert.IsNotNull("Check if wraptoSendOnVisit is null", wraptoSendOnVisit); // Move to the new wrap var wrapToSendOnHoliday = WrapTrackShell.GetToWrap(newWrapWtId); var recipient = GetAnotherUser(); // Send wrap away on holiday wrapToSendOnHoliday.SendAwayTemporarily(SendAwayReason.Holiday, recipient); var isNewsAboutWrapSentOnHoliday = IsNewsAboutWrapSentOnHoliday(newWrapWtId, WrapTrackShell.CurrentLoggedInUser, recipient); StfAssert.IsTrue("Is there news that the wrap is sent on holiday", isNewsAboutWrapSentOnHoliday); }
public void TestLogAllTypesOfOutcome() { var iteration = StfIterationNo; switch (iteration) { case 1: StfAssert.IsTrue("Pass", true); break; case 2: StfAssert.IsTrue("Fail", false); break; case 3: StfAssert.IsInconclusive("Inconclusive", "Inconclusive"); break; case 4: StfLogger.LogWarning("Warning", "Warning"); break; case 5: StfLogger.LogError("Error", "Error"); break; } }
public void Tc038() { StfAssert.IsNotNull("wrapTrackShell", WrapTrackShell); WrapTrackShell.SignUp(); var criteria = EnumExtensions.GetRandomEnum <ModelReviewProperties>(); var criteriaText = criteria.GetDisplayName(); var me = WrapTrackShell.Me(); StfAssert.IsNotNull("me", me); var collection = me.GetCollection(); StfAssert.IsNotNull("Got my collection", collection); var newWrap = collection.AddWrap(BrandName, PatternName, ModelName); var wrap = GetToWrap(newWrap); var makeEvaluationForWrap = MakeEvaluationForWrap(wrap, criteria); StfAssert.IsTrue("evaluation made for wrap", makeEvaluationForWrap); var doesNewsOfCarrierEvaluationExist = DoesNewsOfCarrierEvaluationExist(ModelName, criteriaText); StfAssert.IsTrue("Does news exist that carrier has an evaluation", doesNewsOfCarrierEvaluationExist); }
public void Tc027() { const string ChapterText = "Some text to add from TC027"; StfAssert.IsNotNull("wrapTrackShell", WrapTrackShell); WrapTrackShell.SignUp(); var me = WrapTrackShell.Me(); StfAssert.IsNotNull("me", me); var collection = me.GetCollection(); StfAssert.IsNotNull("Got my collection", collection); var newWrap = collection.AddWrap("Ali Dover", "Hygge", "blue"); var wrap = GetToWrap(newWrap); var addChapter = AddChapter(wrap, ChapterText); StfAssert.IsTrue("Added Chapter", addChapter); var doesNewsExist = DoesNewsExist(newWrap, ChapterText); StfAssert.IsTrue("Does news exist for the added Chapter", doesNewsExist); StfLogger.LogInfo("Hi Brian, here is the currently logged in user {0}", WrapTrackShell.CurrentLoggedInUser); }
public void Tc037() { const string ReviewText = "This is an automated review by TC037"; const string BrandName = "Agossie"; const string PatternName = "Orchid"; const string ModelName = "Glores"; StfAssert.IsNotNull("wrapTrackShell", WrapTrackShell); WrapTrackShell.SignUp(); var me = WrapTrackShell.Me(); StfAssert.IsNotNull("me", me); var collection = me.GetCollection(); StfAssert.IsNotNull("Got my collection", collection); var newWrap = collection.AddWrap(BrandName, PatternName, ModelName); var wrap = GetToWrap(newWrap); var writeReviewForWrap = WriteReviewForWrap(wrap, ReviewText); StfAssert.IsTrue("Review written for wrap", writeReviewForWrap); var doesNewsOfCarrierReviewExist = DoesNewsOfCarrierReviewExist(ModelName, ReviewText); StfAssert.IsTrue("Does news exist that carrier has a review", doesNewsOfCarrierReviewExist); }
public void Tc016() { // For now hard coded. TOdo: Random const string BrandId = "289"; const string BrandName = "Agossie"; // Use default user WrapTrackShell.Login(); StfAssert.IsNotNull("wrapTrackShell", WrapTrackShell); var randomBrand = this.GetBrand(BrandName); var newModelName = WtUtils.GetRandomString("StfModel"); var baseLineNumberOfModels = wtApi.BrandNumberOfModels(BrandId); var modelAdded = randomBrand.AddModel(newModelName); var numberOfModels = wtApi.BrandNumberOfModels(BrandId); StfAssert.IsTrue($"Model {newModelName} Added", modelAdded); StfAssert.AreEqual("Number of models for brand up by one", numberOfModels, baseLineNumberOfModels + 1); var patternDeleted = randomBrand.DeleteModel(newModelName); numberOfModels = wtApi.BrandNumberOfModels(BrandId); StfAssert.IsTrue($"Model {newModelName} Deleted", patternDeleted); StfAssert.AreEqual($"Number of models for brand as baseline", numberOfModels, baseLineNumberOfModels); }
public void Tc015() { // For now hard coded. TOdo: Random const string BrandId = "289"; const string BrandName = "Agossie"; // Use default user WrapTrackShell.Login(); StfAssert.IsNotNull("wrapTrackShell", WrapTrackShell); var randomBrand = this.GetBrand(BrandName); var newPatternName = WtUtils.GetRandomString("StfPattern"); var baseLineNumberOfPatterns = wtApi.BrandNumberOfPatterns(BrandId); var patternAdded = randomBrand.AddPattern(newPatternName); var numberOfPatterns = wtApi.BrandNumberOfPatterns(BrandId); StfAssert.IsTrue($"Pattern {newPatternName} Added", patternAdded); StfAssert.GreaterThan("Number of patterns for brand up by one", numberOfPatterns, baseLineNumberOfPatterns); var patternDeleted = randomBrand.DeletePattern(newPatternName); StfAssert.IsTrue($"Pattern {newPatternName} Deleted", patternDeleted); numberOfPatterns = wtApi.BrandNumberOfPatterns(BrandId); StfAssert.AreEqual($"Number of patterns for brand as baseline", numberOfPatterns, baseLineNumberOfPatterns); }
public void Tc024() { // Set up user context for actual test // Use default user WrapTrackShell.Login(); var me = WrapTrackShell.Me(); StfAssert.IsNotNull("WrapTrackShell", this.WrapTrackShell); StfAssert.IsInstanceOfType("me", me, typeof(IMeProfile)); // Actual test // Create a new wrap var wrapCollection = me.GetCollection(); StfAssert.IsNotNull("check if me.GetCollection null", wrapCollection); var newWrapWtId = wrapCollection.AddWrap(); // Move to the new wrap var wrapToSendOnHoliday = this.WrapTrackShell.GetToWrap(newWrapWtId); var recipient = this.GetAnotherUser(); // Send warp away on holiday wrapToSendOnHoliday.SendAwayTemporarily(SendAwayReason.Holiday, recipient); // Validate the the wrap indeed is on holiday var wtApi = this.Get <IWtApi>(); var wrapInfo = wtApi.WrapInfoByTrackId(newWrapWtId); StfLogger.LogInfo("The recipient user name attempted is {0} and userid from wrapInfo API is {1}", recipient, wrapInfo.VisitingUserId); StfAssert.IsTrue("Wrap is on holiday", wrapInfo.OnHoliday); }
public void TestStfPluginLoaderRegistersSingletonCorrectly() { LoadAdditionalStfPlugins(".", "Stf.UnitTestPlugin*.dll"); var sp2 = Get <IStfUnitTestPlugin2>(); StfAssert.IsNotNull("sp2 != null", sp2); var pluginObject1 = Get <ITestPluginModel2>(); pluginObject1.TestProp = "Changed"; var pluginObject2 = Get <ITestPluginModel2>(); StfAssert.IsFalse("TestpluginModel is not a singleton", pluginObject1.Equals(pluginObject2)); StfAssert.StringEquals("Object with default value", "Default", pluginObject2.TestProp); StfAssert.StringEquals("Object with changed value", "Changed", pluginObject1.TestProp); var singletonObject = Get <IStfSingletonPluginType>(); StfAssert.IsFalse("Singleton bool is false", singletonObject.SingletonBool); StfAssert.AreEqual("SingletonInteger is 1", 1, singletonObject.SingletonInteger); singletonObject.SingletonBool = true; singletonObject.SingletonInteger++; var singletonObject2 = Get <IStfSingletonPluginType>(); StfAssert.IsTrue("Singleton object is a singleton", singletonObject2.Equals(singletonObject)); StfAssert.IsTrue("Singleton is true", singletonObject2.SingletonBool); StfAssert.AreEqual("SingletonInteger is 2", 2, singletonObject2.SingletonInteger); }
public void Tc036() { const string TypeOfSale = "for sale (FSO)"; StfAssert.IsNotNull("wrapTrackShell", WrapTrackShell); WrapTrackShell.SignUp(); var me = WrapTrackShell.Me(); StfAssert.IsNotNull("me", me); var collection = me.GetCollection(); StfAssert.IsNotNull("Got my collection", collection); var newWrap = collection.AddWrap("Ali Dover", "Hygge", "blue"); var wrap = GetToWrap(newWrap); var markWrapForSale = MarkWrapForSale(wrap, TypeOfSale); StfAssert.IsTrue("Marked carrier for sale", markWrapForSale); var doesNewsOfCarrierForSaleExist = this.DoesNewsOfCarrierForSaleExist(newWrap, TypeOfSale); StfAssert.IsTrue("Does news exist that carrier is for sale", doesNewsOfCarrierForSaleExist); }
public void TestMethodPredicate() { var peopleList = new List <People>() { new People { Name = "Name1", Age = 41, Height = 1.1 }, new People { Name = "Name2", Age = 42, Height = 1.2 }, new People { Name = "Name3", Age = 43, Height = 1.3 } }; var predicate = new Predicate(); PeopleFilter filter; List <People> result; filter = new PeopleFilter { AgeFilter = 42 }; result = predicate.FilterList(peopleList, filter); StfAssert.IsTrue("Found", result.Any()); StfAssert.AreEqual("Found", result.FirstOrDefault().Name, "Name2"); filter = new PeopleFilter { Name = "Name3" }; result = predicate.FilterList(peopleList, filter); StfAssert.IsTrue("Found", result.Any()); StfAssert.AreEqual("Found", result.FirstOrDefault().Age, 43); }
public void Tc002() { // Make sure login is possible WrapTrackShell.Login(); var me = WrapTrackShell.Me(); StfAssert.IsNotNull("wrapTrackShell", WrapTrackShell); StfAssert.IsInstanceOfType("me", me, typeof(IMeProfile)); // try wrong pw WrapTrackShell.Logout(); WrapTrackShell.Login("mie88", "1234"); var feedback = WrapTrackShell.InfoText("mes_loginerror"); StfAssert.IsTrue("User got feedback: 'wrong username/pw'", feedback); // try unkown username WrapTrackShell.Login("detvillemanadrigkaldesig", "wraptrack4ever"); var feedback2 = WrapTrackShell.InfoText("mes_loginerror"); StfAssert.IsTrue("User got feedback: 'wrong username/pw'", feedback2); }
public void SimpleSuccessRetryerFunctionTest() { var retryerUtils = new RetryerUtils(5, TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(1)); var success = retryerUtils.Retry(() => SimpleTestFunction("wait", 3)); StfAssert.IsTrue("Wait", success); }
public void DatadrivenLoggerTest3LinesLine1Fail() { var iteration = (int)TestContext.DataRow["Iteration"]; var message = (string)TestContext.DataRow["Message"]; var failPass = ConvertToBool((string)TestContext.DataRow["FailPass"]); StfLogger.LogInfo($"Iteration [{iteration}]: {message}"); Assert.IsTrue(StfAssert.IsTrue("FailPass", failPass) == failPass); }
public void TestMethodSummaryLogger() { var logDir = Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, @".\Data")); var summaryFilename = Path.Combine(StfTextUtils.GetVariable("Stf_LogDir"), "TestMethodSummaryLogger_SummaryLog.html"); var oneSummaryLogger = new StfSummaryLogger(); StfAssert.IsTrue("StfLogger.CreateSummaryLog", oneSummaryLogger.CreateSummaryLog(summaryFilename, logDir, "DatadrivenLoggerTest_*.html")); StfAssert.FileExists("StfLogger.CreateSummaryLog", summaryFilename); }
public void TestGetTestDataValueGuid() { var testCaseDirectoryDataUtils = new TestCaseDirectoryDataUtils(8001, UnitTestTestDataRoot); var actual = testCaseDirectoryDataUtils.GetTestDataValue("GName"); var isGuid = Guid.TryParse(actual, out var _); StfAssert.IsTrue("is the return from GName{GUID} a GUID", isGuid); }
public void TestStfIgnoreNotDataDriven() { if (StfIgnoreRow) { StfAssert.IsTrue("Must be false", false); return; } StfAssert.IsTrue("Must be true", true); }
public void TestStfIgnoreDataDrivenNoStfIgnore() { if (StfIgnoreRow) { StfAssert.IsTrue("Must be false", false); return; } StfAssert.AreEqual("StfRowNowIgnored", DataRowColumnValue("Bob"), 42); }
/// <summary> /// The create file utils test file. /// </summary> /// <param name="filename"> /// The filename. /// </param> /// <param name="createFile"> /// The create File. /// </param> /// <param name="content"> /// The intended content of the file. /// </param> private void CreateFileUtilsTestFile(string filename, bool createFile, string content = "UnitTestStuff") { if (!createFile) { return; } var ok = StfTestUtils.FileUtils.WriteAllTextFile(filename, content); StfAssert.IsTrue("Was able to create the test file", ok); }
/// <summary> /// The add new review. /// </summary> /// <param name="natiBabyMuluModel"> /// The nati baby mulu model. /// </param> private void AddNewReview(IModel natiBabyMuluModel) { var review = natiBabyMuluModel.Review(); StfAssert.IsNotNull("Review", review); review.Description = "Stf review TC032"; var addReview = review.Add(); StfAssert.IsTrue("Added review by new user", addReview); }
public void OverLayConfigWithDuplicatedSection() { var stfConfiguration = new StfConfiguration(); var conf1 = stfConfiguration.LoadConfig(@"TestData\ConfigOverlay\ConfigWithDuplicatedSection.xml"); var conf2 = stfConfiguration.LoadConfig(@"TestData\ConfigOverlay\ConfigWithDuplicatedSectionOverlay.xml"); var overLay = stfConfiguration.OverLay(conf1, conf2); var confExpected = stfConfiguration.LoadConfig(@"TestData\ConfigOverlay\ConfigWithDuplicatedSectionExpected.xml"); DumpTree(overLay, @"overLay.xml"); DumpTree(confExpected, @"confExpected.xml"); StfAssert.IsTrue("Comparing", confExpected.Identical(confExpected, overLay)); }
/// <summary> /// The create user and find nati baby mulu model. /// </summary> /// <returns> /// The <see cref="IModel"/>. /// </returns> private IModel CreateUserAndFindNatiBabyMuluModel() { StfAssert.IsNotNull("wrapTrackShell", WrapTrackShell); var signUpResult = WrapTrackShell.SignUpAndLogin(); StfAssert.IsTrue("Sign up and login as test user", signUpResult); var natiBabyMuluModel = WrapTrackShell.GetToModel("2624"); StfAssert.IsNotNull("Nati Baby Mulu model", natiBabyMuluModel); return(natiBabyMuluModel); }
public void TestMethodAdapterCanBeUsed() { // need to load the UnitTest plug-ins LoadAdditionalStfPlugins(".", "Stf.UnitTestPlugin*.dll"); var sp2 = Get <IStfUnitTestPlugin2>(); StfAssert.IsNotNull("sp2 != null", sp2); var testPluginModel = Get <ITestPluginAdapter>(); StfAssert.IsNotNull("testPluginModel != null", testPluginModel); StfAssert.IsTrue("Use ModelBase internally", testPluginModel.CanUseAdapterBaseInternally()); }
/// <summary> /// The helper delete file. /// </summary> /// <param name="filename"> /// The filename. /// </param> /// <param name="testComment"> /// The test comment. /// </param> /// <param name="expected"> /// The expected. /// </param> /// <param name="createFileFirst"> /// The create file first. /// </param> private void HelperDeleteFile(string filename, string testComment, bool expected = true, bool createFileFirst = false) { var rootedFileName = Path.IsPathRooted(filename) ? filename : StfTestUtils.GetTestCaseRootFilePath(filename, false); StfLogger.LogHeader(testComment); CreateFileUtilsTestFile(rootedFileName, createFileFirst); var actual = StfTestUtils.FileUtils.DeleteFile(rootedFileName); StfAssert.IsTrue(testComment, expected == actual); }
public void Tc007() { var collection = GetCurrentUserCollection(); // Find a random wrap var wrapToGo = collection.GetRandomWrap(); var wtId = wrapToGo.WtId; StfAssert.IsNotNull("Got a random wrap", wrapToGo); var anotherUser = GetAnotherUser(WrapTrackShell); var passOn = wrapToGo.PassOn(anotherUser); StfAssert.IsTrue("PassedOn", passOn); StfAssert.IsTrue("PassedOn Validated", ValidatePassOn(wtId, anotherUser)); }
public void Tc011() { var collection = GetCurrentUserCollection(); // Find a random wrap var wrapToGo = collection.GetRandomWrap(); var wtId = wrapToGo.WtId; StfAssert.IsNotNull("Got a random wrap", wrapToGo); var anotherUser = GetAnotherUser(WrapTrackShell); var ownershipStart = WtTestscriptUtils.TodayPlusDays(2, "yyyy-MM-dd"); var passOn = wrapToGo.PassOn(anotherUser, ownershipStart); StfAssert.IsTrue("PassedOn", passOn); StfAssert.IsTrue("PassedOn Validated", ValidatePassOn(wtId, anotherUser)); StfAssert.IsTrue("Dummy (waiting for bug #24)", true); }
public void TestMethodAsserts() { StfLogger.LogLevel = StfLogLevel.Internal; StfAssert.EnableNegativeTesting = true; StfAssert.IsTrue("True Value for IsTrue", true); StfAssert.IsTrue("False Value for IsTrue", false); StfAssert.IsTrue("2 > 3 Value for IsTrue", 2 > 3); StfAssert.IsTrue("3 > 2 Value for IsTrue", 3 > 2); StfAssert.IsFalse("True Value for IsFalse", true); StfAssert.IsFalse("False Value for IsFalse", false); StfAssert.IsFalse("2 > 3 Value for IsFalse", 2 > 3); StfAssert.IsFalse("3 > 2 Value for IsFalse", 3 > 2); // setting to true resets count of failures StfAssert.ResetStatistics(); }
public void Tc024() { // Set up user context for actual test // Use default user WrapTrackShell.Login(); var me = WrapTrackShell.Me(); StfAssert.IsNotNull("WrapTrackShell", WrapTrackShell); StfAssert.IsInstanceOfType("me", me, typeof(IMeProfile)); // Create a new wrap var wrapCollection = me.GetCollection(); StfAssert.IsNotNull("check if me.GetCollection null", wrapCollection); var newWrapWtId = wrapCollection.AddWrap(); var wtApi = Get <IWtApi>(); var wrapInfoBefore = wtApi.WrapInfoByTrackId(newWrapWtId); var internalId = wrapInfoBefore.InternalId; // Move to the new wrap var wraptoSendOnVisit = WrapTrackShell.GetToWrap(internalId); // StfAssert.IsNotNull("Check if wraptoSendOnVisit is null", wraptoSendOnVisit); // Move to the new wrap // var wraptoSendOnVisit = WrapTrackShell.GetToWrap(newWrapWtId); var recipient = GetAnotherUser(); // Send wrap away on holiday wraptoSendOnVisit.SendAwayTemporarily(SendAwayReason.Holiday, recipient); // Validate the the wrap indeed is on holiday var wrapInfoAfter = wtApi.WrapInfoByTrackId(newWrapWtId); var userId = wtApi.UserId(recipient); StfLogger.LogInfo("The recipient user name, user id attempted is {0},{1} and userid from wrapInfo API is {1}", recipient, userId, wrapInfoAfter.VisitingUserId); StfAssert.IsTrue("Wrap is on holiday", wrapInfoAfter.OnHoliday); StfAssert.AreEqual("recipient userid is same as VisitingUserId in wrap", userId, wrapInfoAfter.VisitingUserId); }
/// <summary> /// The helper_ test create text file. /// </summary> /// <param name="filename"> /// The filename. /// </param> /// <param name="testComment"> /// The test comment. /// </param> /// <param name="expected"> /// The expected. /// </param> /// <param name="createFileFirst"> /// The create file first. /// </param> private void HelperTestCreateTextFile(string filename, string testComment, bool expected, bool createFileFirst = false) { var rootedFileName = Path.IsPathRooted(filename) ? filename : StfTestUtils.GetTestCaseRootFilePath(filename, false); var fileUtils = new FileUtils(); if (createFileFirst) { var ok = fileUtils.WriteAllTextFile(rootedFileName, "UnitTestStuff"); StfAssert.IsTrue("Was able to create the test file", ok); } var streamWriter = fileUtils.CreateText(rootedFileName); var actual = streamWriter != null; StfAssert.IsTrue(testComment, expected == actual); }