def test_stimulus_steps_legacy(): #Every test should have a user variable that have a test ID number to ensure that you are running the correct test configuration. TEST_ID = 12000 wks = NIVeriStand.Workspace2() #print(statement take a string and it is piped out to a single trace file in the background, for your tracing needs.) print("") SYSDEFFILE = os.path.join(configutilities.get_autotest_projects_path(), "ProfileTest", "Profile Test.nivssdf") print("Deploying %s" % SYSDEFFILE) wks.ConnectToSystem(SYSDEFFILE, 1, 60000) print("System Definition deployed") try: #Verify the TEST_ID var on test file. test_ID = wks.GetSingleChannelValue("TEST_ID") assert (test_ID == TEST_ID), "Deployed wrong test file" stm = NIVeriStand.Stimulus() assert run_test(wks, stm, "Ramp Test.nivstest", 120) sleep() assert run_test(wks, stm, "Conditional Test.nivstest", 120) sleep() assert run_test(wks, stm, "Dwell Test.nivstest", 120) finally: #Always stop the engine. wks.DisconnectFromSystem("", 0)
def test_expected_profile_failures_legacy(): #Every test should have a user variable that have a test ID number to ensure that you are running the correct test configuration. TEST_ID = 12000 #Getting a handle to the workspace API #Other API: Model, Alarm, AlarmManager, SoftwareForcing, ModelManager wks = NIVeriStand.Workspace2() try: #print(statement take a string and it is piped out to a single trace file in the background, for your tracing needs.) print("") #standard way of running a configuration file. VSTANDPROJECTDIR is configured to the location where test project files get sync. So just append your folder and rig file. SYSDEFFILE = os.path.join(configutilities.get_autotest_projects_path(), "ProfileTest", "Profile Test.nivssdf") print("Deploying %s" % SYSDEFFILE ) wks.ConnectToSystem(SYSDEFFILE,1,60000) print("System Definition deployed") #Verify the TEST_ID var on test file. test_ID = wks.GetSingleChannelValue("TEST_ID") assert(test_ID == TEST_ID), "Deployed wrong test file" stm = NIVeriStand.Stimulus() with pytest.raises(NIVeriStandException): gens_error = run_test(wks, stm, "Too Many Gens.nivstest", 120) assert (gens_error == 4294659383) with pytest.raises(NIVeriStandException): steps_error = run_test(wks, stm, "Too Many Steps.nivstest", 120) assert (steps_error == 4294659395) with pytest.raises(NIVeriStandException): aux_error = run_test(wks, stm, "Aux Buffer Overflow.nivstest", 120) assert (aux_error == 4294659393) with pytest.raises(NIVeriStandException): chan_error = run_test(wks, stm, "Invalid Channel.nivstest", 120) assert (chan_error == 4294659387) finally: #Always stop the engine. wks.DisconnectFromSystem("", 0)
def test_stimulus_api_legacy(): wks = NIVeriStand.Workspace() print("") SYSDEFFILE = os.path.join(configutilities.get_autotest_projects_path(), "TestStimulusAPI", "TestStimulusAPI.nivssdf") print("Deploying %s" % SYSDEFFILE) wks.RunWorkspaceFile(SYSDEFFILE, 0, 1, 60000, "", "") try: #Verify the TEST_ID var on test file. test_ID = wks.GetSingleChannelValue("TEST_ID") assert (test_ID == TEST_ID), "Deployed wrong test file" STIMULUSPROFILES_DIR = os.path.join( configutilities.get_autotest_projects_path(), "TestStimulusAPI") AutoStepTestStimulusAPI = os.path.join( STIMULUSPROFILES_DIR, "AutoStepTestStimulusAPI.nivstest") stimTest1 = NIVeriStand.Stimulus() stimTest2 = NIVeriStand.Stimulus() print("Test Reserve and Unreserve") stimTest1.ReserveStimulusProfileManager() print("Done reserving stimulus test 1") with pytest.raises(NIVeriStandException): stimTest2.ReserveStimulusProfileManager() print("Start unreserving") stimTest1.UnreserveStimulusProfileManager() stimTest2.ReserveStimulusProfileManager() stimTest2.UnreserveStimulusProfileManager() print("Run and get test state") result = stimTest1.GetStimulusProfileManagerState() assert (result == 0), "Test state not expected" print("Running Test " + AutoStepTestStimulusAPI) stimTest1.RunStimulusProfile(AutoStepTestStimulusAPI, STIMULUSPROFILES_DIR, 60000, 1, 1) sleep() result = stimTest1.GetStimulusProfileManagerState() assert (result == 2), "Test expected to started already" print("Test Getting back the file we are running") file = stimTest1.GetStimulusProfileFile() assert (file == AutoStepTestStimulusAPI), "Test file are not expected" print("Wait untill stimulus is done") time.sleep(40) result = stimTest1.GetStimulusProfileResult() result = stimTest1.GetStimulusProfileManagerState() assert (result == 0), "Test should have finished by now" stimTest1.RunStimulusProfile(AutoStepTestStimulusAPI, STIMULUSPROFILES_DIR, 60000, 1, 1) sleep() result = stimTest1.GetStimulusProfileManagerState() assert (result == 2), "Test expected to started already" stimTest1.StopStimulusProfile() sleep() result = stimTest1.GetStimulusProfileManagerState() assert (result == 0), "Test expected to stop" print("Test PASSED") print("") finally: wks.StopWorkspaceFile("")